From c480ef08ef9ca9ca06d737d0225400c2731f6902 Mon Sep 17 00:00:00 2001 From: Rokibul Hasan Date: Thu, 19 Dec 2024 20:14:19 +0600 Subject: [PATCH 1/2] Automate coredns version bumps with updatecli Signed-off-by: Rokibul Hasan --- updatecli/scripts/run-make-generate.sh | 13 ++++ updatecli/updatecli.d/coredns.yaml | 88 ++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100755 updatecli/scripts/run-make-generate.sh create mode 100644 updatecli/updatecli.d/coredns.yaml diff --git a/updatecli/scripts/run-make-generate.sh b/updatecli/scripts/run-make-generate.sh new file mode 100755 index 000000000000..514cb4f1e9ce --- /dev/null +++ b/updatecli/scripts/run-make-generate.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -eux + +mkdir -p build/data + +make download + +make generate + +git diff + +exit 0 diff --git a/updatecli/updatecli.d/coredns.yaml b/updatecli/updatecli.d/coredns.yaml new file mode 100644 index 000000000000..27cc200e5f8d --- /dev/null +++ b/updatecli/updatecli.d/coredns.yaml @@ -0,0 +1,88 @@ +name: "Bump CoreDNS Image Version" +scms: + k3s: + kind: "github" + spec: + user: "{{ .github.user }}" + email: "{{ .github.email }}" + username: "{{ .github.username }}" + token: "{{ requiredEnv .github.token }}" + owner: "{{ .k3s.org }}" + repository: "{{ .k3s.repo }}" + branch: "{{ .k3s.branch }}" + commitmessage: + title: "Bump rancher/mirrored-coredns-coredns image version" + +actions: + github: + title: "Bump rancher/mirrored-coredns-coredns image version" + kind: "github/pullrequest" + scmid: "k3s" + spec: + automerge: false + mergemethod: "squash" + labels: + - "dependencies" + +sources: + # Retrieve the latest tag from the rancher/mirrored-coredns-coredns repository + coredns-docker-image: + name: "Check CoreDNS image tag in DockerHub" + kind: "dockerimage" + spec: + image: "rancher/mirrored-coredns-coredns" + versionfilter: + kind: "semver" + strict: true + transformers: + - find: '\d+\.\d+\.\d+' + + get-pwd: + name: "Run Updatecli execution directory" + kind: "shell" + spec: + command: 'pwd' + environments: + - name: PATH + +conditions: + docker-image: + name: "Check latest image tag for rancher/mirrored-coredns-coredns" + kind: "dockerimage" + disablesourceinput: true + spec: + image: "rancher/mirrored-coredns-coredns" + tag: '{{ source "coredns-docker-image" }}' + +targets: + coredns-manifest: + name: "Update CoreDNS image version in manifests/coredns.yaml" + kind: "file" + scmid: "k3s" + disablesourceinput: true + spec: + files: + - "manifests/coredns.yaml" + matchpattern: 'image: "%{SYSTEM_DEFAULT_REGISTRY}%rancher/mirrored-coredns-coredns:\S+"' + replacepattern: 'image: "%{SYSTEM_DEFAULT_REGISTRY}%rancher/mirrored-coredns-coredns:{{ source "coredns-docker-image" }}"' + + coredns-airgap: + name: "Update CoreDNS image version in scripts/airgap/image-list" + kind: "file" + scmid: "k3s" + disablesourceinput: true + spec: + files: + - "scripts/airgap/image-list.txt" + matchpattern: 'docker.io/rancher/mirrored-coredns-coredns:\S+' + replacepattern: 'docker.io/rancher/mirrored-coredns-coredns:{{ source "coredns-docker-image" }}' + + go-generate: + name: "Run go generate" + kind: "shell" + sourceid: "get-pwd" + spec: + command: '{{ source "get-pwd" }}/updatecli/scripts/run-make-generate.sh' + environments: + - name: PATH + - name: HOME From a28783bba872428bbfbb9e7f694e257a541477c0 Mon Sep 17 00:00:00 2001 From: Rokibul Hasan Date: Fri, 20 Dec 2024 01:25:06 +0600 Subject: [PATCH 2/2] Remove run-make-generate.sh Signed-off-by: Rokibul Hasan --- updatecli/scripts/run-make-generate.sh | 13 ------------- updatecli/updatecli.d/coredns.yaml | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100755 updatecli/scripts/run-make-generate.sh diff --git a/updatecli/scripts/run-make-generate.sh b/updatecli/scripts/run-make-generate.sh deleted file mode 100755 index 514cb4f1e9ce..000000000000 --- a/updatecli/scripts/run-make-generate.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -eux - -mkdir -p build/data - -make download - -make generate - -git diff - -exit 0 diff --git a/updatecli/updatecli.d/coredns.yaml b/updatecli/updatecli.d/coredns.yaml index 27cc200e5f8d..c5ec7da7585f 100644 --- a/updatecli/updatecli.d/coredns.yaml +++ b/updatecli/updatecli.d/coredns.yaml @@ -82,7 +82,7 @@ targets: kind: "shell" sourceid: "get-pwd" spec: - command: '{{ source "get-pwd" }}/updatecli/scripts/run-make-generate.sh' + command: '{{ source "get-pwd" }}/updatecli/scripts/run-go-generate.sh' environments: - name: PATH - name: HOME