Skip to content

Commit 4de7141

Browse files
sutaakaropenshift-merge-bot[bot]
authored andcommitted
Adjust release GH workflow to handle error cases
1 parent 426a67f commit 4de7141

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

.github/workflows/tag-and-build.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,6 @@ jobs:
121121
podman tag quay.io/${{ github.event.inputs.quay-organization }}/codeflare-operator:${{ github.event.inputs.version }} quay.io/${{ github.event.inputs.quay-organization }}/codeflare-operator:stable
122122
make image-push -e IMG=quay.io/${{ github.event.inputs.quay-organization }}/codeflare-operator:stable
123123
124-
- name: Build bundle and create PR in OpenShift community operators repository
125-
run: |
126-
git config --global user.email "[email protected]"
127-
git config --global user.name "codeflare-machine-account"
128-
make openshift-community-operator-release
129-
env:
130-
VERSION: ${{ github.event.inputs.version }}
131-
PREVIOUS_VERSION: ${{ github.event.inputs.replaces }}
132-
INSTASCALE_VERSION: ${{ github.event.inputs.instascale-version }}
133-
MCAD_VERSION: ${{ github.event.inputs.mcad-version }}
134-
GH_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
135-
OPERATORS_REPO_FORK_ORG: ${{ github.event.inputs.community-operators-prod-fork-organization }}
136-
OPERATORS_REPO_ORG: ${{ github.event.inputs.community-operators-prod-organization }}
137-
138124
- name: Cleanup the go.mod and go.sum
139125
run: |
140126
go mod tidy
@@ -144,6 +130,7 @@ jobs:
144130
make manifests
145131
146132
- name: Commit changes in the code back to repository
133+
id: create-pr-branch
147134
uses: stefanzweifel/git-auto-commit-action@v4
148135
with:
149136
commit_message: Update dependency versions for release ${{ github.event.inputs.version }}
@@ -159,12 +146,21 @@ jobs:
159146
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
160147

161148
- name: Wait until PR with code changes is merged
149+
id: wait-pr-merge
162150
run: |
163151
timeout 3600 bash -c 'until [[ $(gh pr view '${{ env.PR_BRANCH_NAME }}' --json state --jq .state) == "MERGED" ]]; do sleep 5 && echo "$(gh pr view '${{ env.PR_BRANCH_NAME }}' --json state --jq .state)"; done'
164152
env:
165153
GITHUB_TOKEN: ${{ github.TOKEN }}
166154

155+
- name: Close PR if PR merge failed
156+
if: always() && (steps.wait-pr-merge.outcome == 'failure' || steps.wait-pr-merge.outcome == 'cancelled')
157+
run: |
158+
gh pr close ${{ env.PR_BRANCH_NAME }}
159+
env:
160+
GITHUB_TOKEN: ${{ github.TOKEN }}
161+
167162
- name: Delete remote branch
163+
if: always() && steps.create-pr-branch.outcome == 'success'
168164
run: |
169165
git push origin --delete ${{ env.PR_BRANCH_NAME }}
170166
@@ -180,3 +176,17 @@ jobs:
180176
env:
181177
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
182178
shell: bash
179+
180+
- name: Build bundle and create PR in OpenShift community operators repository
181+
run: |
182+
git config --global user.email "[email protected]"
183+
git config --global user.name "codeflare-machine-account"
184+
make openshift-community-operator-release
185+
env:
186+
VERSION: ${{ github.event.inputs.version }}
187+
PREVIOUS_VERSION: ${{ github.event.inputs.replaces }}
188+
INSTASCALE_VERSION: ${{ github.event.inputs.instascale-version }}
189+
MCAD_VERSION: ${{ github.event.inputs.mcad-version }}
190+
GH_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
191+
OPERATORS_REPO_FORK_ORG: ${{ github.event.inputs.community-operators-prod-fork-organization }}
192+
OPERATORS_REPO_ORG: ${{ github.event.inputs.community-operators-prod-organization }}

0 commit comments

Comments
 (0)