I have a lot of variable configuration to do, and detesting mindless data entry, I decided to use the web api to automate the process.
I basically pick up an xml file, parse out the values and set them in the variables for a project. Much the same as demonstrated here :
I run into a problem when I try and set the environment though. If I have do not have dashes in the environment name, I get the following error :
An unhandled exception of type 'Octopus.Client.Exceptions.OctopusServerException' occurred in Octopus.Client.dll
Additional information: Octopus Server returned an error: The document ID My Test doesn't have a dash!
This happens regardless if I have a one word environment name, or a multiword environment name. So ‘My Test’ and ‘MyTest’ both trigger this error.
Further, if I add the dash, all the variables on the server get set, but no environment gets set. If I pass more than one environment in, all having dashes, all I see are commas in the Scope box in the UI.
Am I missing something here? Are there limitations I do not know about?
Here is the technichal stuff
Octopus Version 3.2.2
Octopus.Client Library 3.2.4
The project with the error can be found here :
https://github.com/CareerCruising/octo-admin
The xml structure it expects looks like
<whatever
attribute1="value1"
attribute2="vaule2"
/>
And the command line for the app looks like
octo-variables
-server "http://yourserverhere"
-key "your key here"
-project "your project here"
-file "path to xml file"
-environment "project1, project2"
-xpath "//whatever"