Skip to content

Commit 9cccbc8

Browse files
committed
Merge branch 'master' into fix/AG-48295-01
2 parents afbd91a + 19ea110 commit 9cccbc8

File tree

6 files changed

+83
-39
lines changed

6 files changed

+83
-39
lines changed

bamboo-specs/build.yaml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,7 @@ Build:
5353
- script:
5454
interpreter: SHELL
5555
scripts:
56-
- |-
57-
set -x
58-
set -e
59-
60-
# Fix mixed logs
61-
exec 2>&1
62-
63-
ls -la
64-
65-
echo "Size before cleanup:" && du -h | tail -n 1
66-
rm -rf node_modules
67-
echo "Size after cleanup:" && du -h | tail -n 1
56+
- "./bamboo-specs/scripts/cleanup.sh scriptlets.tgz"
6857
artifacts:
6958
- name: scriptlets.tgz
7059
location: .

bamboo-specs/increment.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ Increment:
4848
configuration:
4949
commitMessage: 'skipci: Automatic increment build number'
5050
selectedRepository: defaultRepository
51+
final-tasks:
52+
- script:
53+
interpreter: SHELL
54+
scripts:
55+
- "./bamboo-specs/scripts/cleanup.sh"
5156
requirements:
5257
- adg-docker: 'true'
5358

bamboo-specs/scripts/cleanup.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
# Cleanup script that preserves specified artifacts
4+
# Usage: ./cleanup.sh "artifact1,artifact2,artifact3"
5+
6+
# 'set' should be added to the beginning of each script to ensure that it runs with the correct options.
7+
# Please do not move it to some common file, like `setup-tests.sh`, because sourcing A script from B script
8+
# cannot change the options of B script.
9+
# -e: Exit immediately if any command exits with a non-zero status (i.e., if a command fails).
10+
# -x: Print each command to the terminal as it is executed, which is useful for debugging.
11+
set -ex
12+
13+
# Fix mixed logs
14+
exec 2>&1
15+
16+
echo "Size before cleanup:" && du -h | tail -n 1
17+
echo "Top 5 files:" && du -h | sort -hr | head -n 5
18+
19+
# Parse artifacts from command line argument
20+
ARTIFACTS_ARG="${1:-}"
21+
if [ -z "$ARTIFACTS_ARG" ]; then
22+
echo "No artifacts specified, cleaning entire workspace"
23+
ARTIFACTS=""
24+
else
25+
# Convert comma-separated string to space-separated
26+
ARTIFACTS=$(echo "$ARTIFACTS_ARG" | tr ',' ' ')
27+
echo "Preserving artifacts: $ARTIFACTS"
28+
fi
29+
30+
TMP="$(mktemp -d)"
31+
trap 'rm -rf "$TMP"' EXIT
32+
33+
# Stash artifacts to /tmp
34+
for f in $ARTIFACTS; do
35+
[ -e "$f" ] || continue
36+
echo "Stashing artifact: $f"
37+
mkdir -p "$TMP/$(dirname "$f")"
38+
mv "$f" "$TMP/$f"
39+
done
40+
41+
# Clean entire workspace (including dotfiles and .git)
42+
find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +
43+
44+
# Restore artifacts
45+
for f in $ARTIFACTS; do
46+
[ -e "$TMP/$f" ] || continue
47+
echo "Restoring artifact: $f"
48+
mkdir -p "$(dirname "$f")"
49+
mv "$TMP/$f" "$f"
50+
done
51+
52+
echo "Size after cleanup:" && du -h | tail -n 1
53+
echo "Top 5 files:" && du -h | sort -hr | head -n 5
54+
55+
echo "Cleanup completed successfully"

bamboo-specs/test.yaml

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ stages:
2222
- Test smoke
2323
# lint should be run after building of docs and lib
2424
- Lint
25-
- Cleanup:
26-
<<: *stage
27-
final: true
28-
jobs:
29-
- Cleanup
3025

3126
Build docs:
3227
key: BUILDDOCS
@@ -64,6 +59,11 @@ Build docs:
6459
# build docs to lint them later
6560
# check compatibility table updates and build it and build wiki docs
6661
pnpm wiki
62+
final-tasks:
63+
- script: &cleanup-script
64+
interpreter: SHELL
65+
scripts:
66+
- "./bamboo-specs/scripts/cleanup.sh"
6767
requirements: &requirements
6868
- adg-docker: 'true'
6969
- extension: 'true'
@@ -89,6 +89,11 @@ Build lib:
8989
location: dist
9090
pattern: redirects.json
9191
required: true
92+
final-tasks:
93+
- script:
94+
interpreter: SHELL
95+
scripts:
96+
- "./bamboo-specs/scripts/cleanup.sh dist/scriptlets.corelibs.json,dist/redirects.json"
9297
requirements: *requirements
9398

9499
Test qunit:
@@ -103,6 +108,8 @@ Test qunit:
103108
scripts:
104109
- |-
105110
pnpm test:qunit
111+
final-tasks:
112+
- script: *cleanup-script
106113
requirements: *requirements
107114

108115
Test vitest:
@@ -116,6 +123,8 @@ Test vitest:
116123
scripts:
117124
- |-
118125
pnpm test:vitest
126+
final-tasks:
127+
- script: *cleanup-script
119128
requirements: *requirements
120129

121130
Test smoke:
@@ -130,6 +139,8 @@ Test smoke:
130139
scripts:
131140
- |-
132141
pnpm test:smoke
142+
final-tasks:
143+
- script: *cleanup-script
133144
requirements: *requirements
134145

135146
Lint:
@@ -143,28 +154,8 @@ Lint:
143154
scripts:
144155
- |-
145156
pnpm lint
146-
requirements: *requirements
147-
148-
Cleanup:
149-
key: CLEAN
150-
docker: *docker
151-
tasks:
152-
- checkout
153-
- script:
154-
interpreter: SHELL
155-
scripts:
156-
- |-
157-
set -x
158-
set -e
159-
160-
# Fix mixed logs
161-
exec 2>&1
162-
163-
ls -la
164-
165-
echo "Size before cleanup:" && du -h | tail -n 1
166-
rm -rf node_modules
167-
echo "Size after cleanup:" && du -h | tail -n 1
157+
final-tasks:
158+
- script: *cleanup-script
168159
requirements: *requirements
169160

170161
branches:

scripts/compatibility-table.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,9 @@
594594
},
595595
{
596596
"ubo": "noop-0.5s.mp3"
597+
},
598+
{
599+
"ubo": "sensors-analytics.js"
597600
}
598601
]
599602
}

wiki/compatibility-table.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,4 @@
182182
| | outbrain-widget.js | |
183183
| | noeval.js | |
184184
| | noop-0.5s.mp3 | |
185+
| | sensors-analytics.js | |

0 commit comments

Comments
 (0)