-
Notifications
You must be signed in to change notification settings - Fork 11
/
azure-pipelines-64.yml
134 lines (120 loc) · 3.15 KB
/
azure-pipelines-64.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# https://stackoverflow.com/questions/68028216/azure-devops-use-a-variable-as-a-condition-between-deployment-stages
trigger: none
pool:
vmImage: ubuntu-latest
stages:
- stage: A
jobs:
- deployment: A1
environment: Dev
strategy:
runOnce:
deploy:
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
- pwsh: |
Write-Host "$(Agent.JobName)"
Write-Host "$(System.JobName)"
- deployment: A3
dependsOn: A1
condition: and(succeeded(), eq(dependencies.A1.outputs['A1.printvar.shouldrun'], 'true'))
environment: Dev
strategy:
runOnce:
deploy:
steps:
- script: echo hello from Stage A3
- deployment: AX
dependsOn: A1
variables:
AY: $[ convertToJson(dependencies.A1.outputs) ]
environment: Dev
strategy:
runOnce:
deploy:
steps:
- script:
echo "$(AY)"
- stage: Z
dependsOn: A
variables:
ZY: $[ convertToJson(dependencies.A.outputs) ]
ZZ: $[ convertToJson(stageDependencies.A) ]
jobs:
- job: Z1
steps:
- script: |
echo "$(ZY)"
echo "$(ZZ)"
- stage: B
condition: and(succeeded(), eq(dependencies.A.outputs['A1.printvar.shouldrun'], 'true'))
dependsOn: A
jobs:
- job: B1
steps:
- script: echo hello from Stage B
- stage: BD
condition: and(succeeded(), eq(dependencies.A.outputs['Deploy.printvar.shouldrun'], 'true'))
dependsOn: A
jobs:
- job: BD1
steps:
- script: echo hello from Stage BDeploy
- stage: BB
condition: in(dependencies.A.result, 'Succeeded', 'SucceededWithIssues', 'Skipped')
dependsOn: A
jobs:
- job: BB1
steps:
- script: echo hello from Stage BB
- stage: BBB
condition: in(dependencies.A.result, 'Succeeded', 'SucceededWithIssues', 'Skipped')
variables:
shouldrun: $[stageDependencies.A.A1.outputs['printvar.shouldrun']]
dependsOn: A
jobs:
- job: BBB1
condition: eq(variables.shouldRun, 'true')
steps:
- script: echo hello from Stage BBB
- stage: C
condition: and(succeeded(), eq(dependencies.A.outputs['A1_Dev.Output.printvar.shouldrun'], 'true'))
dependsOn: A
jobs:
- deployment: C1
environment: Dev
strategy:
runOnce:
deploy:
steps:
- script: echo hello from Stage C
- stage: D
dependsOn: []
jobs:
- job: D1
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: E
condition: and(succeeded(), eq(dependencies.D.outputs['D1.printvar.shouldrun'], 'true'))
dependsOn: D
jobs:
- job: E1
steps:
- script: echo hello from Stage E
- stage: F
condition: and(succeeded(), eq(dependencies.D.outputs['D1.printvar.shouldrun'], 'true'))
dependsOn: D
jobs:
- deployment: F1
environment: Dev
strategy:
runOnce:
deploy:
steps:
- script: echo hello from Stage F