Using API in C# to obtain variable values passed in via command line

For one of our deployment projects, there are a set of variables which make up a package ID. We have a tool that generates the command lines to create a release and deploy it. When creating the release, some variable values are set using “–variable=”.

Later, using the API in C# to look at what has been deployed, we need to see the value for each of those variables. I have not been able to find the property that gets me to those values. The project snapshot variables list those variables but with null for their values. The Release object’s Links has a SnapshotVariables entry. Is there a way to leverage the link in the API? (As an experiment, I try using it as a suffix to the server URL in IE or Chrome and get a 405 error, whereas I try other links, such as for ProjectVariableSnapshot, and get a json object.)

We are using Octopus 3.2.8.

Thanks

Hi Mark,

Thanks for getting in touch! Unfortunately I do not have good news. Based of the fact you are using --variable to define these values they must be prompted.
Prompted variables are not defined in the release snapshot, and only gathered at deployment time. They are then stored in the temporary variable manifest that is then deleted after deployment.
You also cannot force the update of one of these values from a deployment as they cannot affect the value of the release snapshot.

You could do something very complicated like store the value in a file you can retrieve on a common machine (such as a Tentacle on the Octopus Server) to be read after, but it isn’t very elegant.

Sorry for the bad news!
Vanessa

The following is probably not relevant to the original poster’s question, but I thought it might be good to clarify for those who come upon this thread later.

“Prompted variables are not defined in the release snapshot, and only gathered at deployment time.”

To clarify that a bit: if a deployment is (1) scheduled for later and has not yet been run or (2) is running (regardless of whether it was scheduled in advance or just deployed immediately), one of the Links available is to the Variables, which includes the prompted variables.

However, once the deployment completes, the Variables link is no longer included when getting the deployment via the API, and the URL for the variableset 404’s.