Skip to content

Commit 6808a7c

Browse files
ci: add alpine-first dependency update flow (#59)
Replace the previous no-op dependency updater with an Alpine-first flow that can refresh tracked Alpine references and test expectations before downstream dependency updates. Move Dependabot scheduling to Wednesday 05:00 UTC and keep repo automation aligned with the org workflow timing. Co-authored-by: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com>
1 parent 07114bf commit 6808a7c

3 files changed

Lines changed: 90 additions & 17 deletions

File tree

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ updates:
44
directory: /
55
schedule:
66
interval: weekly
7-
day: monday
7+
day: wednesday
88
time: "05:00"
99
timezone: "UTC"
1010
assignees:

.github/workflows/e2e-action-container-structure-test.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
uses: actions/checkout@v7
6565

6666
- name: Pull Alpine test image
67-
run: docker pull alpine:3.23.4
67+
run: docker pull alpine:3.24.1
6868

6969
- name: Prepare shared temp directory
7070
run: mkdir -p .tmp
@@ -84,7 +84,7 @@ jobs:
8484
id: cst
8585
uses: devops-infra/action-container-structure-test@v1
8686
with:
87-
image: alpine:3.23.4
87+
image: alpine:3.24.1
8888
config: .tmp/cst-alpine.yml
8989
output: text
9090

@@ -117,7 +117,7 @@ jobs:
117117
uses: actions/checkout@v7
118118

119119
- name: Pull Alpine test image
120-
run: docker pull alpine:3.23.4
120+
run: docker pull alpine:3.24.1
121121

122122
- name: Prepare shared temp directory
123123
run: mkdir -p .tmp
@@ -137,7 +137,7 @@ jobs:
137137
id: cst
138138
uses: devops-infra/action-container-structure-test@v1
139139
with:
140-
image: alpine:3.23.4
140+
image: alpine:3.24.1
141141
config: .tmp/cst-alpine.yml
142142
output: json
143143

@@ -168,7 +168,7 @@ jobs:
168168
uses: actions/checkout@v7
169169

170170
- name: Pull Alpine test image
171-
run: docker pull alpine:3.23.4
171+
run: docker pull alpine:3.24.1
172172

173173
- name: Prepare shared temp directory
174174
run: mkdir -p .tmp
@@ -188,7 +188,7 @@ jobs:
188188
id: cst
189189
uses: devops-infra/action-container-structure-test@v1
190190
with:
191-
image: alpine:3.23.4
191+
image: alpine:3.24.1
192192
config: .tmp/cst-alpine.yml
193193
output: junit
194194
junit_suite_name: e2e-alpine-tests
@@ -220,7 +220,7 @@ jobs:
220220
uses: actions/checkout@v7
221221

222222
- name: Pull Alpine test image
223-
run: docker pull alpine:3.23.4
223+
run: docker pull alpine:3.24.1
224224

225225
- name: Prepare shared temp directory
226226
run: mkdir -p .tmp
@@ -240,7 +240,7 @@ jobs:
240240
id: cst
241241
uses: devops-infra/action-container-structure-test@v1
242242
with:
243-
image: alpine:3.23.4
243+
image: alpine:3.24.1
244244
config: .tmp/cst-alpine.yml
245245
output: json
246246
test_report: .tmp/cst-report.json
@@ -276,7 +276,7 @@ jobs:
276276
uses: actions/checkout@v7
277277

278278
- name: Pull Alpine test image
279-
run: docker pull alpine:3.23.4
279+
run: docker pull alpine:3.24.1
280280

281281
- name: Prepare shared temp directory
282282
run: mkdir -p .tmp
@@ -304,7 +304,7 @@ jobs:
304304
id: cst
305305
uses: devops-infra/action-container-structure-test@v1
306306
with:
307-
image: alpine:3.23.4
307+
image: alpine:3.24.1
308308
config: |
309309
.tmp/cst-alpine.yml
310310
.tmp/cst-alpine-secondary.yml
@@ -339,7 +339,7 @@ jobs:
339339
uses: actions/checkout@v7
340340

341341
- name: Pull Alpine test image
342-
run: docker pull alpine:3.23.4
342+
run: docker pull alpine:3.24.1
343343

344344
- name: Prepare shared temp directory
345345
run: mkdir -p .tmp
@@ -359,7 +359,7 @@ jobs:
359359
id: cst
360360
uses: devops-infra/action-container-structure-test@v1
361361
with:
362-
image: alpine:3.23.4
362+
image: alpine:3.24.1
363363
config: .tmp/cst-alpine.yml
364364
driver: docker
365365
platform: linux/amd64

Taskfile.scripts.yml

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,85 @@ tasks:
217217
--strict
218218
219219
dependency:update:
220-
desc: 'No-op: no dedicated dependency updater configured for this profile'
220+
desc: Update repository dependencies not covered by Dependabot
221+
cmds:
222+
- task: alpine:update
223+
224+
225+
alpine:update:
226+
desc: Update Alpine base image references and VERSION_ID test expectations
221227
cmds:
222228
- |
223-
echo "INFO: No dedicated dependency updater configured for this repository profile."
224-
echo "INFO: Dependabot handles GitHub Actions and package metadata updates."
225-
echo "INFO: Keep this task as a safe no-op until a repo-specific dependency updater is defined."
229+
set -eu
230+
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
231+
echo "INFO: Not in a git repository; nothing to update"
232+
exit 0
233+
fi
234+
235+
mkdir -p .tmp
236+
tracked_files=".tmp/alpine-update-files.txt"
237+
relevant_files=".tmp/alpine-update-relevant.txt"
238+
git ls-files > "$tracked_files"
239+
grep -E '(^|/)(Dockerfile[^/]*|[^/]+\.sh|\.github/workflows/.*\.ya?ml|tests/.*\.ya?ml)$' "$tracked_files" > "$relevant_files" || true
240+
241+
if [ ! -s "$relevant_files" ]; then
242+
echo "INFO: No tracked Alpine-related source files found; nothing to update"
243+
exit 0
244+
fi
245+
246+
latest_feed="$(curl -fsSL https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64/latest-releases.yaml)"
247+
latest_alpine="$(printf '%s\n' "$latest_feed" | awk '/^ version:/ {print $2}' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1)"
248+
if [ -z "$latest_alpine" ]; then
249+
echo "ERROR: Could not resolve latest Alpine release"
250+
exit 1
251+
fi
252+
escaped_alpine="$(printf '%s' "$latest_alpine" | sed 's/\./\\\\./g')"
253+
254+
found_refs=0
255+
while IFS= read -r file; do
256+
[ -n "$file" ] || continue
257+
if grep -Eq 'alpine:[0-9]+\.[0-9]+\.[0-9]+|expectedOutput:[[:space:]]*\[VERSION_ID=[0-9]+(\\?\.[0-9]+){2}\]' "$file"; then
258+
found_refs=1
259+
break
260+
fi
261+
done < "$relevant_files"
262+
263+
if [ "$found_refs" -eq 0 ]; then
264+
echo "INFO: No Alpine version references found in tracked source files; nothing to update"
265+
exit 0
266+
fi
267+
268+
updated=0
269+
while IFS= read -r file; do
270+
[ -n "$file" ] || continue
271+
before_file=".tmp/alpine-update-before"
272+
cp "$file" "$before_file"
273+
perl -0pi -e 's/alpine:\d+\.\d+\.\d+/alpine:'"$latest_alpine"'/g' "$file"
274+
if printf '%s\n' "$file" | grep -Eq '^tests/.*\.ya?ml$'; then
275+
perl -0pi -e 's/expectedOutput:\s*\[VERSION_ID=\d+(?:\\?\.\d+){2}\]/expectedOutput: [VERSION_ID='"$escaped_alpine"']/g' "$file"
276+
fi
277+
if ! cmp -s "$file" "$before_file"; then
278+
echo "UPDATE: Alpine references in $file -> $latest_alpine"
279+
updated=1
280+
fi
281+
done < "$relevant_files"
282+
rm -f .tmp/alpine-update-before
283+
284+
if xargs grep -En 'expectedOutput:[[:space:]]*\[VERSION_ID=[0-9]+\.[0-9]+\.[0-9]+\]' < "$relevant_files" >/dev/null 2>&1; then
285+
echo "ERROR: Found unescaped VERSION_ID expectations after update"
286+
xargs grep -En 'expectedOutput:[[:space:]]*\[VERSION_ID=[0-9]+\.[0-9]+\.[0-9]+\]' < "$relevant_files" || true
287+
exit 1
288+
fi
289+
290+
if xargs grep -En 'alpine:[0-9]+\\\.[0-9]+\\\.[0-9]+' < "$relevant_files" >/dev/null 2>&1; then
291+
echo "ERROR: Found escaped Alpine image tags after update"
292+
xargs grep -En 'alpine:[0-9]+\\\.[0-9]+\\\.[0-9]+' < "$relevant_files" || true
293+
exit 1
294+
fi
295+
296+
if [ "$updated" -eq 0 ]; then
297+
echo "INFO: Alpine references already up to date"
298+
fi
226299
227300
git:get-pr-template:
228301
desc: Get pull request template

0 commit comments

Comments
 (0)