Output variable access

Hi Guys,
Is it possible to set an output variable from a C# code (using Octopus.Client ) and then access it back on Octopus server?

Problem : I am invoking an exe (console application) as a step and then i want to set a variable to true / false. Based on this i want to either skip or execute the next step in my deployment process.
Thanks for your help.

Santosh

Hi Santosh,

Thanks for getting in touch! This will not be possible as you intend, as setting output variables is a calamari feature. Invoking it from Octopus.Client is not possible. I may have a solution here though.

Is it possible to assess the condition for setting the output variable outside of the application you are installing? If so, I believe the easiest way to achieve this is to use some custom scripting in your step. You can use the custom script to check that the application has executed correctly or done what is needed, then as a result you can create the output variable to be evaluated on the next step as a variable run condition.

Here is a link to our documentation on custom script. https://octopus.com/docs/deploying-applications/custom-scripts

Please let me know if I have missed anything here or if you have any further questions. :slight_smile:

Best regards,
Daniel

Hi Daniel,
Thanks for the response. I am able to achieve this my exiting my code with error code and in turn skipping the next step. I was trying to see if we can use the Output variables and achieve the same.
Regards,
Santosh Kumar

Hi Santosh,

Thanks for getting back. No worries at all. Let me know if you have any further questions.

Best regards,
Daniel