@@ -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 :
0 commit comments