Hi guys, I have a deployment that consists from one small script, that fetches some IIS properties of the site associated with my tenant.
And I want to return fetched info from this deployment to my C# client, which I use to start the deployment.
So I have C# client and there I prepare a deployment, get its task and wait for it to finish
var deploymentCreated = _repository.Deployments.Create(deployment);
var task = _repository.Tasks.Get(deploymentCreated.TaskId);
_repository.Tasks.WaitForCompletion(task);
var result = _repository.Tasks.GetDetails(task);
I created a variable called “result” in project, but I can’t see it’s value anywhere in my result object or task object.
My best guess was
var resultVariable = _repository.VariableSets.Get(deploymentCreated.ManifestVariableSetId).Variables.FirstOrDefault(v => v.Name == "result");
but it’s Value is null.
And here is how I am setting the variable value in the Octopus powershell script:
Thanks for reaching out! I have a couple of points to mention that might help you get to the bottom of this:
Variables created via Set-OctopusVariable are called Output Variables. These variables are only available in steps that come AFTER the step where they were created on. So if you are creating them in step 1, they’ll be available from step 2 onwards.
If you want to know if your variable is available in a specific step during your deployment, you can follow this other doc. This way you’ll print all the variables and their values at each point of the deployment.
If after those steps you still find yourself in a struggle, please send me the log file from step (3) so I can take a look at it. If it contains sensitive info feel free to email it to support@Octopus.com.
Sorry I misundestood your initial reply! I’m glad to hear you figured it out yourself. Thanks for taking the time to come back here and posting your solution to the community!