Skip to content

Commit bb8b53f

Browse files
authored
Merge pull request #21717 from medyagh/deb_automation
ci: fix kic base bump automation
2 parents 458e99f + 92ab1c8 commit bb8b53f

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

.github/workflows/update-debian-version.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
- name: Bump Ubuntu version
2222
id: bumpBaseOsImage
2323
run: |
24-
echo "OLD_VERSION=$(DEP=ubuntu make get-dependency-version)" >> "$GITHUB_OUTPUT"
24+
echo "OLD_VERSION=$(DEP=debian make get-dependency-version)" >> "$GITHUB_OUTPUT"
2525
make update-debian-version
26-
echo "NEW_VERSION=$(DEP=ubuntu make get-dependency-version)" >> "$GITHUB_OUTPUT"
26+
echo "NEW_VERSION=$(DEP=debian make get-dependency-version)" >> "$GITHUB_OUTPUT"
2727
# The following is to support multiline with GITHUB_OUTPUT, see https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
2828
echo "changes<<EOF" >> "$GITHUB_OUTPUT"
2929
echo "$(git status --porcelain)" >> "$GITHUB_OUTPUT"

hack/update/debian_version/debian_version.go

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package main
1818

1919
import (
2020
"fmt"
21+
"regexp"
2122
"strings"
2223

2324
"k8s.io/klog/v2"
@@ -40,13 +41,35 @@ type Data struct {
4041
LatestVersion string
4142
}
4243

44+
// bookwormDateTag matches Debian bookworm slim tags that include an 8-digit
45+
// date stamp (for example, bookworm-20250929-slim).
46+
var bookwormDateTag = regexp.MustCompile(`^bookworm-\d{8}-slim$`)
47+
48+
// latestBookwormSlimTag returns the newest bookworm slim tag that includes a
49+
// date suffix. The updater now requires a dated tag to be present so that the
50+
// resulting image digest remains stable and predictable between runs.
4351
func latestBookwormSlimTag(tags []string) (string, error) {
52+
var newestDateTag string
4453
for _, tag := range tags {
45-
if strings.Contains(tag, "bookworm-slim") {
46-
return tag, nil
54+
// Skip anything that isn't a bookworm slim tag to avoid matching other
55+
// Debian variants.
56+
if !strings.HasPrefix(tag, "bookworm-") || !strings.HasSuffix(tag, "-slim") {
57+
continue
58+
}
59+
60+
// Track the lexicographically greatest dated tag, which corresponds to
61+
// the most recent date stamp provided by Debian.
62+
if bookwormDateTag.MatchString(tag) {
63+
if newestDateTag == "" || tag > newestDateTag {
64+
newestDateTag = tag
65+
}
4766
}
4867
}
49-
return "", fmt.Errorf("no tag found that matches: bookworm-slim")
68+
69+
if newestDateTag != "" {
70+
return newestDateTag, nil
71+
}
72+
return "", fmt.Errorf("no dated tag found that matches: %s", bookwormDateTag.String())
5073
}
5174

5275
func main() {

hack/update/get_version/get_version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ var dependencies = map[string]dependency{
7575
"nvidia-device-plugin": {addonsFile, `nvidia/k8s-device-plugin:(.*)@`},
7676
"registry": {addonsFile, `registry:(.*)@`},
7777
"runc": {"deploy/iso/minikube-iso/package/runc-master/runc-master.mk", `RUNC_MASTER_VERSION = (.*)`},
78-
"ubuntu": {dockerfile, `ubuntu:jammy-(.*)"`},
78+
"debian": {dockerfile, `debian:bookworm-(.*)-slim`},
7979
"volcano": {addonsFile, `volcanosh/vc-webhook-manager:(.*)@`},
8080
"yakd": {addonsFile, `marcnuri/yakd:(.*)@`},
8181
}

0 commit comments

Comments
 (0)