From 82c0cd4d565f7d1f11aec66e3703dde82651f93a Mon Sep 17 00:00:00 2001 From: Ariadne Engelbrecht Date: Thu, 28 Sep 2023 06:54:45 +0200 Subject: [PATCH] Modify Kubernetes deployment script to be triggered by image:sha instead of image:latest. Modify build workflow to run only if tests will have run successfully. --- .github/workflows/build.yml | 4 ++++ deployment/web-deployment.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 028a55e..0ecdd90 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,9 @@ jobs: packages: write timeout-minutes: 60 steps: + - name: Check if Test Workflow Passed + id: check-test + run: echo ::set-output name=success::$(if [ ${{ github.event.workflow_run.conclusion }} == 'success' ]; then echo "true"; else echo "false"; fi) - name: Checkout repository uses: actions/checkout@v3 - name: Set up QEMU @@ -47,3 +50,4 @@ jobs: tags: | ghcr.io/${{ github.repository }}-app:${{ github.sha }} ghcr.io/${{ github.repository }}-app:latest + if: steps.check-test.outputs.success == 'true' diff --git a/deployment/web-deployment.yaml b/deployment/web-deployment.yaml index a32abe3..b9266e1 100644 --- a/deployment/web-deployment.yaml +++ b/deployment/web-deployment.yaml @@ -14,7 +14,7 @@ spec: spec: containers: - name: web - image: ghcr.io/inspired-consulting/threat_shield-app:latest + image: ghcr.io/inspired-consulting/threat_shield-app:${{ github.sha }} imagePullPolicy: Always ports: - containerPort: 4000