-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
166 lines (158 loc) · 4.4 KB
/
azure-pipelines.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
trigger:
branches:
include:
- master
paths:
include:
- A/**
- B/**
- C/**
- D/**
- E/**
pool:
vmImage: 'ubuntu-latest'
variables:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
jobs:
- job: GetChangedFiles
displayName: 'Get Changed Files'
steps:
- script: |
echo "Fetching previous commit SHA..."
prev_commit=$(git rev-parse HEAD^)
echo "Previous commit SHA: $prev_commit"
echo "Fetching current commit SHA..."
curr_commit=$(git rev-parse HEAD)
echo "Current commit SHA: $curr_commit"
echo "Fetching changed files..."
changed_files=$(git diff --name-only $prev_commit $curr_commit)
echo "Changed files: $changed_files"
echo "##vso[task.setvariable variable=changedFiles]$changed_files"
displayName: 'Fetch Changed Files'
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
- job: Build_A
displayName: Build A
dependsOn: GetChangedFiles
condition: and(succeeded(), or(contains(variables['changedFiles'], 'A/service1/'), contains(variables['changedFiles'], 'A/service2/'), contains(variables['changedFiles'], 'A/service3/')))
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
echo "Building A/services..."
cd A/service1
npm install
npm run build
displayName: 'Build A/service1'
- script: |
cd A/service2
npm install
npm run build
displayName: 'Build A/service2'
- script: |
cd A/service3
npm install
npm run build
displayName: 'Build A/service3'
- job: Build_B
displayName: Build B
dependsOn: GetChangedFiles
condition: and(succeeded(), or(contains(variables['changedFiles'], 'B/service1/'), contains(variables['changedFiles'], 'B/service2/'), contains(variables['changedFiles'], 'B/service3/')))
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
echo "Building B/services..."
cd B/service1
npm install
npm run build
displayName: 'Build B/service1'
- script: |
cd B/service2
npm install
npm run build
displayName: 'Build B/service2'
- script: |
cd B/service3
npm install
npm run build
displayName: 'Build B/service3'
- job: Build_C
displayName: Build C
dependsOn: GetChangedFiles
condition: and(succeeded(), or(contains(variables['changedFiles'], 'C/service1/'), contains(variables['changedFiles'], 'C/service2/'), contains(variables['changedFiles'], 'C/service3/')))
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
echo "Building C/services..."
cd C/service1
npm install
npm run build
displayName: 'Build C/service1'
- script: |
cd C/service2
npm install
npm run build
displayName: 'Build C/service2'
- script: |
cd C/service3
npm install
npm run build
displayName: 'Build C/service3'
- job: Build_D
displayName: Build D
dependsOn: GetChangedFiles
condition: and(succeeded(), or(contains(variables['changedFiles'], 'D/service1/'), contains(variables['changedFiles'], 'D/service2/'), contains(variables['changedFiles'], 'D/service3/')))
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
echo "Building D/services..."
cd D/service1
npm install
npm run build
displayName: 'Build D/service1'
- script: |
cd D/service2
npm install
npm run build
displayName: 'Build D/service2'
- script: |
cd D/service3
npm install
npm run build
displayName: 'Build D/service3'
- job: Build_E
displayName: Build E
dependsOn: GetChangedFiles
condition: and(succeeded(), or(contains(variables['changedFiles'], 'E/service1/'), contains(variables['changedFiles'], 'E/service2/'), contains(variables['changedFiles'], 'E/service3/')))
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- script: |
echo "Building E/services..."
cd E/service1
npm install
npm run build
displayName: 'Build E/service1'
- script: |
cd E/service2
npm install
npm run build
displayName: 'Build E/service2'
- script: |
cd E/service3
npm install
npm run build
displayName: 'Build E/service3'