diff --git a/.github/workflows/release-charts.yaml b/.github/workflows/release-charts.yaml index 42878efc6..5df51a77f 100644 --- a/.github/workflows/release-charts.yaml +++ b/.github/workflows/release-charts.yaml @@ -3,15 +3,15 @@ on: workflow_dispatch: inputs: charts_ref: - description: "Submit PR against the following rancher/charts branch (eg: dev-v2.10)" + description: "Submit PR against the following rancher/charts branch (eg: dev-v2.11)" required: true default: "dev-v2.11" prev_webhook: - description: "Previous Webhook version (eg: v0.5.0-rc.13)" + description: "Previous Webhook version (eg: v0.7.0-rc.13)" required: true default: "" new_webhook: - description: "New Webhook version (eg: v0.5.0-rc.14)" + description: "New Webhook version (eg: v0.7.0-rc.14)" required: true default: "" diff --git a/.github/workflows/release-rancher.yaml b/.github/workflows/release-rancher.yaml index b64679d8c..d4b01d91e 100644 --- a/.github/workflows/release-rancher.yaml +++ b/.github/workflows/release-rancher.yaml @@ -3,15 +3,15 @@ on: workflow_dispatch: inputs: rancher_ref: - description: "Submit PR against the following rancher/rancher branch (eg: main)" + description: "Submit PR against the following rancher/rancher branch (eg: release/v2.11)" required: true - default: "main" + default: "release/v2.11" prev_webhook: - description: "Previous Webhook version (eg: v0.5.0-rc.13)" + description: "Previous Webhook version (eg: v0.7.0-rc.13)" required: true default: "" new_webhook: - description: "New Webhook version (eg: v0.5.0-rc.14)" + description: "New Webhook version (eg: v0.7.0-rc.14)" required: true default: "" @@ -29,6 +29,9 @@ jobs: # Required for vault id-token: write steps: + - name: Install dependencies + run: sudo snap install yq --channel=v4/stable + - uses: actions/checkout@v4 with: ref: "${{ env.WEBHOOK_REF }}" @@ -59,6 +62,36 @@ jobs: # Allow making git push request later on persist-credentials: true + - name: Find charts branch + id: find_charts_branch + run: | + cd rancher + # Extract dev-v2.9 out of the following line: + # ChartDefaultBranch = NewSetting("chart-default-branch", "dev-v2.9") + charts_branch=$(grep '"chart-default-branch"' pkg/settings/setting.go | cut -d'"' -f4) + echo "charts_branch=$charts_branch" >> $GITHUB_OUTPUT + + - uses: actions/checkout@v4 + with: + repository: ${{ github.repository_owner }}/charts + ref: "${{ steps.find_charts_branch.outputs.charts_branch }}" + path: charts + + # Prevents the Rancher CI to continuously fail while the webhook RC is not + # yet added to charts' index.yaml file due to caching. + - name: Verify RC exists + env: + CHARTS_BRANCH: "${{ steps.find_charts_branch.outputs.charts_branch }}" + run: | + cd charts + new_webhook_short=$(echo "$NEW_WEBHOOK" | sed 's|^v||') # e.g. 0.5.2-rc.3 + # Empty output if the version is not found, otherwise the version will be outputed. + found=$(yq ".entries.rancher-webhook[].version | select(. == \"*$new_webhook_short\")" index.yaml) + if [ -z "$found" ]; then + echo "rancher-webhook RC version $NEW_WEBHOOK not found in charts (branch=$CHARTS_BRANCH). Aborting." + exit 1 + fi + - name: Configure the committer run: | cd rancher @@ -69,9 +102,6 @@ jobs: GH_TOKEN: ${{ steps.app-token.outputs.token }} APP_USER: "${{ steps.app-token.outputs.app-slug }}[bot]" - - name: Install dependencies - run: sudo snap install yq --channel=v4/stable - - name: Run release script run: | cd rancher