Is there a way to use varaiables defined in the pipeline(dashboard) to use conditional insertion on a YAML template for steps:
I mean i have this steps:
- ${{ if eq(variables.['somevar'], '')}}:
- task: Bash@3
displayName: Var does not being declared
inputs:
targetType: 'inline'
script: |
echo "This is a step where the var 'somevar' does not being declared'
- task: Bash@3
displayName: Another Step
inputs:
targetType: 'inline'
script: |
echo "This is another step where the var 'somevar' does not being declared'
This should run when the variable is not being declared
- ${{ if ne(variables.['somevar'], '')}}:
- task: Bash@3
displayName: Var is being declared
inputs:
targetType: 'inline'
script: |
echo "This is a step where the var 'somevar' is being declared with some value'
- task: Bash@3
displayName: Another Step
inputs:
targetType: 'inline'
script: |
echo "This is another step where the var 'somevar' is being declared with some value'
This should run when the variable is declared
I know that it exist the Runtime parameters , but i don't want to use them every time that i run the pipeline (manually).I want that some pipelines run some steps, when i have declared the variable, and some other pipelines don't run some steps when the variable is not being declared.
I also know that it exist the condition inside every step like
condition: eq(variables.somevar, 'value')
But i want to use conditional insertion to run in some cases, many steps like in the examples above. Not in just one step