-
Notifications
You must be signed in to change notification settings - Fork 11
/
azure-pipelines-24.yml
44 lines (39 loc) · 1.02 KB
/
azure-pipelines-24.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# https://stackoverflow.com/questions/64559356/azure-devops-stage-to-stage-dependency-using-output-variable-in-condition-not-wo
trigger: none
pr: none
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: A
condition: false
jobs:
- job: A1
steps:
- script: echo Job A1
- stage: B
condition: always()
jobs:
- job: B1
steps:
- bash: echo "##vso[task.setvariable variable=shouldrun;isOutput=true]true"
# or on Windows:
# - script: echo ##vso[task.setvariable variable=shouldrun;isOutput=true]true
name: printvar
- stage: C
condition: and(eq(dependencies.B.outputs['B1.printvar.shouldrun'], 'true'), in(dependencies.A.result, 'Failed', 'Skipped')) # it works
dependsOn:
- A
- B
jobs:
- job: C1
steps:
- script: echo hello from Stage C
- stage: D
condition: and(in(dependencies.A.result, 'Failed', 'Skipped'), eq(dependencies.B.outputs['B1.printvar.shouldrun'], 'true')) # it doesn't work
dependsOn:
- A
- B
jobs:
- job: D1
steps:
- script: echo hello from Stage D