Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
4b25e03
chore(ci): trigger backend CI
AkankshaNunakani Sep 19, 2025
b4d4371
chore: activate workflow in fork
AkankshaNunakani Sep 19, 2025
9b3fc5c
ci: trigger backend workflow via backend/** change
AkankshaNunakani Sep 19, 2025
ef30802
ci: trigger backend workflows
AkankshaNunakani Sep 19, 2025
94c7373
ci: normalize triggers
AkankshaNunakani Sep 19, 2025
55dd08d
ci: restore backend_ci from upstream
AkankshaNunakani Sep 19, 2025
ad697ff
Update backend-cd.yml
AkankshaNunakani Sep 19, 2025
b6c81cf
Update backend_ci.yml
AkankshaNunakani Sep 19, 2025
be34076
Update backend_ci.yml
AkankshaNunakani Sep 19, 2025
ad360e5
Update backend-cd.yml
AkankshaNunakani Sep 19, 2025
f9f650b
Update backend_ci.yml
AkankshaNunakani Sep 19, 2025
919dddf
Update backend-cd.yml
AkankshaNunakani Sep 19, 2025
ef3f535
Update backend_ci.yml
AkankshaNunakani Sep 19, 2025
20bac2f
Update backend-cd.yml
AkankshaNunakani Sep 19, 2025
57c1074
Update backend_ci.yml
AkankshaNunakani Sep 19, 2025
ef3d953
Update backend_ci.yml
AkankshaNunakani Sep 19, 2025
f4bd676
Update backend-cd.yml
AkankshaNunakani Sep 19, 2025
bcd1f79
Update backend_ci.yml
AkankshaNunakani Sep 20, 2025
86017b7
Update backend_ci.yml
AkankshaNunakani Sep 20, 2025
896af89
Update backend_ci.yml
AkankshaNunakani Sep 20, 2025
8030489
Update backend_ci.yml
AkankshaNunakani Sep 20, 2025
f76de91
Update backend-cd.yml
AkankshaNunakani Sep 20, 2025
7b8b708
Update backend-cd.yml
AkankshaNunakani Sep 20, 2025
49f0fd6
Update backend-cd.yml
AkankshaNunakani Sep 20, 2025
79a4258
Update backend_ci.yml
AkankshaNunakani Sep 20, 2025
6d329d4
Update backend_ci.yml
AkankshaNunakani Sep 20, 2025
76afb5b
Update backend_ci.yml
AkankshaNunakani Sep 20, 2025
d01b0be
Update backend-cd.yml
AkankshaNunakani Sep 20, 2025
f2f40fe
Step 6: point frontend to AKS product/order services
AkankshaNunakani Sep 20, 2025
a80c017
Update frontend APIs to and
AkankshaNunakani Sep 20, 2025
aca16b1
test: trigger Frontend CI only
AkankshaNunakani Sep 29, 2025
c1fc539
ci: add consolidated CI (Frontend & Backend)
AkankshaNunakani Sep 29, 2025
5cbfd0a
ci: add consolidated CI (Frontend & Backend)
AkankshaNunakani Sep 29, 2025
e4f8fd5
chore: disable legacy frontend/backend CI/CD (kept for evidence)
AkankshaNunakani Sep 29, 2025
39d4a2f
Merge pull request #2 from AkankshaNunakani/chore/disable-old-pipelines
AkankshaNunakani Oct 1, 2025
ceef031
test(frontend): prove PR path filter
AkankshaNunakani Oct 1, 2025
e254e19
Merge pull request #3 from AkankshaNunakani/feat/ci-proof-2
AkankshaNunakani Oct 1, 2025
a839315
test(frontend): PR path filter proof (do not merge yet)
AkankshaNunakani Oct 1, 2025
4624cba
Merge pull request #4 from AkankshaNunakani/feat/ci-proof-3
AkankshaNunakani Oct 1, 2025
5b150bc
test(frontend): proof run for 9.2C
AkankshaNunakani Oct 1, 2025
0dc5647
test: retrigger PR CI (frontend-only)
AkankshaNunakani Oct 1, 2025
db07931
Merge pull request #6 from AkankshaNunakani/feat/ci-proof-final
AkankshaNunakani Oct 1, 2025
30912a3
test(frontend): prove paths-filter (frontend only)
AkankshaNunakani Oct 1, 2025
bd64e68
Merge pull request #8 from AkankshaNunakani/feat/ci-proof-final
AkankshaNunakani Oct 1, 2025
aa7829d
test(frontend): paths-filter proof (frontend only)
AkankshaNunakani Oct 1, 2025
c6a7a34
Merge pull request #9 from AkankshaNunakani/feat/ci-proof-frontend2
AkankshaNunakani Oct 1, 2025
3e7bdc9
test(frontend): paths-filter proof (frontend only)
AkankshaNunakani Oct 1, 2025
49df9d6
Merge pull request #10 from AkankshaNunakani/feat/ci-proof-frontend3
AkankshaNunakani Oct 1, 2025
8223427
test(frontend): paths-filter proof (frontend only)
AkankshaNunakani Oct 1, 2025
53ebca9
Merge pull request #11 from AkankshaNunakani/feat/ci-proof-frontend4
AkankshaNunakani Oct 1, 2025
c03b9f4
test(frontend): paths-filter proof (frontend only)
AkankshaNunakani Oct 1, 2025
fdf39f6
test(frontend): paths-filter proof (frontend only)
AkankshaNunakani Oct 1, 2025
f989403
test(frontend): trigger CI from feat/ci-proof-frontend5
AkankshaNunakani Oct 1, 2025
5978c38
test(frontend): rerun PR CI (frontend only)
AkankshaNunakani Oct 1, 2025
844badc
test(frontend): rerun PR CI (frontend only)
AkankshaNunakani Oct 1, 2025
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
125 changes: 43 additions & 82 deletions .github/workflows/backend-cd.yml
Original file line number Diff line number Diff line change
@@ -1,101 +1,62 @@
name: CD - Deploy Backend Services to AKS
name: Backend CD - Deploy to AKS

on:
workflow_dispatch:
inputs:
aks_cluster_name:
description: 'Name of the AKS Cluster to deploy to'
required: true
default: '<aks_cluster_name>'
aks_resource_group:
description: 'Resource Group of the AKS Cluster'
required: true
default: '<resource_group_name>'
aks_acr_name:
description: 'Name of ACR'
required: true
default: '<acr_name>'
tag:
description: "Image tag to deploy (leave blank to use latest CI SHA)"
required: false
workflow_run:
workflows: [ "Backend CI - Test, Build and Push Images to ACR" ]
types: [ "completed" ]
branches: [ "main" ]

jobs:
deploy_backend:
deploy:
runs-on: ubuntu-latest
environment: Production

outputs:
PRODUCT_API_IP: ${{ steps.get_product_ip.outputs.external_ip }}
ORDER_API_IP: ${{ steps.get_order_ip.outputs.external_ip }}
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
env:
ACR_LOGIN_SERVER: s722acr84438.azurecr.io
SUB_ID: 3ec3f453-a0b9-4c9e-81d1-fc985be293b5
NAMESPACE: default
ORDER_DEPLOY: order-service-w08e1
PRODUCT_DEPLOY: product-service-w08e1
ORDER_CONTAINER: order-service-container
PRODUCT_CONTAINER: product-service-container
TAG: ${{ inputs.tag || github.event.workflow_run.head_sha || github.sha }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Log in to Azure
uses: azure/login@v1
- name: Azure login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
enable-AzPSSession: true

- name: Set Kubernetes context (get AKS credentials)
run: |
az aks get-credentials --resource-group ${{ github.event.inputs.aks_resource_group }} --name ${{ github.event.inputs.aks_cluster_name }} --overwrite-existing
- name: Set subscription
run: az account set --subscription "$SUB_ID"

- name: Attach ACR
run: |
az aks update --name ${{ github.event.inputs.aks_cluster_name }} --resource-group ${{ github.event.inputs.aks_resource_group }} --attach-acr ${{ github.event.inputs.aks_acr_name }}
- name: Set AKS context (admin kubeconfig)
uses: azure/aks-set-context@v3
with:
resource-group: ${{ secrets.AKS_RG }}
cluster-name: ${{ secrets.AKS_NAME }}
admin: true

- name: Deploy Backend Infrastructure (Namespace, ConfigMaps, Secrets, Databases)
- name: Patch images to new tag
run: |
echo "Deploying backend infrastructure..."
cd k8s/
kubectl apply -f configmaps.yaml
kubectl apply -f secrets.yaml
kubectl apply -f product-db.yaml
kubectl apply -f order-db.yaml
set -e
echo "Deploying tag: $TAG"
kubectl set image -n "$NAMESPACE" deploy/$ORDER_DEPLOY $ORDER_CONTAINER=$ACR_LOGIN_SERVER/week08/order-service:$TAG
kubectl set image -n "$NAMESPACE" deploy/$PRODUCT_DEPLOY $PRODUCT_CONTAINER=$ACR_LOGIN_SERVER/week08/product-service:$TAG

- name: Deploy Backend Microservices (Product, Order)
run: |
echo "Deploying backend microservices..."
cd k8s/
kubectl apply -f product-service.yaml
kubectl apply -f order-service.yaml

- name: Wait for Backend LoadBalancer IPs
- name: Wait for rollout
run: |
echo "Waiting for Product, Order LoadBalancer IPs to be assigned (up to 5 minutes)..."
PRODUCT_IP=""
ORDER_IP=""

for i in $(seq 1 60); do
echo "Attempt $i/60 to get IPs..."
PRODUCT_IP=$(kubectl get service product-service-w08e1 -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
ORDER_IP=$(kubectl get service order-service-w08e1 -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
set -e
kubectl rollout status -n "$NAMESPACE" deploy/$ORDER_DEPLOY
kubectl rollout status -n "$NAMESPACE" deploy/$PRODUCT_DEPLOY

if [[ -n "$PRODUCT_IP" && -n "$ORDER_IP" ]]; then
echo "All backend LoadBalancer IPs assigned!"
echo "Product Service IP: $PRODUCT_IP"
echo "Order Service IP: $ORDER_IP"
break
fi
sleep 5 # Wait 5 seconds before next attempt
done

if [[ -z "$PRODUCT_IP" || -z "$ORDER_IP" ]]; then
echo "Error: One or more LoadBalancer IPs not assigned after timeout."
exit 1 # Fail the job if IPs are not obtained
fi

# These are environment variables for subsequent steps in the *same job*
# And used to set the job outputs
echo "PRODUCT_IP=$PRODUCT_IP" >> $GITHUB_ENV
echo "ORDER_IP=$ORDER_IP" >> $GITHUB_ENV

- name: Capture Product Service IP for Workflow Output
id: get_product_ip
run: echo "external_ip=${{ env.PRODUCT_IP }}" >> $GITHUB_OUTPUT

- name: Capture Order Service IP for Workflow Output
id: get_order_ip
run: echo "external_ip=${{ env.ORDER_IP }}" >> $GITHUB_OUTPUT

- name: Logout from Azure
run: az logout
- name: Show deployed images
run: |
kubectl get deploy -n "$NAMESPACE" \
-o custom-columns=NAME:.metadata.name,IMAGE:.spec.template.spec.containers[0].image,READY:.status.readyReplicas
62 changes: 62 additions & 0 deletions .github/workflows/backend-cd.yml.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Backend CD - Deploy to AKS

on:
workflow_dispatch:
inputs:
tag:
description: "Image tag to deploy (leave blank to use latest CI SHA)"
required: false
workflow_run:
workflows: [ "Backend CI - Test, Build and Push Images to ACR" ]
types: [ "completed" ]
branches: [ "main" ]

jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
env:
ACR_LOGIN_SERVER: s722acr84438.azurecr.io
SUB_ID: 3ec3f453-a0b9-4c9e-81d1-fc985be293b5
NAMESPACE: default
ORDER_DEPLOY: order-service-w08e1
PRODUCT_DEPLOY: product-service-w08e1
ORDER_CONTAINER: order-service-container
PRODUCT_CONTAINER: product-service-container
TAG: ${{ inputs.tag || github.event.workflow_run.head_sha || github.sha }}

steps:
- uses: actions/checkout@v4

- name: Azure login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Set subscription
run: az account set --subscription "$SUB_ID"

- name: Set AKS context (admin kubeconfig)
uses: azure/aks-set-context@v3
with:
resource-group: ${{ secrets.AKS_RG }}
cluster-name: ${{ secrets.AKS_NAME }}
admin: true

- name: Patch images to new tag
run: |
set -e
echo "Deploying tag: $TAG"
kubectl set image -n "$NAMESPACE" deploy/$ORDER_DEPLOY $ORDER_CONTAINER=$ACR_LOGIN_SERVER/week08/order-service:$TAG
kubectl set image -n "$NAMESPACE" deploy/$PRODUCT_DEPLOY $PRODUCT_CONTAINER=$ACR_LOGIN_SERVER/week08/product-service:$TAG

- name: Wait for rollout
run: |
set -e
kubectl rollout status -n "$NAMESPACE" deploy/$ORDER_DEPLOY
kubectl rollout status -n "$NAMESPACE" deploy/$PRODUCT_DEPLOY

- name: Show deployed images
run: |
kubectl get deploy -n "$NAMESPACE" \
-o custom-columns=NAME:.metadata.name,IMAGE:.spec.template.spec.containers[0].image,READY:.status.readyReplicas
Loading