@@ -75,12 +75,10 @@ tasks:
7575 fi
7676
7777 dependency:update :
78- desc : ' No-op: no dedicated dependency updater configured for this profile '
78+ desc : Update repository dependencies not covered by Dependabot
7979 cmds :
80- - |
81- echo "INFO: No dedicated dependency updater configured for this repository profile."
82- echo "INFO: Dependabot handles GitHub Actions and package metadata updates."
83- echo "INFO: Keep this task as a safe no-op until a repo-specific dependency updater is defined."
80+ - task : alpine:update
81+ - task : packages:update
8482
8583 version:get :
8684 desc : Get current version
@@ -241,6 +239,81 @@ tasks:
241239 - git config user.name "github-actions[bot]"
242240 - git config user.email "github-actions[bot]@users.noreply.github.com"
243241
242+ alpine:update :
243+ desc : Update Alpine base image references and VERSION_ID test expectations
244+ cmds :
245+ - |
246+ set -eu
247+ if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
248+ echo "INFO: Not in a git repository; nothing to update"
249+ exit 0
250+ fi
251+
252+ mkdir -p .tmp
253+ tracked_files=".tmp/alpine-update-files.txt"
254+ relevant_files=".tmp/alpine-update-relevant.txt"
255+ git ls-files > "$tracked_files"
256+ grep -E '(^|/)(Dockerfile[^/]*|[^/]+\.sh|\.github/workflows/.*\.ya?ml|tests/.*\.ya?ml)$' "$tracked_files" > "$relevant_files" || true
257+
258+ if [ ! -s "$relevant_files" ]; then
259+ echo "INFO: No tracked Alpine-related source files found; nothing to update"
260+ exit 0
261+ fi
262+
263+ latest_feed="$(curl -fsSL https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64/latest-releases.yaml)"
264+ latest_alpine="$(printf '%s\n' "$latest_feed" | awk '/^ version:/ {print $2}' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1)"
265+ if [ -z "$latest_alpine" ]; then
266+ echo "ERROR: Could not resolve latest Alpine release"
267+ exit 1
268+ fi
269+ escaped_alpine="$(printf '%s' "$latest_alpine" | sed 's/\./\\\\./g')"
270+
271+ found_refs=0
272+ while IFS= read -r file; do
273+ [ -n "$file" ] || continue
274+ if grep -Eq 'alpine:[0-9]+\.[0-9]+\.[0-9]+|expectedOutput:[[:space:]]*\[VERSION_ID=[0-9]+(\\?\.[0-9]+){2}\]' "$file"; then
275+ found_refs=1
276+ break
277+ fi
278+ done < "$relevant_files"
279+
280+ if [ "$found_refs" -eq 0 ]; then
281+ echo "INFO: No Alpine version references found in tracked source files; nothing to update"
282+ exit 0
283+ fi
284+
285+ updated=0
286+ while IFS= read -r file; do
287+ [ -n "$file" ] || continue
288+ before_file=".tmp/alpine-update-before"
289+ cp "$file" "$before_file"
290+ perl -0pi -e 's/alpine:\d+\.\d+\.\d+/alpine:'"$latest_alpine"'/g' "$file"
291+ if printf '%s\n' "$file" | grep -Eq '^tests/.*\.ya?ml$'; then
292+ perl -0pi -e 's/expectedOutput:\s*\[VERSION_ID=\d+(?:\\?\.\d+){2}\]/expectedOutput: [VERSION_ID='"$escaped_alpine"']/g' "$file"
293+ fi
294+ if ! cmp -s "$file" "$before_file"; then
295+ echo "UPDATE: Alpine references in $file -> $latest_alpine"
296+ updated=1
297+ fi
298+ done < "$relevant_files"
299+ rm -f .tmp/alpine-update-before
300+
301+ if xargs grep -En 'expectedOutput:[[:space:]]*\[VERSION_ID=[0-9]+\.[0-9]+\.[0-9]+\]' < "$relevant_files" >/dev/null 2>&1; then
302+ echo "ERROR: Found unescaped VERSION_ID expectations after update"
303+ xargs grep -En 'expectedOutput:[[:space:]]*\[VERSION_ID=[0-9]+\.[0-9]+\.[0-9]+\]' < "$relevant_files" || true
304+ exit 1
305+ fi
306+
307+ if xargs grep -En 'alpine:[0-9]+\\\.[0-9]+\\\.[0-9]+' < "$relevant_files" >/dev/null 2>&1; then
308+ echo "ERROR: Found escaped Alpine image tags after update"
309+ xargs grep -En 'alpine:[0-9]+\\\.[0-9]+\\\.[0-9]+' < "$relevant_files" || true
310+ exit 1
311+ fi
312+
313+ if [ "$updated" -eq 0 ]; then
314+ echo "INFO: Alpine references already up to date"
315+ fi
316+
244317 packages:update :
245318 desc : Update Alpine package pins in alpine-packages.txt
246319 cmds :
0 commit comments