diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9e7520e3..bf741772 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,7 +7,7 @@ version: 2 updates: # github actions - package-ecosystem: "github-actions" - target-branch: "release-v1.12.0" + target-branch: "release-v1.13.0" directory: "/" schedule: # Check for updates to GitHub Actions every week @@ -20,7 +20,7 @@ updates: # csi-powerstore packages - package-ecosystem: docker - target-branch: "release-v1.12.0" + target-branch: "release-v1.13.0" directories: - /charts/csi-powerstore labels: @@ -37,7 +37,7 @@ updates: # csi-isilon packages - package-ecosystem: docker - target-branch: "release-v1.12.0" + target-branch: "release-v1.13.0" directories: - /charts/csi-isilon labels: @@ -54,7 +54,7 @@ updates: # csi-vxflexos packages - package-ecosystem: docker - target-branch: "release-v1.12.0" + target-branch: "release-v1.13.0" directories: - /charts/csi-vxflexos labels: @@ -71,7 +71,7 @@ updates: # csi-unity packages - package-ecosystem: docker - target-branch: "release-v1.12.0" + target-branch: "release-v1.13.0" directories: - /charts/csi-unity labels: @@ -88,7 +88,7 @@ updates: # csi-powermax packages - package-ecosystem: docker - target-branch: "release-v1.12.0" + target-branch: "release-v1.13.0" directories: - /charts/csi-powermax labels: @@ -105,7 +105,7 @@ updates: # csm-authorization packages - package-ecosystem: docker - target-branch: "release-v1.12.0" + target-branch: "release-v1.13.0" directories: - /charts/csm-authorization - /charts/csm-authorization-v2.0 @@ -123,7 +123,7 @@ updates: # karavi-observability packages - package-ecosystem: docker - target-branch: "release-v1.12.0" + target-branch: "release-v1.13.0" directories: - /charts/karavi-observability labels: @@ -143,7 +143,7 @@ updates: # csm-replication packages - package-ecosystem: docker - target-branch: "release-v1.12.0" + target-branch: "release-v1.13.0" directories: - /charts/csm-replication labels: @@ -160,7 +160,7 @@ updates: # csm-installer packages - package-ecosystem: docker - target-branch: "release-v1.12.0" + target-branch: "release-v1.13.0" directories: - /charts/csm-installer labels: @@ -177,7 +177,7 @@ updates: # installation-wizard packages - package-ecosystem: docker - target-branch: "release-v1.12.0" + target-branch: "release-v1.13.0" directories: - /installation-wizard/container-storage-modules labels: diff --git a/.github/workflows/post-release-action.yml b/.github/workflows/post-release-action.yml new file mode 100644 index 00000000..79038d2d --- /dev/null +++ b/.github/workflows/post-release-action.yml @@ -0,0 +1,50 @@ +# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# This Github action updates the target-branch references for dependabot and other actions +name: Post Release Action + +on: + workflow_dispatch: + inputs: + branch_name: + description: 'Name of the new release branch, i.e. release-v1.0.0' + required: true + +jobs: + update-references: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Update branch references + run: | + BRANCH_NAME=${{ github.event.inputs.branch_name }} + grep -rl 'target-branch:' . | xargs sed -i "s/target-branch: \".*\"/target-branch: \"${BRANCH_NAME}\"/g" + + # Needed for signing commits using Github App tokens + # See: https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#commit-signing + - uses: actions/create-github-app-token@v1.11.0 + id: generate-token + with: + app-id: ${{ vars.CSM_RELEASE_APP_ID }} + private-key: ${{ secrets.CSM_RELEASE_APP_PRIVATE_KEY }} + + - name: Create PR for Release Updates + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ steps.generate-token.outputs.token }} + branch: 'update-target-branch' + title: 'Update target-branch references for dependabot' + body: | + This PR updates target-branch references to the new release branch. + Auto-generated by [dell/helm-charts](https://github.com/dell/helm-charts) + sign-commits: true + commit-message: "Update target-branch references to new release branch" diff --git a/.github/workflows/rebase-release.yml b/.github/workflows/rebase-release.yml new file mode 100644 index 00000000..b37dcd2a --- /dev/null +++ b/.github/workflows/rebase-release.yml @@ -0,0 +1,118 @@ +# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + +# This Github action keeps the CSM release branch up to date with main branch +name: Sync Release Branch with Main + +on: + push: + branches: + - main + +jobs: + rebase-branch: + runs-on: ubuntu-latest + env: + target-branch: "release-v1.13.0" + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: main + + - name: Fetch all branches + run: git fetch --all + + - name: Rebase release branch with main + id: rebase + run: | + git checkout ${{ env.target-branch }} + git rebase main + + - name: Push rebase changes to new branch + if: ${{ success() && steps.rebase.outcome == 'success' }} + run: | + git checkout -b rebase-feature-branch + git push origin rebase-feature-branch + + # Needed for signing commits using Github App tokens + # See: https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#commit-signing + - uses: actions/create-github-app-token@v1.11.0 + id: generate-token + if: ${{ success() && steps.rebase.outcome == 'success' }} + with: + app-id: ${{ vars.CSM_RELEASE_APP_ID }} + private-key: ${{ secrets.CSM_RELEASE_APP_PRIVATE_KEY }} + + - name: Create pull request + if: ${{ success() && steps.rebase.outcome == 'success' }} + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ steps.generate-token.outputs.token }} + branch: rebase-feature-branch + base: ${{ env.target-branch }} + title: 'Rebase release branch with main' + body: | + This PR rebases the release branch with the main branch. + Auto-generated by [dell/helm-charts](https://github.com/dell/helm-charts) + sign-commits: true + commit-message: "Rebase release branch with main" + + - name: Get PR author + if: ${{ failure() && steps.rebase.outcome == 'failure' }} + id: get_pr_author + uses: actions/github-script@v7 + with: + script: | + const { data: pulls } = await github.rest.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'closed', + base: 'main', + sort: 'updated', + direction: 'desc', + per_page: 1 + }); + const lastMergedPR = pulls.find(pr => pr.merged_at !== null); + if (!lastMergedPR) { + throw new Error('No merged pull request found.'); + } + + const author = lastMergedPR.user.login; + if (!author) { + throw new Error('No author found.'); + } + + core.setOutput('author', author); + console.log(`Author: ${author}`); + + - name: Set PR author output + if: ${{ failure() && steps.rebase.outcome == 'failure' }} + run: | + echo "PR_AUTHOR=${{ steps.get_pr_author.outputs.author }}" >> $GITHUB_ENV + + - name: Create issue for rebase conflict + if: ${{ failure() && steps.rebase.outcome == 'failure' }} + uses: actions/github-script@v7 + with: + script: | + const PR_AUTHOR = process.env.PR_AUTHOR; + if (!PR_AUTHOR) { + throw new Error('PR_AUTHOR environment variable is not set.'); + } + + const issueTitle = `Rebase conflict on ${{ env.target-branch }} branch`; + const issueBody = `There was a conflict rebasing the ${{ env.target-branch }} branch onto main. Please resolve the conflicts manually. See [Sync Release Branch with Main action](https://github.com/shaynafinocchiaro/helm-charts-test/actions/workflows/rebase-release.yml) for more details.`; + await github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: issueTitle, + body: issueBody, + assignees: [PR_AUTHOR], + });