Merging variables between two Octopus Deploy Servers

I have played around with the Octopus Deploy 3.0 import and export features. One question I have is when I import *.json files exported from a different server, I have the option to overwrite. However, the overwrite actually do not replace the content of the corresponding *.json file in the target server but rather combine the content of the two files. In particular I am trying to update the value/scope of variables in the variable sets. By combining the two json files it will lead to contradictory variable definitions. In additions, I read from Octopus’s webpage on Data Migration (http://docs.octopusdeploy.com/display/OD/Data+migration), it said it doesn’t support “out-of-the-box” way to merge variables. To achieve this I need to manually merge two json files exported from two servers and then re-import it back to the server. However, if importing data will only combine the corresponding two json files, this approach still wouldn’t update existing variables in the target server. What is the correct way to update the variables without manually change it? Thanks

We did change the behavior for variables slightly based on feedback from users. Like teams this is no longer a simple overwrite because otherwise you would only ever get library variables from the overwriting export files.

What happens now is that variables with the same ID are overwritten but all others are retained. The variable ID is an internally allocated ID so two variables will only have the same ID if they came from the same original source. e.g. copy from server 1 to server 2 and then copy again later or copy back.

Import / export via JSON is intended primarily as a way to move one or more projects from one server to another, or as a way to check all the configuration data into source control. More complex scenarios involving merge conflicts and resolving those conflicts aren’t something we are tackling in this release.

For now, if you want to do more complex merges of data from different servers we recommend you create two branches from the same source controlled repository. Check the JSON from one server into one, the JSON from the other into the other, then merge the branches and resolve any conflicts manually and/or delete any objects you don’t want. Now import the result back into a clean instance of Octopus Server.

I hope that helps and if you have any more feedback or suggestions for how you’d like to see Export/Import work we’d be happy to hear them.