I have declared a variable group "myVariableGroup" and inside this I have a variable name "myVariable" with default value = true.
Pipeline looks like this
- I declared the group variable name in variables
- first step, I debug the result of myVariable, working fine, I get the value true
- second step, I pass the variable to a template parameter
variables:
- group: myVariableGroup
steps:
- script: "echo myVariableFROM group vars = $(myVariable)"
displayName: debug groupvars
- template: "./.azure-devops/some-template.yml"
parameters:
myVariableParam: $(myVariable)
Template looks like this
- parameter declared with default value false
- debug the parameter value, result being true (it works)
- I'm using an if statement to determine if the bash script should run or not, but this is not working
parameters:
- name: myVariableParam
type: boolean
default: false
- script: "echo parameters.myVariableParam = ${{ parameters.myVariableParam}}"
displayName: debug parameters.myVariableParam
- ${{ if eq(parameters['myVariableParam'], true) }}:
- script: "echo parameters.myVariableParam= ${{ parameters.myVariableParam}}"
Questions:
- Is it possible to use group variables inside if statements or the IF is interpreted before running the pipeline and value is not defined?
- The only way to achieve this is via conditions? I have a corner case where I don't really want to use those
- Maybe I miss something pretty obvious and can anybody help me with this?