Variable Substitution at process step level

Hi,

I wanted to execute a step when a specific condition met e.g. for a matching/specfic release in the below example

I followed this documentation and set this condition at the process step level and tried to deploy a release other then 2021.1.0.1493 and the step is still executing instead of skipping.

I tried couple more variation for the expression but none worked
#{if Octopus.Release.Number == ‘2021.1.0.1493’}true#{/if}
#{if Octopus.Release.Number == “2021.1.0.1493”}true#{/if}
#{Octopus.Release.Number} == ‘2021.1.0.1493’

Can you please suggest what’s wrong in here.

Hi Rasmita,
Thanks for reaching out! Sorry to hear you’re running into this issue with Variable Substitution.

I’d like to see what the variable output is during the deployment. Would you be able to turn on Variable Logging recreate the release, rerun the build and send over the Raw Log for this new build?

If you’d prefer you can send your logs to our secure email at Support@octopus.com and can have a look. at them there.

Looking forward to hearing from you shortly.
Kind Regards,
Tina

Hi Rasmita,

I just wanted to jump in here quickly as Tina is now offline as part of our US-based team.

Your syntax looks perfect. I gave this a test and I’ve confirmed this works as we both expect in my local instance running 2021.1. I’ve noticed this variable run condition is defined in a child step, where there was recently a bug (fixed in 2020.5, bug report linked below) where a run condition defined on the parent step incorrectly overrides the run condition on the child step. I’m wondering if that might be the explanation behind this unexpected behavior?

If that doesn’t seem to line up with your scenario, the task logs Tina requested should give us enough information to dive in and see what could be happening. :slight_smile:

Best regards,

Kenny

2021.2.0.1575.log.txt (234.2 KB) 2021.1.0.1493.log.txt (234.7 KB)

Hi Kenny,

the logs are attached here. we are currently on 2020.4.6 octopus version. is this the reason we are experiencing the issue as you said above its fixed in 2020.5 version. please note that the condition is returning false always now with both 2021.1.0.1493 (should be true here and the step should run) and 2021.2.0.1575.

So now I am kind of confused what’s going on.

Thanks,
Rasmita

Hi Rasmita,

Thanks for keeping in touch and sending through your task log! That is confusing! Since the bug report I linked to below is due to a run condition on a parent step incorrectly overriding the condition on the child step, it doesn’t look like that applies here as your task log is only reporting the run condition evaluating for the child step (Update Enumeration cacheMode) and not showing any defined on its parent step.

Another quick test locally was successful, i.e. the variable run condition evaluates correctly both when it should evaluate as false and another as true. This was using the syntax #{if Octopus.Release.Number == "2021.1.0.1493"}true#{/if}.

So I can try to rule out any small configuration issue, would you be willing to enable debugging variables in your project (OctopusPrintVariables and OctopusPrintEvaluatedVariables, both with a value of True) and create and deploy a new release? The resulting task log will have a lot more information written to it, including how the variables evaluate for each step, the variable expression on the run condition, etc. to help me attempt a perfect reproduction of this issue.

I look forward to hearing back and getting to the bottom of this one. :slight_smile:

Best regards,

Kenny

I have uploaded both the full log here for your reference.
https://transplantconnectinc-my.sharepoint.com/:f:/g/personal/rpolleyi_transplantconnect_com/EqP0yWyWnTRCu64FJowamoYBTj9OilBEkkubgWqMrnsvYw?e=a2P3TM

Please note that this investigated step is part of a webUI step group which has many other steps. Let me know what you can get from the full log and meanwhile i will try to do the above debugging suggestion and get back to you this week.

Thanks,
Rasmita

Hi,

So to be clear

  1. I will add the two variable to the project OctopusPrintVariables and OctopusPrintEvaluatedVariables, both with a value of True

  2. The run condition on the step will be still #{if Octopus.Release.Number == “2021.1.0.1493”}true#{/if}.

  3. Enable verbose logging

  4. Deploy the 2021.1.0.1493 and 2021.2.0.XXXX release again after updating the variable set. I believe we do not need to recreate the release again as we are just adding new variable and not updating any process change.

Hi Rasmita,

Thanks for keeping in touch. I look forward to having a look at your verbose deployment log, as that should give me enough details to accurately reproduce this issue. Note that there’s a chance this could be a different issue you’re facing in your current version, one which I can’t pinpoint, meaning an upgrade to your Octopus server could possibly sort this out for you. :slight_smile:

Best regards,

Kenny

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.