Skip to content

Commit 9457be9

Browse files
Update tenant variable CLI and script examples (#3013)
* Fix CLI examples * Replace outdated example scripts for project tenant variables * Add common tenant variable scripts * Fix lint * Use consistent naming * Fix lint
1 parent 832294f commit 9457be9

6 files changed

Lines changed: 1136 additions & 391 deletions

src/pages/docs/octopus-rest-api/cli/octopus-tenant-variables-update.mdx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: src/layouts/Default.astro
33
pubDate: 2023-01-01
4-
modDate: 2025-05-07
4+
modDate: 2026-01-20
55
title: octopus tenant variables update
66
description: Update the value of a tenant variable
77
navOrder: 145
@@ -10,7 +10,7 @@ import SamplesInstance from 'src/shared-content/samples/samples-instance.include
1010

1111
Update the value of a tenant variable in Octopus Deploy
1212

13-
```
13+
```text
1414
Usage:
1515
octopus tenant variables update [flags]
1616
@@ -35,15 +35,29 @@ Global Flags:
3535

3636
<SamplesInstance />
3737

38-
```
38+
```bash
39+
# Interactive mode - prompts for all required values
3940
$ octopus tenant variables update
41+
42+
# Update a project variable for a specific environment (single environment scope)
4043
$ octopus tenant variables update --tenant "Bobs Fish Shack" --name "site-name" --value "Bob's Fish Shack" --project "Awesome Web Site" --environment "Test"
41-
$ octopus tenant variables update --tenant "Sally's Tackle Truck" --name dbPassword --value "12345" --library-variable-set "Shared Variables"
44+
45+
# Update a project variable for multiple environments (multiple environment scopes)
46+
$ octopus tenant variables update --tenant "Bobs Fish Shack" --name "database-server" --value "prod-db-01" --project "Awesome Web Site" --environment "Staging" --environment "Production"
47+
48+
# Update a project variable for all environments (unscoped - omit --environment flag)
49+
$ octopus tenant variables update --tenant "Bobs Fish Shack" --name "app-name" --value "Bobs App" --project "Awesome Web Site"
50+
51+
# Update a common variable from a library variable set
52+
$ octopus tenant variables update --tenant "Sally's Tackle Truck" --name "dbPassword" --value "12345" --library-variable-set "Shared Variables"
53+
54+
# Update a common variable with environment scoping
55+
$ octopus tenant variables update --tenant "Sally's Tackle Truck" --name "api-key" --value "prod-key-123" --library-variable-set "API Config" --environment "Production"
4256

4357

4458
```
4559

4660
## Learn more
4761

4862
- [Octopus CLI](/docs/octopus-rest-api/cli)
49-
- [Creating API keys](/docs/octopus-rest-api/how-to-create-an-api-key)
63+
- [Creating API keys](/docs/octopus-rest-api/how-to-create-an-api-key)

src/pages/docs/octopus-rest-api/cli/octopus-tenant-variables.mdx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: src/layouts/Default.astro
33
pubDate: 2023-01-01
4-
modDate: 2025-05-07
4+
modDate: 2026-01-20
55
title: octopus tenant variables
66
description: Manage tenant variables
77
navOrder: 143
@@ -10,7 +10,7 @@ import SamplesInstance from 'src/shared-content/samples/samples-instance.include
1010

1111
Manage tenant variables in Octopus Deploy
1212

13-
```
13+
```text
1414
Usage:
1515
octopus tenant variables [command]
1616
@@ -36,14 +36,17 @@ Use "octopus tenant variables [command] --help" for more information about a com
3636

3737
<SamplesInstance />
3838

39-
```
39+
```bash
4040
$ octopus tenant variables list "Bobs Wood Shop"
41-
$ octopus tenant variables update --tenant "Bobs Fish Shack" --name "site-name" --value "Bob's Fish Shack" --project "Awesome Web Site" --environment "Test"
4241

42+
# Update a project variable for a specific environment (single environment scope)
43+
$ octopus tenant variables update --tenant "Bobs Fish Shack" --name "site-name" --value "Bob's Fish Shack" --project "Awesome Web Site" --environment "Test"
4344

45+
# Update a common variable from a library variable set for specific environments
46+
$ octopus tenant variables update --tenant "Bobs Fish Shack" --name "company-logo" --value "bobs-logo.png" --library-variable-set "Shared Assets" --environment "Production"
4447
```
4548

4649
## Learn more
4750

4851
- [Octopus CLI](/docs/octopus-rest-api/cli)
49-
- [Creating API keys](/docs/octopus-rest-api/how-to-create-an-api-key)
52+
- [Creating API keys](/docs/octopus-rest-api/how-to-create-an-api-key)
Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
---
22
layout: src/layouts/Default.astro
33
pubDate: 2023-01-01
4-
modDate: 2023-01-01
4+
modDate: 2026-01-20
55
title: Update tenant variables
6-
description: An example script that updates tenant variables for a specific project template with a single value across each connected environment in Octopus using the REST API and Octopus.Client.
6+
description: Example scripts that update tenant variables for both project variables and common (library) variables in Octopus using the REST API and Octopus.Client.
77
---
8-
import UpdateTenantVariableScripts from 'src/shared-content/scripts/update-tenant-variable-scripts.include.md';
8+
import UpdateTenantProjectVariableScripts from 'src/shared-content/scripts/update-tenant-project-variable-scripts.include.md';
9+
import UpdateTenantCommonVariableScripts from 'src/shared-content/scripts/update-tenant-common-variable-scripts.include.md';
910

10-
This script demonstrates how to programmatically update tenant variables with a single value across each connected environment in Octopus.
11+
These scripts demonstrate how to programmatically update tenant variables.
1112

12-
## Usage
13+
## Update project tenant variables
1314

1415
Provide values for:
1516

@@ -21,6 +22,18 @@ Provide values for:
2122
- The new variable value
2223
- Choose whether the new variable value is bound to an Octopus variable value e.g. `#{MyVariable}`
2324

24-
## Script
25+
<UpdateTenantProjectVariableScripts />
2526

26-
<UpdateTenantVariableScripts />
27+
## Update common tenant variables
28+
29+
Provide values for:
30+
31+
- Octopus URL
32+
- Octopus API Key
33+
- Name of the space to use
34+
- Name of the tenant
35+
- Name of the Library template
36+
- The new variable value
37+
- Choose whether the new variable value is bound to an Octopus variable value e.g. `#{MyVariable}`
38+
39+
<UpdateTenantCommonVariableScripts />

0 commit comments

Comments
 (0)