@@ -12,16 +12,18 @@ stages:
12
12
manual : false
13
13
final : false
14
14
jobs :
15
- - Build
15
+ - DoNothing
16
16
17
- Build :
18
- key : BUILD
17
+ # Since auto-build is being run only for a stable branch now — 'stable/dnr-rulesets' —
18
+ # we should skip the build stage for other branches.
19
+ DoNothing :
20
+ key : NOTHING
19
21
other :
20
22
clean-working-dir : true
21
23
docker :
22
24
image : " ${bamboo.dockerContainer}"
23
25
volumes :
24
- ${system.PNPM_DIR} : " ${bamboo.cachePnpm}"
26
+ ${system.PNPM_DIR} : " ${bamboo.cachePnpm}"
25
27
tasks :
26
28
- checkout :
27
29
force-clean-build : ' true'
@@ -39,104 +41,152 @@ Build:
39
41
40
42
BRANCH="${bamboo.planRepository.branchName}"
41
43
42
- # Deploy package from "stable/dnr-rulesets" branch only
43
- if [ $BRANCH != "stable/dnr-rulesets" ]
44
- then
45
- echo "deployment is not supported on branch ${BRANCH}, skipping"
46
- exit 0;
47
- fi
48
-
49
- # Set cache directory
50
- pnpm config set store-dir ${bamboo.cachePnpm}
51
-
52
- # Install dependencies
53
- pnpm install
54
-
55
- # Test dnr rulesets
56
- npx lerna run test --scope @adguard/dnr-rulesets
57
-
58
- # Set date to package version
59
- npx lerna run increment:auto-deploy --scope @adguard/dnr-rulesets
60
-
61
- # Build dnr rulesets
62
- # since updated tgz file should not be committed
63
- npx lerna run build --scope @adguard/dnr-rulesets --include-dependencies
64
-
65
- # Move to package folder
66
- cd packages/dnr-rulesets
67
-
68
- # Create artifacts
69
- pnpm pack && mv adguard-dnr-rulesets-*.tgz dnr-rulesets.tgz
70
- - inject-variables :
71
- file : packages/dnr-rulesets/dist/build.txt
72
- scope : RESULT
73
- namespace : inject
74
- - any-task :
75
- plugin-key : com.atlassian.bamboo.plugins.vcs:task.vcs.commit
76
- configuration :
77
- commitMessage : ' skipci: Automatic increment build number during auto build'
78
- selectedRepository : defaultRepository
79
- - any-task :
80
- plugin-key : com.atlassian.bamboo.plugins.vcs:task.vcs.tagging
81
- configuration :
82
- selectedRepository : defaultRepository
83
- tagName : dnr-rulesets-v${bamboo.inject.version}
84
- final-tasks :
85
- - script :
86
- interpreter : SHELL
87
- scripts :
88
- - |-
89
- set -x
90
- set -e
91
-
92
- # Fix mixed logs
93
- exec 2>&1
94
-
95
- ls -la
96
-
97
- BRANCH="${bamboo.planRepository.branchName}"
98
- if [ $BRANCH != "stable/dnr-rulesets" ]
99
- then
100
- echo "nothing to clean on branch ${BRANCH}, skipping"
101
- exit 0;
102
- fi
103
-
104
- echo "Size before cleanup:" && du -h | tail -n 1
105
-
106
- pnpm --filter @adguard/dnr-rulesets clear
107
-
108
- pnpm clean
109
-
110
- echo "Size after cleanup:" && du -h | tail -n 1
111
- artifacts :
112
- - name : dnr-rulesets.tgz
113
- location : packages/dnr-rulesets/
114
- pattern : dnr-rulesets.tgz
115
- shared : true
116
- required : true
44
+ echo "Build and deployment is not supported on branch ${BRANCH}, skipping"
117
45
requirements :
118
46
- adg-docker : ' true'
47
+ - extension : ' true'
119
48
120
- # runs plan every 3 hours
121
- triggers :
122
- - cron :
123
- expression : 0 0 */3 * * ?
49
+ triggers : []
124
50
125
- branches :
126
- # only run plan for 'stable/dnr-rulesets' branch.
51
+ branches : &branches
127
52
create : manually
128
53
delete : never
129
54
link-to-jira : ' true'
130
55
131
- notifications :
56
+ notifications : ¬ifications
132
57
- events :
133
58
- plan-status-changed
134
59
recipients :
135
60
- webhook :
136
61
name : Build webhook
137
62
url : http://prod.jirahub.service.eu.consul/v1/webhook/bamboo
138
63
139
- labels : []
140
-
141
- other :
142
- concurrent-build-plugin : system-default
64
+ # Run plan only for 'stable/dnr-rulesets' branch.
65
+ # Override is needed to skip the build stage for other branches,
66
+ # because even if branches are not supposed to be run for PRs (due to 'create: manually' above),
67
+ # build was triggered by 'cron' anyway.
68
+ branch-overrides :
69
+ -
70
+ stable/dnr-rulesets :
71
+ stages :
72
+ - Build :
73
+ - Build
74
+ Build :
75
+ key : BUILD
76
+ other :
77
+ clean-working-dir : true
78
+ docker :
79
+ image : " ${bamboo.dockerContainer}"
80
+ volumes :
81
+ ${system.PNPM_DIR} : " ${bamboo.cachePnpm}"
82
+ tasks :
83
+ - checkout :
84
+ force-clean-build : ' true'
85
+ - script :
86
+ interpreter : SHELL
87
+ scripts :
88
+ - |-
89
+ set -e
90
+ set -x
91
+
92
+ # Fix mixed logs
93
+ exec 2>&1
94
+
95
+ ls -alt
96
+
97
+ BRANCH="${bamboo.planRepository.branchName}"
98
+
99
+ # Deploy package from "stable/dnr-rulesets" branch only
100
+ if [ $BRANCH != "stable/dnr-rulesets" ]
101
+ then
102
+ echo "deployment is not supported on branch ${BRANCH}, skipping"
103
+ exit 0;
104
+ fi
105
+
106
+ # Set cache directory
107
+ pnpm config set store-dir ${bamboo.cachePnpm}
108
+
109
+ # Install dependencies
110
+ pnpm install
111
+
112
+ # Test dnr rulesets
113
+ npx lerna run test --scope @adguard/dnr-rulesets
114
+
115
+ # Set date to package version
116
+ npx lerna run increment:auto-deploy --scope @adguard/dnr-rulesets
117
+
118
+ # Build dnr rulesets
119
+ # since updated tgz file should not be committed
120
+ npx lerna run build --scope @adguard/dnr-rulesets --include-dependencies
121
+
122
+ # Move to package folder
123
+ cd packages/dnr-rulesets
124
+
125
+ # Create artifacts
126
+ pnpm pack && mv adguard-dnr-rulesets-*.tgz dnr-rulesets.tgz
127
+ - inject-variables :
128
+ file : packages/dnr-rulesets/dist/build.txt
129
+ scope : RESULT
130
+ namespace : inject
131
+ - any-task :
132
+ plugin-key : com.atlassian.bamboo.plugins.vcs:task.vcs.commit
133
+ configuration :
134
+ commitMessage : ' skipci: Automatic increment build number during auto build'
135
+ selectedRepository : defaultRepository
136
+ - any-task :
137
+ plugin-key : com.atlassian.bamboo.plugins.vcs:task.vcs.tagging
138
+ configuration :
139
+ selectedRepository : defaultRepository
140
+ tagName : dnr-rulesets-v${bamboo.inject.version}
141
+ final-tasks :
142
+ - script :
143
+ interpreter : SHELL
144
+ scripts :
145
+ - |-
146
+ set -x
147
+ set -e
148
+
149
+ # Fix mixed logs
150
+ exec 2>&1
151
+
152
+ ls -la
153
+
154
+ BRANCH="${bamboo.planRepository.branchName}"
155
+ if [ $BRANCH != "stable/dnr-rulesets" ]
156
+ then
157
+ echo "nothing to clean on branch ${BRANCH}, skipping"
158
+ exit 0;
159
+ fi
160
+
161
+ echo "Size before cleanup:" && du -h | tail -n 1
162
+
163
+ pnpm --filter @adguard/dnr-rulesets clear
164
+
165
+ pnpm clean
166
+
167
+ echo "Size after cleanup:" && du -h | tail -n 1
168
+ artifacts :
169
+ - name : dnr-rulesets.tgz
170
+ location : packages/dnr-rulesets/
171
+ pattern : dnr-rulesets.tgz
172
+ shared : true
173
+ required : true
174
+ requirements :
175
+ - adg-docker : ' true'
176
+ - extension : ' true'
177
+
178
+ # runs plan every 3 hours
179
+ triggers :
180
+ - cron :
181
+ expression : 0 0 */3 * * ?
182
+
183
+ branches :
184
+ << : *branches
185
+
186
+ notifications :
187
+ << : *notifications
188
+
189
+ labels : []
190
+
191
+ other :
192
+ concurrent-build-plugin : system-default
0 commit comments