From 158c185e7775fbff4341e01fa1cc5349e7c8f3d5 Mon Sep 17 00:00:00 2001 From: aman Date: Fri, 18 Sep 2026 12:02:35 +1000 Subject: [PATCH 1/3] chore: trigger CI pipeline - update course-service health message --- .gitignore | 5 ++++- course-service/app/main.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4299cd1a..e31705af 100644 --- a/.gitignore +++ b/.gitignore @@ -196,4 +196,7 @@ cython_debug/ .cursorignore .cursorindexingignore -node_modules/ \ No newline at end of file +node_modules/ +terraform/ +kubernetes-generated/ +kubernetes-templates/ diff --git a/course-service/app/main.py b/course-service/app/main.py index 7c8cbfb2..44c96a21 100644 --- a/course-service/app/main.py +++ b/course-service/app/main.py @@ -71,7 +71,7 @@ async def lifespan(_: FastAPI): def root() -> dict[str, str]: return { "message": ( - "KoalaTech University Course Service is running." + "KoalaTech University Course Service is running - v2." ) } From 479128d2c09bc5bca43fe9ba16012cdacea0809c Mon Sep 17 00:00:00 2001 From: aman Date: Fri, 25 Sep 2026 21:48:34 +1000 Subject: [PATCH 2/3] Enable continuous deployment: auto-promote to production after staging tests --- .github/workflows/01-ci.yml | 13 +++++--- .github/workflows/02-deploy-staging.yml | 3 +- .github/workflows/04-deploy-production.yml | 38 ++++++++++++++++------ 3 files changed, 38 insertions(+), 16 deletions(-) diff --git a/.github/workflows/01-ci.yml b/.github/workflows/01-ci.yml index 8206db43..656d67e6 100644 --- a/.github/workflows/01-ci.yml +++ b/.github/workflows/01-ci.yml @@ -1,11 +1,16 @@ name: 01 - CI on: - # Trigger the workflow on push to main branch + # Validate pull requests into main (tests only - no images pushed) + pull_request: + branches: + - main + + # Merging a PR pushes to main -> full CI -> starts the CD chain push: branches: - main - + # Manual trigger for the workflow workflow_dispatch: @@ -113,7 +118,7 @@ jobs: needs: - backend-test - # Build and push when code is pushed to main or manually triggered + # Only build/push on push to main or manual run (NOT on pull requests) if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' strategy: @@ -163,4 +168,4 @@ jobs: - name: Push Docker image with commit SHA run: | docker push \ - ${{ vars.ACR_LOGIN_SERVER }}/${{ matrix.image }}:${{ github.sha }} + ${{ vars.ACR_LOGIN_SERVER }}/${{ matrix.image }}:${{ github.sha }} \ No newline at end of file diff --git a/.github/workflows/02-deploy-staging.yml b/.github/workflows/02-deploy-staging.yml index 006bb70d..eaefe42f 100644 --- a/.github/workflows/02-deploy-staging.yml +++ b/.github/workflows/02-deploy-staging.yml @@ -14,8 +14,7 @@ jobs: name: Deploy to Staging runs-on: ubuntu-latest - if: > - ${{ github.event.workflow_run.conclusion == 'success' }} + if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'pull_request' environment: name: staging diff --git a/.github/workflows/04-deploy-production.yml b/.github/workflows/04-deploy-production.yml index 969d646b..adf30c99 100644 --- a/.github/workflows/04-deploy-production.yml +++ b/.github/workflows/04-deploy-production.yml @@ -1,10 +1,20 @@ name: 04 - Deploy to Production on: + # CONTINUOUS DEPLOYMENT: run automatically when the staging acceptance test finishes + workflow_run: + workflows: + - "03 - Test Staging" + types: + - completed + branches: + - main + + # Kept for manual rollback to a previous tested image workflow_dispatch: inputs: image_tag: - description: "Tested image SHA to deploy" + description: "Tested image SHA to deploy (rollback)" required: true type: string @@ -13,12 +23,21 @@ jobs: name: Deploy to Production runs-on: ubuntu-latest + # Only promote to production if the staging smoke test PASSED + if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' + environment: name: production + env: + # Automatic run: the commit SHA that passed staging. Manual run: the SHA typed in. + IMAGE_TAG: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || inputs.image_tag }} + steps: - - name: Checkout repository + - name: Checkout tested commit uses: actions/checkout@v4 + with: + ref: ${{ env.IMAGE_TAG }} - name: Login to Azure uses: azure/login@v3 @@ -65,41 +84,40 @@ jobs: run: | kubectl apply \ -f kubernetes/production/ - - name: Update frontend image run: | kubectl set image deployment/frontend \ - frontend=${{ vars.ACR_LOGIN_SERVER }}/koalatech-frontend:${{ inputs.image_tag }} \ + frontend=${{ vars.ACR_LOGIN_SERVER }}/koalatech-frontend:${{ env.IMAGE_TAG }} \ -n production - name: Update user-service image run: | kubectl set image deployment/user-service \ - user-service=${{ vars.ACR_LOGIN_SERVER }}/koalatech-user-service:${{ inputs.image_tag }} \ + user-service=${{ vars.ACR_LOGIN_SERVER }}/koalatech-user-service:${{ env.IMAGE_TAG }} \ -n production - name: Update student-service image run: | kubectl set image deployment/student-service \ - student-service=${{ vars.ACR_LOGIN_SERVER }}/koalatech-student-service:${{ inputs.image_tag }} \ + student-service=${{ vars.ACR_LOGIN_SERVER }}/koalatech-student-service:${{ env.IMAGE_TAG }} \ -n production - name: Update lecturer-service image run: | kubectl set image deployment/lecturer-service \ - lecturer-service=${{ vars.ACR_LOGIN_SERVER }}/koalatech-lecturer-service:${{ inputs.image_tag }} \ + lecturer-service=${{ vars.ACR_LOGIN_SERVER }}/koalatech-lecturer-service:${{ env.IMAGE_TAG }} \ -n production - name: Update course-service image run: | kubectl set image deployment/course-service \ - course-service=${{ vars.ACR_LOGIN_SERVER }}/koalatech-course-service:${{ inputs.image_tag }} \ + course-service=${{ vars.ACR_LOGIN_SERVER }}/koalatech-course-service:${{ env.IMAGE_TAG }} \ -n production - name: Update enrollment-service image run: | kubectl set image deployment/enrollment-service \ - enrollment-service=${{ vars.ACR_LOGIN_SERVER }}/koalatech-enrollment-service:${{ inputs.image_tag }} \ + enrollment-service=${{ vars.ACR_LOGIN_SERVER }}/koalatech-enrollment-service:${{ env.IMAGE_TAG }} \ -n production - name: Wait for frontend rollout @@ -142,4 +160,4 @@ jobs: run: | kubectl get pods -n production kubectl get services -n production - kubectl get pvc -n production \ No newline at end of file + kubectl get pvc -n production From adb05dd68779c3b99d4023a577fde84783e6edc4 Mon Sep 17 00:00:00 2001 From: aman Date: Fri, 25 Sep 2026 22:02:19 +1000 Subject: [PATCH 3/3] Update login page heading and colour to demonstrate CD --- frontend/src/pages/Login.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/Login.jsx b/frontend/src/pages/Login.jsx index 1132741c..a4538735 100644 --- a/frontend/src/pages/Login.jsx +++ b/frontend/src/pages/Login.jsx @@ -87,13 +87,13 @@ const Login = () => { return ( - + - KoalaTech University + KoalaTech University - Continuous Deployment v2