From c92cd3b50cbb59f0d2991865920d3c93a21c537d Mon Sep 17 00:00:00 2001 From: Jack Green Date: Wed, 13 Nov 2024 15:16:55 +0000 Subject: [PATCH 1/5] Externalise backport action The back porting logic is integrated into each action, duplicated [many times across the codebase](https://github.com/search?q=org%3Ahazelcast+%22Checkout+maintenance+branch+and+cherry-pick%22&type=code). In https://github.com/hazelcast/hz-docs/pull/1373 this was centralised. - updated actions to use it - simplified actions - updated the list of supported maintenance branches - *note* this was very outdated --- .github/workflows/backport-v511.yml | 40 -------------------- .github/workflows/backport.yml | 58 ++++++++++++++--------------- 2 files changed, 27 insertions(+), 71 deletions(-) delete mode 100644 .github/workflows/backport-v511.yml diff --git a/.github/workflows/backport-v511.yml b/.github/workflows/backport-v511.yml deleted file mode 100644 index 32f1c720..00000000 --- a/.github/workflows/backport-v511.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Backport changes to 5.11 branch -on: - push: - branches: - - main -jobs: - backport: - strategy: - matrix: - branch: ['v/5.11'] - runs-on: ubuntu-latest - steps: - - - name: checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up git config - run: | - git config user.name "GitHub Actions Bot" - git config user.email "<>" - - - name: Check PR for backport label - id: check_pr_labels - uses: shioyang/check-pr-labels-on-push-action@v1.0.12 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - labels: '["backport to 5.11"]' - - - name: See result - run: echo "${{ steps.check_pr_labels.outputs.result }}" - - - name: Checkout maintenance branch and cherry-pick - if: ${{ steps.check_pr_labels.outputs.result == 'true' }} - run: | - git fetch - git checkout ${{ matrix.branch }} - git cherry-pick -x --strategy=recursive -X theirs $GITHUB_SHA - git push diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index e14b020c..407fd125 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -1,40 +1,36 @@ -name: Backport changes to maintenance branches +name: Backport changes to all maintenance branches on: push: branches: - main jobs: - backport: - strategy: - matrix: - branch: ['v/5.8', 'v/5.9', 'v/5.10'] + get-maintenance-branches: runs-on: ubuntu-latest + outputs: + branches: "['5.8', '5.9', '5.10', '5.11', '5.12', '5.13', '5.14']" steps: - - - name: checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - run: exit 0 - - name: Set up git config - run: | - git config user.name "GitHub Actions Bot" - git config user.email "<>" - - - name: Check PR for backport label - id: check_pr_labels - uses: shioyang/check-pr-labels-on-push-action@v1.0.12 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - labels: '["backport"]' - - - name: See result - run: echo "${{ steps.check_pr_labels.outputs.result }}" + backport-to-all-branch: + needs: get-maintenance-branches + strategy: + fail-fast: true + matrix: + branch: ${{ fromJSON(needs.get-maintenance-branches.outputs.branches) }} + uses: hazelcast/hz-docs/.github/workflows/backport-workflow.yml@main + with: + label: '["backport to all versions"]' + target-branch: v/${{ matrix.branch }} + secrets: inherit - - name: Checkout maintenance branch and cherry-pick - if: ${{ steps.check_pr_labels.outputs.result == 'true' }} - run: | - git fetch - git checkout ${{ matrix.branch }} - git cherry-pick -x --strategy=recursive -X theirs $GITHUB_SHA - git push + backport-to-specified-branch: + needs: get-maintenance-branches + strategy: + fail-fast: true + matrix: + branch: ${{ fromJSON(needs.get-maintenance-branches.outputs.branches) }} + uses: hazelcast/hz-docs/.github/workflows/backport-workflow.yml@main + with: + label: '["backport to ${{ matrix.branch }}"]' + target-branch: v/${{ matrix.branch }} + secrets: inherit \ No newline at end of file From 7f1ba34d055354949959a5fbfc9a9dfaa9017126 Mon Sep 17 00:00:00 2001 From: Jack Green Date: Wed, 13 Nov 2024 15:18:26 +0000 Subject: [PATCH 2/5] Update backport.yml --- .github/workflows/backport.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 407fd125..6a031dcf 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -1,4 +1,4 @@ -name: Backport changes to all maintenance branches +name: Backport changes to maintenance branches on: push: branches: @@ -33,4 +33,4 @@ jobs: with: label: '["backport to ${{ matrix.branch }}"]' target-branch: v/${{ matrix.branch }} - secrets: inherit \ No newline at end of file + secrets: inherit From 3d2ee241a13736109f8a202adbd83c1c90a4f673 Mon Sep 17 00:00:00 2001 From: Jack Green Date: Thu, 14 Nov 2024 07:28:29 +0000 Subject: [PATCH 3/5] Merge changes from https://github.com/hazelcast/hazelcast-platform-operator-docs/pull/265 --- .github/workflows/backport-starting-v511.yml | 38 ++++---------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/.github/workflows/backport-starting-v511.yml b/.github/workflows/backport-starting-v511.yml index bac975d0..e413f3e8 100644 --- a/.github/workflows/backport-starting-v511.yml +++ b/.github/workflows/backport-starting-v511.yml @@ -4,37 +4,13 @@ on: branches: - main jobs: - backport: + backport-to-specified-branch: strategy: + fail-fast: true matrix: branch: ['v/5.11','v/5.12','v/5.13','v/5.14'] - runs-on: ubuntu-latest - steps: - - - name: checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up git config - run: | - git config user.name "GitHub Actions Bot" - git config user.email "<>" - - - name: Check PR for backport label - id: check_pr_labels - uses: shioyang/check-pr-labels-on-push-action@v1.0.12 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - labels: '["backport starting from 5.11"]' - - - name: See result - run: echo "${{ steps.check_pr_labels.outputs.result }}" - - - name: Checkout maintenance branch and cherry-pick - if: ${{ steps.check_pr_labels.outputs.result == 'true' }} - run: | - git fetch - git checkout ${{ matrix.branch }} - git cherry-pick -x --strategy=recursive -X theirs $GITHUB_SHA - git push + uses: hazelcast/hz-docs/.github/workflows/backport-workflow.yml@main + with: + label: '["backport starting from 5.11"]' + target-branch: v/${{ matrix.branch }} + secrets: inherit From c401260c4bca1be28abfc8b4d1567fe6493bb9b7 Mon Sep 17 00:00:00 2001 From: Jack Green Date: Thu, 14 Nov 2024 07:29:30 +0000 Subject: [PATCH 4/5] Update backport-starting-v511.yml --- .github/workflows/backport-starting-v511.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/backport-starting-v511.yml b/.github/workflows/backport-starting-v511.yml index e413f3e8..8b6fd03a 100644 --- a/.github/workflows/backport-starting-v511.yml +++ b/.github/workflows/backport-starting-v511.yml @@ -4,7 +4,7 @@ on: branches: - main jobs: - backport-to-specified-branch: + backport: strategy: fail-fast: true matrix: From 59a33d3346938f04b7d28c05555aa7f1fa32e9bf Mon Sep 17 00:00:00 2001 From: Jack Green Date: Thu, 14 Nov 2024 07:33:19 +0000 Subject: [PATCH 5/5] Fix param names and matrix failing --- .github/workflows/backport-starting-v511.yml | 4 ++-- .github/workflows/backport.yml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/backport-starting-v511.yml b/.github/workflows/backport-starting-v511.yml index 8b6fd03a..0dfabd52 100644 --- a/.github/workflows/backport-starting-v511.yml +++ b/.github/workflows/backport-starting-v511.yml @@ -6,11 +6,11 @@ on: jobs: backport: strategy: - fail-fast: true + fail-fast: false matrix: branch: ['v/5.11','v/5.12','v/5.13','v/5.14'] uses: hazelcast/hz-docs/.github/workflows/backport-workflow.yml@main with: - label: '["backport starting from 5.11"]' + label-to-check-for: '["backport starting from 5.11"]' target-branch: v/${{ matrix.branch }} secrets: inherit diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 6a031dcf..8eaf3379 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -14,23 +14,23 @@ jobs: backport-to-all-branch: needs: get-maintenance-branches strategy: - fail-fast: true + fail-fast: false matrix: branch: ${{ fromJSON(needs.get-maintenance-branches.outputs.branches) }} uses: hazelcast/hz-docs/.github/workflows/backport-workflow.yml@main with: - label: '["backport to all versions"]' + label-to-check-for: '["backport to all versions"]' target-branch: v/${{ matrix.branch }} secrets: inherit backport-to-specified-branch: needs: get-maintenance-branches strategy: - fail-fast: true + fail-fast: false matrix: branch: ${{ fromJSON(needs.get-maintenance-branches.outputs.branches) }} uses: hazelcast/hz-docs/.github/workflows/backport-workflow.yml@main with: - label: '["backport to ${{ matrix.branch }}"]' + label-to-check-for: '["backport to ${{ matrix.branch }}"]' target-branch: v/${{ matrix.branch }} secrets: inherit