Skip to content

Commit 0201caf

Browse files
committed
actually run dnr-rulesets auto-build only for the stable branch
Squashed commit of the following: commit b7c7362 Merge: b7ed2e8 5ee5e65 Author: Slava Leleka <[email protected]> Date: Tue Jan 21 18:54:46 2025 +0200 Merge branch 'master' into fix/dnr-rulesets-override-artifacts-01 commit b7ed2e8 Author: Slava Leleka <[email protected]> Date: Tue Jan 21 14:37:40 2025 +0200 improve comment commit 3c31fcf Author: Slava Leleka <[email protected]> Date: Tue Jan 21 12:07:56 2025 +0200 fix comment commit 727964b Author: Slava Leleka <[email protected]> Date: Mon Jan 20 20:50:56 2025 +0200 use yaml anchors for branches and notifications commit 176b1fe Author: Slava Leleka <[email protected]> Date: Mon Jan 20 20:48:07 2025 +0200 fix build commit 88f6040 Author: Slava Leleka <[email protected]> Date: Mon Jan 20 20:45:35 2025 +0200 one more try commit d5b8681 Author: Slava Leleka <[email protected]> Date: Mon Jan 20 20:38:48 2025 +0200 move triggers commit 1f69606 Author: Slava Leleka <[email protected]> Date: Mon Jan 20 20:36:34 2025 +0200 try different approach commit 3a2de0b Author: Slava Leleka <[email protected]> Date: Mon Jan 20 20:24:26 2025 +0200 try to publish dnr-rulesets artifacts only for the stable branch
1 parent 5ee5e65 commit 0201caf

File tree

1 file changed

+140
-90
lines changed

1 file changed

+140
-90
lines changed

bamboo-specs/dnr-rulesets-auto-build.yaml

+140-90
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ stages:
1212
manual: false
1313
final: false
1414
jobs:
15-
- Build
15+
- DoNothing
1616

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
1921
other:
2022
clean-working-dir: true
2123
docker:
2224
image: "${bamboo.dockerContainer}"
2325
volumes:
24-
${system.PNPM_DIR}: "${bamboo.cachePnpm}"
26+
${system.PNPM_DIR}: "${bamboo.cachePnpm}"
2527
tasks:
2628
- checkout:
2729
force-clean-build: 'true'
@@ -39,104 +41,152 @@ Build:
3941
4042
BRANCH="${bamboo.planRepository.branchName}"
4143
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"
11745
requirements:
11846
- adg-docker: 'true'
47+
- extension: 'true'
11948

120-
# runs plan every 3 hours
121-
triggers:
122-
- cron:
123-
expression: 0 0 */3 * * ?
49+
triggers: []
12450

125-
branches:
126-
# only run plan for 'stable/dnr-rulesets' branch.
51+
branches: &branches
12752
create: manually
12853
delete: never
12954
link-to-jira: 'true'
13055

131-
notifications:
56+
notifications: &notifications
13257
- events:
13358
- plan-status-changed
13459
recipients:
13560
- webhook:
13661
name: Build webhook
13762
url: http://prod.jirahub.service.eu.consul/v1/webhook/bamboo
13863

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

Comments
 (0)