Skip to content

Commit 65725ad

Browse files
build: update alpine-first dependency automation and package pins (#204)
Switch dependency updates to an Alpine-first flow, refresh package pins for the current Alpine 3.24.1 base, and keep automation schedules on Monday 05:00 UTC for cron updates and Wednesday 05:00 UTC for Dependabot. Co-authored-by: ChristophShyper <45788587+ChristophShyper@users.noreply.github.com>
1 parent 25db9fc commit 65725ad

3 files changed

Lines changed: 85 additions & 11 deletions

File tree

.github/dependabot.yml

Lines changed: 3 additions & 3 deletions
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:
@@ -20,7 +20,7 @@ updates:
2020
directory: "/"
2121
schedule:
2222
interval: weekly
23-
day: monday
23+
day: wednesday
2424
time: "05:00"
2525
timezone: "UTC"
2626
assignees:
@@ -36,7 +36,7 @@ updates:
3636
directory: "/"
3737
schedule:
3838
interval: weekly
39-
day: monday
39+
day: wednesday
4040
time: "05:00"
4141
timezone: "UTC"
4242
assignees:

Taskfile.scripts.yml

Lines changed: 79 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,11 @@ tasks:
8888
fi
8989
9090
dependency:update:
91-
desc: 'No-op: no dedicated dependency updater configured for this profile'
91+
desc: Update repository dependencies not covered by Dependabot
9292
cmds:
93-
- |
94-
echo "INFO: No dedicated dependency updater configured for this repository profile."
95-
echo "INFO: Dependabot handles GitHub Actions and package metadata updates."
96-
echo "INFO: Keep this task as a safe no-op until a repo-specific dependency updater is defined."
93+
- task: alpine:update
94+
- task: packages:update
95+
9796

9897
git:get-pr-template:
9998
desc: Get pull request template
@@ -107,6 +106,81 @@ tasks:
107106
- git config user.name "github-actions[bot]"
108107
- git config user.email "github-actions[bot]@users.noreply.github.com"
109108

109+
alpine:update:
110+
desc: Update Alpine base image references and VERSION_ID test expectations
111+
cmds:
112+
- |
113+
set -eu
114+
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
115+
echo "INFO: Not in a git repository; nothing to update"
116+
exit 0
117+
fi
118+
119+
mkdir -p .tmp
120+
tracked_files=".tmp/alpine-update-files.txt"
121+
relevant_files=".tmp/alpine-update-relevant.txt"
122+
git ls-files > "$tracked_files"
123+
grep -E '(^|/)(Dockerfile[^/]*|[^/]+\.sh|\.github/workflows/.*\.ya?ml|tests/.*\.ya?ml)$' "$tracked_files" > "$relevant_files" || true
124+
125+
if [ ! -s "$relevant_files" ]; then
126+
echo "INFO: No tracked Alpine-related source files found; nothing to update"
127+
exit 0
128+
fi
129+
130+
latest_feed="$(curl -fsSL https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64/latest-releases.yaml)"
131+
latest_alpine="$(printf '%s\n' "$latest_feed" | awk '/^ version:/ {print $2}' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1)"
132+
if [ -z "$latest_alpine" ]; then
133+
echo "ERROR: Could not resolve latest Alpine release"
134+
exit 1
135+
fi
136+
escaped_alpine="$(printf '%s' "$latest_alpine" | sed 's/\./\\\\./g')"
137+
138+
found_refs=0
139+
while IFS= read -r file; do
140+
[ -n "$file" ] || continue
141+
if grep -Eq 'alpine:[0-9]+\.[0-9]+\.[0-9]+|expectedOutput:[[:space:]]*\[VERSION_ID=[0-9]+(\\?\.[0-9]+){2}\]' "$file"; then
142+
found_refs=1
143+
break
144+
fi
145+
done < "$relevant_files"
146+
147+
if [ "$found_refs" -eq 0 ]; then
148+
echo "INFO: No Alpine version references found in tracked source files; nothing to update"
149+
exit 0
150+
fi
151+
152+
updated=0
153+
while IFS= read -r file; do
154+
[ -n "$file" ] || continue
155+
before_file=".tmp/alpine-update-before"
156+
cp "$file" "$before_file"
157+
perl -0pi -e 's/alpine:\d+\.\d+\.\d+/alpine:'"$latest_alpine"'/g' "$file"
158+
if printf '%s\n' "$file" | grep -Eq '^tests/.*\.ya?ml$'; then
159+
perl -0pi -e 's/expectedOutput:\s*\[VERSION_ID=\d+(?:\\?\.\d+){2}\]/expectedOutput: [VERSION_ID='"$escaped_alpine"']/g' "$file"
160+
fi
161+
if ! cmp -s "$file" "$before_file"; then
162+
echo "UPDATE: Alpine references in $file -> $latest_alpine"
163+
updated=1
164+
fi
165+
done < "$relevant_files"
166+
rm -f .tmp/alpine-update-before
167+
168+
if xargs grep -En 'expectedOutput:[[:space:]]*\[VERSION_ID=[0-9]+\.[0-9]+\.[0-9]+\]' < "$relevant_files" >/dev/null 2>&1; then
169+
echo "ERROR: Found unescaped VERSION_ID expectations after update"
170+
xargs grep -En 'expectedOutput:[[:space:]]*\[VERSION_ID=[0-9]+\.[0-9]+\.[0-9]+\]' < "$relevant_files" || true
171+
exit 1
172+
fi
173+
174+
if xargs grep -En 'alpine:[0-9]+\\\.[0-9]+\\\.[0-9]+' < "$relevant_files" >/dev/null 2>&1; then
175+
echo "ERROR: Found escaped Alpine image tags after update"
176+
xargs grep -En 'alpine:[0-9]+\\\.[0-9]+\\\.[0-9]+' < "$relevant_files" || true
177+
exit 1
178+
fi
179+
180+
if [ "$updated" -eq 0 ]; then
181+
echo "INFO: Alpine references already up to date"
182+
fi
183+
110184
packages:update:
111185
desc: Update Alpine package pins in alpine-packages.txt
112186
cmds:

alpine-packages.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
bash~=5.3
2-
curl
3-
python3
4-
py3-pip
2+
curl~=8.21
3+
python3~=3.14
4+
py3-pip~=26.1

0 commit comments

Comments
 (0)