From 7494df82f540f996191992d1312597b9f0bf4d28 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 26 Nov 2025 20:31:23 +0000 Subject: [PATCH 1/3] Initial plan From cc053cc72bf27e2a4b3b8a3a526b976e3d1f676f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 26 Nov 2025 20:35:50 +0000 Subject: [PATCH 2/3] Add updatecli configuration for RKE2 release detection Co-authored-by: cwayne18 <1471943+cwayne18@users.noreply.github.com> --- .github/workflows/updatecli.yml | 51 ++++++++++++++++++ updatecli/updatecli.d/rke2-release.yaml | 72 +++++++++++++++++++++++++ updatecli/values.yaml | 5 ++ 3 files changed, 128 insertions(+) create mode 100644 .github/workflows/updatecli.yml create mode 100644 updatecli/updatecli.d/rke2-release.yaml create mode 100644 updatecli/values.yaml diff --git a/.github/workflows/updatecli.yml b/.github/workflows/updatecli.yml new file mode 100644 index 000000000..1e5b726cf --- /dev/null +++ b/.github/workflows/updatecli.yml @@ -0,0 +1,51 @@ +name: "Updatecli: Detect new RKE2 releases" + +on: + schedule: + # Runs at 06 AM UTC every day + - cron: '0 6 * * *' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + updatecli: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: dev-v2.13 + + - name: Install Updatecli + uses: updatecli/updatecli-action@v2 + + - name: Delete leftover UpdateCLI branches + run: | + gh pr list \ + --search "is:closed is:pr head:updatecli_" \ + --json headRefName \ + --jq ".[].headRefName" | sort -u > closed_prs_branches.txt + gh pr list \ + --search "is:open is:pr head:updatecli_" \ + --json headRefName \ + --jq ".[].headRefName" | sort -u > open_prs_branches.txt + for branch in $(comm -23 closed_prs_branches.txt open_prs_branches.txt); do + if (git ls-remote --exit-code --heads origin "$branch"); then + echo "Deleting leftover UpdateCLI branch - $branch"; + git push origin --delete "$branch"; + fi + done + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Apply Updatecli + # Never use '--debug' option, because it might leak the access tokens. + run: "updatecli apply --clean --config ./updatecli/updatecli.d/ --values ./updatecli/values.yaml" + env: + UPDATECLI_GITHUB_ACTOR: ${{ github.actor }} + UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/updatecli/updatecli.d/rke2-release.yaml b/updatecli/updatecli.d/rke2-release.yaml new file mode 100644 index 000000000..1aa85edb1 --- /dev/null +++ b/updatecli/updatecli.d/rke2-release.yaml @@ -0,0 +1,72 @@ +# This updatecli manifest detects new RKE2 releases from github.com/rancher/rke2 +# and opens a PR to update the kontainer-driver-metadata repository. +# +# To test this locally: +# have "UPDATECLI_GITHUB_ACTOR" env set to your github username +# have "UPDATECLI_GITHUB_TOKEN" env set to your github token +# have the latest version of updatecli installed +# 'updatecli diff --values updatecli/values.yaml --config updatecli/updatecli.d/rke2-release.yaml' +--- +name: "Detect new RKE2 release" + +scms: + kontainer-driver-metadata: + kind: "github" + spec: + user: "{{ .github.user }}" + email: "{{ .github.email }}" + username: "{{ requiredEnv .github.username }}" + token: '{{ requiredEnv .github.token }}' + owner: rancher + repository: kontainer-driver-metadata + branch: dev-v2.13 + +sources: + rke2-release: + name: "Get latest RKE2 release" + kind: "githubrelease" + spec: + owner: rancher + repository: rke2 + token: '{{ requiredEnv .github.token }}' + username: '{{ requiredEnv .github.username }}' + typefilter: + release: true + draft: false + prerelease: false + versionfilter: + kind: regex + # pattern matches RKE2 release tags like v1.32.1+rke2r1 + pattern: "v[0-9]+\\.[0-9]+\\.[0-9]+\\+rke2r[0-9]+" + +conditions: + checkIfReleaseExists: + name: "Check if RKE2 release already exists in channels-rke2.yaml" + kind: file + disablesourceinput: true + spec: + file: channels-rke2.yaml + matchpattern: '{{ source "rke2-release" }}' + scmid: kontainer-driver-metadata + failwhen: true + +actions: + github: + kind: "github/pullrequest" + scmid: "kontainer-driver-metadata" + spec: + automerge: false + draft: false + mergemethod: squash + title: 'New RKE2 release detected: {{ source "rke2-release" }}' + description: | + A new RKE2 release has been detected: **{{ source "rke2-release" }}** + + This PR was automatically created by updatecli. + + Please review and add the necessary configuration for this release to `channels-rke2.yaml`. + + Release URL: https://github.com/rancher/rke2/releases/tag/{{ source "rke2-release" }} + labels: + - updatecli + - rke2 diff --git a/updatecli/values.yaml b/updatecli/values.yaml new file mode 100644 index 000000000..cf1304571 --- /dev/null +++ b/updatecli/values.yaml @@ -0,0 +1,5 @@ +github: + user: "github-actions[bot]" + email: "41898282+github-actions[bot]@users.noreply.github.com" + username: "UPDATECLI_GITHUB_ACTOR" + token: "UPDATECLI_GITHUB_TOKEN" From 26ce9f700a73300f2b6cf1bfb9331f2997e2c38c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 26 Nov 2025 20:36:50 +0000 Subject: [PATCH 3/3] Fix regex pattern escaping and improve comment clarity Co-authored-by: cwayne18 <1471943+cwayne18@users.noreply.github.com> --- .github/workflows/updatecli.yml | 2 +- updatecli/updatecli.d/rke2-release.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/updatecli.yml b/.github/workflows/updatecli.yml index 1e5b726cf..4a1720849 100644 --- a/.github/workflows/updatecli.yml +++ b/.github/workflows/updatecli.yml @@ -2,7 +2,7 @@ name: "Updatecli: Detect new RKE2 releases" on: schedule: - # Runs at 06 AM UTC every day + # Runs at 06:00 AM UTC every day - cron: '0 6 * * *' # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/updatecli/updatecli.d/rke2-release.yaml b/updatecli/updatecli.d/rke2-release.yaml index 1aa85edb1..042c922a8 100644 --- a/updatecli/updatecli.d/rke2-release.yaml +++ b/updatecli/updatecli.d/rke2-release.yaml @@ -37,7 +37,7 @@ sources: versionfilter: kind: regex # pattern matches RKE2 release tags like v1.32.1+rke2r1 - pattern: "v[0-9]+\\.[0-9]+\\.[0-9]+\\+rke2r[0-9]+" + pattern: 'v[0-9]+\.[0-9]+\.[0-9]+\+rke2r[0-9]+' conditions: checkIfReleaseExists: