We are trying to use an output variable from the previous action step in an Email step.
We are version 2019.12.2
When we try to reference a variable for the subject, we want to reference this:
#{Octopus.Action[Extract Build Info].Output.Branch}
While the variable up to this point. “Octopus.Action[Extract Build Info]” is available, the .Output is not an option.
Instead it suggests .RunOnServer
.Script.ScriptBody
.Script.ScriptSource
.Script.Syntax
.TargetRoles
So we are not able to access the output variable.
Is there something else we need to specify so make .Output available? I feel like it should be present for our version (yes it’s outdated) but I see posts from previous versions talking about it.
Thanks for reaching out! I’m sorry you are having trouble with this particular output variable feeding into your email subject line, but I would be happy to help take a closer look at this. In reviewing the information you’ve provided so far it does look like your syntax is correct, so we’ll need to dive a little deeper on this.
As a first step, would you be able to enable verbose variable output for this project and run through another deployment to see what all gets outputted? Enabling these variables within your project will force Octopus to print all relevant variables in the deployment task log. Feel free to upload the new task log at the following secure link for review if you’d like our team to take look.
I hope this helps shed some light on the underlying problem, but let me know if I can be of any more help.
While the deploy is happening, I just feel like it is concerning that the auto population of available variables for me to use do not include the .Output variable?
Can you confirm if my version (2019.12.2) should have the ability to access the .Output form an Octopus.Action[StepName].Output.X
Searched for targets:
August 18th 2022 14:59:18Verbose
* specifically matching these ids: Machines-101
* that are enabled
* with no id exclusions
* with no environment exclusions
* has a role that overlaps: WWW App
* with no tenant exclusions
* with any health status
August 18th 2022 14:59:18Info
Skipping this step as no matching targets were found
In doing some research on my side I was able to find some help posts where individuals were using this feature back in 2015, so your version of Octopus Deploy should support this as well.
Let me know what you find out in reviewing the verbose log output, but hopefully this provides some direction on troubleshooting this further.
Hoping to extract the branch and version and Branch is empty, so I need to debug this, but waiting for deploys is brutal. Is there some console I can retest the script against past runs?
Thanks for providing more detail around your process.
Unfortunately, as this deals with step output variables you would need to run through a deployment to test this properly. This is also why you are unable to pre-select the variable via drop-downs, as this output variable is generated dynamically during the deployment process.
A couple of things you could try to speed up the debugging process would be to break these specific steps out into their own project/runbook temporarily (using the "Run a Script step template) so you can isolate the problem, or alternatively you could redeploy your existing project and exclude any steps that are not relevant to your current testing.
So I thought perhaps it’s empty because I hadn’t set a Package Id, but then when i set package Id,
I get an error
[Octopus Deploy] Creating release...
[04:50:54] [Octopus Deploy] Error from Octopus server (HTTP 400): There was a problem with your request.
[04:50:54] [Octopus Deploy]
[04:50:54] [Octopus Deploy] - No package version was specified for Extract Build Info:XXX.CorporateSite.Web.Site
[04:50:54] [Octopus Deploy]
Well of course i didn’t specify a version in that step, it doesn’t give me an option to do so… Nor would i want to i just want it to grab the Build info the package currently being deployed.
You can access the build information by calling against /space-id/build-information. You can view the calls you can perform by accessing the SwaggerUI on your URL (which is your base URL and swaggerui/index.html just in case you haven’t accessed it before).
You can get build information by a list or ID, and then on each build information object, you will have a branch property.
Your script for extracting the variables looks fine and works ok on my end, I’d just like to confirm how you are trying to output the variables in the Slack notification step?
I just tested outputting the variables to the log in a Run a script step, however it should be very similar to the following for the Slack step:
So i’m using power shell in a build step, is there an power shell method that calls this API?
In the context of a build step, how do I get the correct id of the resource to call the