Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/01-ci.yml
Original file line number Diff line number Diff line change
@@ -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:

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
3 changes: 1 addition & 2 deletions .github/workflows/02-deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 28 additions & 10 deletions .github/workflows/04-deploy-production.yml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -142,4 +160,4 @@ jobs:
run: |
kubectl get pods -n production
kubectl get services -n production
kubectl get pvc -n production
kubectl get pvc -n production
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,7 @@ cython_debug/
.cursorignore
.cursorindexingignore

node_modules/
node_modules/
terraform/
kubernetes-generated/
kubernetes-templates/
2 changes: 1 addition & 1 deletion course-service/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
)
}

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ const Login = () => {

return (
<Container maxWidth="sm">
<Card sx={{ mt: 10 }}>
<Card sx={{ mt: 10, backgroundColor: "#e8f5e9", borderTop: "6px solid #2e7d32" }}>
<CardContent sx={{ p: 4 }}>
<Typography
variant="h4"
variant="h4" sx={{ color: "#2e7d32", fontWeight: 700 }}
gutterBottom
>
KoalaTech University
KoalaTech University - Continuous Deployment v2
</Typography>

<Typography
Expand Down