I built a pipeline. There are two stages. The deployment stage job has a condition derived from the first stage variable. The sample pipeline is provided below.
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: Stage
jobs:
- deployment: Staging
displayName: Stage the WebApp
environment: stg
strategy:
runOnce:
deploy:
steps:
- bash: echo "##vso[task.setvariable variable=myStageOutputVar;isOutput=true]true"
env:
myVar: 'this is a stage output var'
name: printvar
- stage: Swap
dependsOn: Stage
condition: eq(dependencies.Stage.Staging.outputs['Staging.printvar.myStageOutputVar'], 'true')
variables:
myVarfromStage: $[ stageDependencies.Stage.Staging.outputs['Staging.printvar.myStageOutputVar'] ]
jobs:
- deployment: Production
displayName: Swap to production
environment: adt
strategy:
runOnce:
deploy:
steps:
- script: echo $(myVarfromStage)
Every time, the Swap - stage is skipped. Any changes that must be made in the condition?