Skip to content

Commit 2a76670

Browse files
committed
[ci] Refactor build-test workflow
The GCS and manifest part is now a separate job, so it doesn't delay the execution of other parts of the workflow. kubectl-rabbitmq plugin tests now use the locally built image, instead of locally building one. This should speed-up the execution time of this job.
1 parent 70e1539 commit 2a76670

File tree

2 files changed

+35
-17
lines changed

2 files changed

+35
-17
lines changed

.github/workflows/build-test-publish.yml

+35-10
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262

6363
- name: kubectl rabbitmq tests
6464
env:
65-
IMG: "rabbitmqoperator/cluster-operator:${{ needs.build_operator.outputs.image_sha }}"
65+
IMG: "rabbitmqoperator/cluster-operator:${{ needs.build_operator.outputs.image_tag }}"
6666
run: |
6767
kind load image-archive /tmp/operator.tar --name cluster-operator-testing
6868
@@ -112,10 +112,11 @@ jobs:
112112
title: Cluster Operator - Unit and Integration tests
113113

114114
build_operator:
115+
name: Build Operator image
115116
runs-on: ubuntu-latest
116117
needs: unit_integration_tests
117118
outputs:
118-
image_sha: ${{ steps.build.outputs.digest }}
119+
image_tag: ${{ steps.meta.outputs.version }}
119120
permissions:
120121
contents: 'write'
121122
id-token: 'write'
@@ -167,11 +168,23 @@ jobs:
167168
- name: Build and push
168169
id: build
169170
uses: docker/build-push-action@v6
171+
# TODO: re-enable before PR
172+
if: false
173+
# if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }}
170174
with:
171175
context: .
172176
platforms: linux/amd64, linux/arm64, linux/ppc64le, linux/s390x
173177
provenance: false
174-
push: ${{ github.event_name != 'pull_request' }}
178+
push: true
179+
tags: ${{ steps.meta.outputs.tags }}
180+
labels: ${{ steps.meta.outputs.labels }}
181+
182+
- name: Build to TAR
183+
id: build_tar
184+
uses: docker/build-push-action@v6
185+
with:
186+
context: .
187+
provenance: false
175188
tags: ${{ steps.meta.outputs.tags }}
176189
labels: ${{ steps.meta.outputs.labels }}
177190
outputs: |
@@ -204,35 +217,47 @@ jobs:
204217
retention-days: 2
205218
if-no-files-found: error
206219

220+
upload_gcs:
221+
runs-on: ubuntu-latest
222+
name: Upload manifests to GCS
223+
# TODO: remove before sending PR
224+
if: false
225+
# if: ${{ github.event_name != 'pull_request' }}
226+
needs:
227+
- build_operator
228+
env:
229+
image_version: ${{ needs.build_operator.outputs.image_tag }}
230+
steps:
231+
- name: Download Operator manifests
232+
uses: actions/download-artifact@v4
233+
with:
234+
name: operator-manifests
235+
path: release/
207236
- name: Rename manifest for GCS
208-
if: github.event_name != 'pull_request'
209-
run: mv releases/cluster-operator.yml cluster-operator-${{ steps.meta.outputs.version }}.yml
237+
run: mv releases/cluster-operator.yml cluster-operator-${{ env.image_version }}.yml
210238

211239
- id: auth
212240
name: Auth to Google Cloud
213-
if: github.event_name != 'pull_request'
214241
uses: 'google-github-actions/auth@v2'
215242
with:
216243
workload_identity_provider: ${{ secrets.GCP_IDENTITY_PROVIDER }}
217244
service_account: ${{ secrets.GCP_SA }}
218245

219246
- name: Upload manifests to GCS
220-
if: github.event_name != 'pull_request'
221247
uses: google-github-actions/upload-cloud-storage@v2
222248
with:
223-
path: cluster-operator-${{ steps.meta.outputs.version }}.yml
249+
path: cluster-operator-${{ env.image_version }}.yml
224250
destination: operator-manifests-dev
225251

226252
- name: Update carvel-packaging-dev pipeline trigger
227-
if: github.event_name != 'pull_request'
228253
uses: google-github-actions/upload-cloud-storage@v2
229254
with:
230255
path: latest-cluster-operator-dev-manifest.txt
231256
destination: operator-manifests-dev
232257
process_gcloudignore: false
233258

234259
- name: Notify Google Chat
235-
if: ${{ failure() && github.event_name != 'pull_request' }}
260+
if: failure()
236261
uses: SimonScholz/google-chat-action@main
237262
with:
238263
webhookUrl: '${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}'

.github/workflows/release.yml

-7
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,3 @@ jobs:
1414
uses: rajatjindal/[email protected]
1515
with:
1616
krew_template_file: hack/rabbitmq.yaml
17-
- uses: 8398a7/action-slack@v3
18-
with:
19-
status: ${{ job.status }}
20-
fields: repo,message,action,eventName
21-
env:
22-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
23-
if: failure()

0 commit comments

Comments
 (0)