Skip to content

Commit

Permalink
Updating read me to match new variable matching
Browse files Browse the repository at this point in the history
  • Loading branch information
BobJWalker committed Nov 3, 2020
1 parent 84a2d9a commit 26ac8c9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
29 changes: 11 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,27 +129,20 @@ In other words, the clone team functionality will only assign existing users and

The cloner defaults to leaving variables on the destination instance as-is.

Some use cases can trip you up. If you find variables aren't being cloned correctly (and they are not sensitive variables), the recommendation is to delete the variables you want cloned in the destination instance and let the default behavior take over. The cloner does the best it can, but it cannot account for odd and/or random configurations.

#### Existing Values
On your source space you have the variable `Testing.Variable` and it is set to `Test`. On the destination instance that same variable exists and it is set to `Super Test`. By default the cloner will leave the value on the destination instance as `Super Test`. To update that value to match the source you will have to set the parameter `OverwriteExistingVariables` to `$true`.

**The default for the paramter `OverwriteExistingVariables` is `$false`.**

#### Variable Ordering

Consider this variable set with the variable `AWS.Region.Subnet`. It has two values.

![](img/variable-set-order.png)

What is tricky is the variables are not stored together in the database. Rather they are two separate entities.

The first value is the first item returned in the variable set array.

![](img/variable-set-values-part-1.png)

The second value doesn't appear until the end of the variable set array.
The space cloner will never overwrite a sensitive variable.

![](img/variable-set-values-part-2.png)
The space cloner matches variables by comparing:
- Names
- Sensitive Values vs Non Sensitive Values
- Environment Scoping
- Channel Scoping
- Process Scoping
- Machine Scoping
- Step Scoping
- Role Scoping

The cloner will match the variable by name, then by scoping.
If you add a scope, the space cloner will see that as a new variable value and add it. Same is true for changing from sensitive to non-sensitive or vice versa.
24 changes: 22 additions & 2 deletions docs/HowItWorks.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,39 @@ This script was designed to be run multiple times with the same parameters. It
- Environments (match by name)
- Feeds (match by name)
- Infrastructure Accounts (match by name)
- Library Variable Set Sensitive variables (match by name)
- Library Variable variables (see below)
- Packages (match by package name and version)
- Project Items
- Channels (match by name)
- Deployment Process steps (match by name)
- Library Variable Set Sensitive variables (match by name)
- Variable Set (match by name)
- Runbook Process steps (match by name)
- Worker Pools (match by name)
- Workers (match by name)
- Teams (match by name)
- Targets (match by name)
- Tenants (match by name)

### Variable Matching

The cloner defaults to leaving variables on the destination instance as-is. **The space cloner will never overwrite a sensitive variable.**

On your source space you have the variable `Testing.Variable` and it is set to `Test`. On the destination instance that same variable exists and it is set to `Super Test`. By default the cloner will leave the value on the destination instance as `Super Test`. To update that value to match the source you will have to set the parameter `OverwriteExistingVariables` to `$true`.

**The default for the paramter `OverwriteExistingVariables` is `$false`.**

The space cloner matches variables by comparing:
- Names
- Sensitive Values vs Non Sensitive Values
- Environment Scoping
- Channel Scoping
- Process Scoping
- Machine Scoping
- Step Scoping
- Role Scoping

If you add a scope, the space cloner will see that as a new variable value and add it. Same is true for changing from sensitive to non-sensitive or vice versa.

## Limitations
Because this is hitting the Octopus Restful API, it cannot decrypt items from the Octopus Database. To decrypt items from the Octopus database, you'll need access to the master key and the database. This script was designed to run on an Octopus Cloud instance. You, the user, do not have access to that information.

Expand Down

0 comments on commit 26ac8c9

Please sign in to comment.