From 081d583bf37acc94d3c643e4e0b170199581f02f Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Wed, 17 Sep 2025 03:05:46 +1000 Subject: [PATCH 01/29] Update secrets.yaml --- k8s/secrets.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/k8s/secrets.yaml b/k8s/secrets.yaml index 5eebe1fa..066821f4 100644 --- a/k8s/secrets.yaml +++ b/k8s/secrets.yaml @@ -13,6 +13,6 @@ data: # Azure Storage Account Credentials for Product Service image uploads # REPLACE WITH YOUR ACTUAL BASE64 ENCODED VALUES from your Azure Storage Account # Example: echo -n 'myblobstorageaccount' | base64 - AZURE_STORAGE_ACCOUNT_NAME: "ZHVyZ2VzaHNhbWFyaXlh" + AZURE_STORAGE_ACCOUNT_NAME: "cGFzaW5kdThw" # Example: echo -n 'your_storage_account_key_string' | base64 - AZURE_STORAGE_ACCOUNT_KEY: "aEFNQ24rbkh2cmhwSGFEaW5jSnAxNFlHaU5nTnJja2NJR05Bc3Y5VXZPUlpsblJkbkVUR3drdTREdSszblBDR3E4ZEVTVjlFNE1jMytBU3RubmZ5QVE9PQ==" + AZURE_STORAGE_ACCOUNT_KEY: "djhZNWJ3NDlvU3RWL3FlYTNBT0pwZUFiZld5Yk8xM1pmWWt4ZG5MUjV6MWxNL2UyZlFZZ3pUVlVwYXkwTElIQkZ1MkRGTEcyeVhxWStBU3RCVEFhU1E9PQ==" From 2969641fe06176a460c3f49b8bc31ddccd2cd88f Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Wed, 17 Sep 2025 03:06:38 +1000 Subject: [PATCH 02/29] Update order-service.yaml --- k8s/order-service.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/order-service.yaml b/k8s/order-service.yaml index c9d92e4d..95709cb0 100644 --- a/k8s/order-service.yaml +++ b/k8s/order-service.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: order-service-container - image: durgeshsamariya.azurecr.io/order_service:latest + image: pasindu8p.azurecr.io/order_service:latest imagePullPolicy: Always ports: - containerPort: 8000 From ef297dcbea0e51376f2999040665ed2a8b2b2be1 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Wed, 17 Sep 2025 03:07:27 +1000 Subject: [PATCH 03/29] Update product-service.yaml --- k8s/product-service.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/product-service.yaml b/k8s/product-service.yaml index 0cbbd505..5861d162 100644 --- a/k8s/product-service.yaml +++ b/k8s/product-service.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: product-service-container - image: durgeshsamariya.azurecr.io/product_service:latest + image: pasindu8p.azurecr.io/product_service:latest imagePullPolicy: Always ports: - containerPort: 8000 From 689b405b9262cd77d19bfcc5e56f00f17686423a Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Wed, 17 Sep 2025 03:08:10 +1000 Subject: [PATCH 04/29] Update frontend.yaml --- k8s/frontend.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/frontend.yaml b/k8s/frontend.yaml index 1948536d..e4680156 100644 --- a/k8s/frontend.yaml +++ b/k8s/frontend.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: frontend-container - image: durgeshsamariya.azurecr.io/frontend:latest + image: pasindu8p.azurecr.io/frontend:latest imagePullPolicy: Always ports: - containerPort: 80 From 917dde5e5043cb6e6da2fd3d31fcaa4ea2cfc267 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Wed, 17 Sep 2025 03:18:56 +1000 Subject: [PATCH 05/29] added a comment --- .github/workflows/backend_ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index d69725aa..f19ec49f 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -1,4 +1,5 @@ # week08/.github/workflows/backend_ci.yml +#this is for trigger the pipeline name: Backend CI - Test, Build and Push Images to ACR From 4189707de867bdd40f57e38a6d897c2070b6a7d8 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Wed, 17 Sep 2025 03:37:51 +1000 Subject: [PATCH 06/29] added a comment to frontend --- .github/workflows/frontend_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend_ci.yml b/.github/workflows/frontend_ci.yml index 9f9e76d9..e3089373 100644 --- a/.github/workflows/frontend_ci.yml +++ b/.github/workflows/frontend_ci.yml @@ -1,5 +1,5 @@ # week08/.github/workflows/frontend_ci.yml - +#this is to trigger frontend pipeline name: Frontend CI - Build & Push Image on: From ea470e4b2fed03a7243d32326fd4294f8540b4a2 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Fri, 26 Sep 2025 23:42:54 +1000 Subject: [PATCH 07/29] changed to 9.2c --- .github/workflows/azure-logout.yml | 11 +++++++ .github/workflows/backend-cd.yml | 37 ++++++++++++++-------- .github/workflows/backend_ci.yml | 16 +++++++--- .github/workflows/frontend-cd.yml | 50 +++++++++--------------------- .github/workflows/frontend_ci.yml | 17 +++++++--- 5 files changed, 75 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/azure-logout.yml diff --git a/.github/workflows/azure-logout.yml b/.github/workflows/azure-logout.yml new file mode 100644 index 00000000..0de1ec96 --- /dev/null +++ b/.github/workflows/azure-logout.yml @@ -0,0 +1,11 @@ +name: Azure Logout + +on: + workflow_call: {} + +jobs: + logout: + runs-on: ubuntu-latest + steps: + - name: Logout from Azure + run: az logout \ No newline at end of file diff --git a/.github/workflows/backend-cd.yml b/.github/workflows/backend-cd.yml index 6035ed15..f496f57d 100644 --- a/.github/workflows/backend-cd.yml +++ b/.github/workflows/backend-cd.yml @@ -16,14 +16,20 @@ on: required: true default: '' + workflow_run: + workflows: ["Backend CI - Test, Build and Push Images to ACR"] + types: + - completed + jobs: deploy_backend: + if: ${{ github.event.workflow_run.conclusion == 'success' }} 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 }} + PRODUCT_API_IP: ${{ steps.set_product_ip.outputs.external_ip }} + ORDER_API_IP: ${{ steps.set_order_ip.outputs.external_ip }} steps: - name: Checkout repository @@ -37,15 +43,20 @@ jobs: - 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 + az aks get-credentials \ + --resource-group ${{ github.event.inputs.aks_resource_group }} \ + --name ${{ github.event.inputs.aks_cluster_name }} \ + --overwrite-existing - 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 }} + 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: Deploy Backend Infrastructure (Namespace, ConfigMaps, Secrets, Databases) + - name: Deploy Backend Infrastructure run: | - echo "Deploying backend infrastructure..." cd k8s/ kubectl apply -f configmaps.yaml kubectl apply -f secrets.yaml @@ -71,7 +82,6 @@ jobs: ORDER_IP=$(kubectl get service order-service-w08e1 -o jsonpath='{.status.loadBalancer.ingress[0].ip}') 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 @@ -89,13 +99,14 @@ jobs: 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 + - name: Set Product IP Output + id: set_product_ip run: echo "external_ip=${{ env.PRODUCT_IP }}" >> $GITHUB_OUTPUT - - name: Capture Order Service IP for Workflow Output - id: get_order_ip + - name: Set Order IP Output + id: set_order_ip run: echo "external_ip=${{ env.ORDER_IP }}" >> $GITHUB_OUTPUT - - name: Logout from Azure - run: az logout + - name: Azure Logout (Reusable) + if: always() + uses: ./.github/workflows/azure-logout.yml diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index f19ec49f..ed783d66 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -9,14 +9,22 @@ on: # Manual trigger workflow_dispatch: - # Automatically on pushes to main branch + # Automatically on pushes to development branch push: branches: - - main + - development paths: # Only trigger if changes are in backend directories - 'backend/**' - '.github/workflows/backend_ci.yml' # Trigger if this workflow file changes + pull_request: + branches: + - development + - main + paths: + - 'backend/**' + - '.github/workflows/backend_ci.yml' # Trigger if this workflow file changes + # Define global environment variables that can be used across jobs env: # ACR Login Server (e.g., myregistry.azurecr.io) @@ -142,6 +150,6 @@ jobs: docker push ${{ env.ACR_LOGIN_SERVER }}/order_service:latest # Logout from Azure for security (runs even if image push fails) - - name: Logout from Azure - run: az logout + - name: Call reusable Azure Logout if: always() + uses: ./.github/workflows/azure-logout.yml diff --git a/.github/workflows/frontend-cd.yml b/.github/workflows/frontend-cd.yml index 0a0879c8..0cd54014 100644 --- a/.github/workflows/frontend-cd.yml +++ b/.github/workflows/frontend-cd.yml @@ -2,8 +2,6 @@ name: CD - Deploy Frontend to AKS -# This workflow can be called by other workflows and takes inputs. -# Or it can be run manually if you provide the IPs. on: workflow_dispatch: inputs: @@ -22,25 +20,16 @@ on: aks_resource_group: description: 'Resource Group of the AKS Cluster' required: true - default: '<' + default: '' - workflow_call: - inputs: - product_api_ip: - required: true - type: string - order_api_ip: - required: true - type: string - aks_cluster_name: - required: true - type: string - aks_resource_group: - required: true - type: string + workflow_run: + workflows: ["CD - Deploy Backend Services to AKS"] + types: + - completed jobs: deploy_frontend: + if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest environment: Production @@ -48,46 +37,37 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - # Azure login using a Service Principal secret - name: Azure Login uses: azure/login@v1 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - # Login to Azure Container Registry (ACR) - name: Login to Azure Container Registry run: az acr login --name ${{ secrets.AZURE_CONTAINER_REGISTRY }} - name: Inject Backend IPs into Frontend main.js run: | - echo "Injecting IPs into frontend/static/js/main.js" - # Ensure frontend/main.js is directly in the path for sed - sed -i "s|_PRODUCT_API_URL_|${{ inputs.product_api_ip }}|g" frontend/main.js - sed -i "s|_ORDER_API_URL_|${{ inputs.order_api_ip }}|g" frontend/main.js - - # Display the modified file content for debugging - echo "--- Modified main.js content ---" + echo "Injecting Product and Order IPs..." + sed -i "s|_PRODUCT_API_URL_|${{ github.event.workflow_run.outputs.PRODUCT_API_IP }}|g" frontend/main.js + sed -i "s|_ORDER_API_URL_|${{ github.event.workflow_run.outputs.ORDER_API_IP }}|g" frontend/main.js cat frontend/main.js - echo "---------------------------------" - # Build and Push Docker image for Frontend - name: Build and Push Frontend Image run: | docker build -t ${{ secrets.AZURE_CONTAINER_REGISTRY }}/frontend:latest ./frontend/ docker push ${{ secrets.AZURE_CONTAINER_REGISTRY }}/frontend:latest - - name: Set Kubernetes context (get AKS credentials) + - name: Set Kubernetes context uses: azure/aks-set-context@v3 with: - resource-group: ${{ inputs.aks_resource_group }} - cluster-name: ${{ inputs.aks_cluster_name }} + resource-group: ${{ github.event.inputs.aks_resource_group }} + cluster-name: ${{ github.event.inputs.aks_cluster_name }} - name: Deploy Frontend to AKS run: | - echo "Deploying frontend with latest tag to AKS cluster: ${{ inputs.aks_cluster_name }}" cd k8s/ - # Ensure frontend-service.yaml is configured with your ACR kubectl apply -f frontend.yaml - - name: Logout from Azure (AKS deployment) - run: az logout + - name: Azure Logout (Reusable) + if: always() + uses: ./.github/workflows/azure-logout.yml diff --git a/.github/workflows/frontend_ci.yml b/.github/workflows/frontend_ci.yml index e3089373..e94d6331 100644 --- a/.github/workflows/frontend_ci.yml +++ b/.github/workflows/frontend_ci.yml @@ -6,9 +6,18 @@ on: # Manual trigger workflow_dispatch: - # Automatically on pushes to main branch + # Automatically on pushes to development branch push: branches: + - development + paths: # Only trigger if changes are in the frontend directory + - 'frontend/**' + - '.github/workflows/frontend_ci.yml' # Trigger if this workflow file changes + + # Run on pull requests targeting development or main branch + pull_request: + branches: + - development - main paths: # Only trigger if changes are in the frontend directory - 'frontend/**' @@ -47,7 +56,7 @@ jobs: docker build -t ${{ env.ACR_LOGIN_SERVER }}/frontend:latest ./frontend/ docker push ${{ env.ACR_LOGIN_SERVER }}/frontend:latest - # Logout from Azure for security (runs even if image push fails) - - name: Logout from Azure - run: az logout + # Calling the reusable logout + - name: Azure Logout (Reusable) if: always() + uses: ./.github/workflows/azure-logout.yml \ No newline at end of file From 869a91c2a5c4ffcd7bda235c87873a7d89e2f2ce Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sat, 27 Sep 2025 00:18:25 +1000 Subject: [PATCH 08/29] added changes to 9.2c --- .github/workflows/backend-cd.yml | 36 ++++++++++---------------------- k8s/frontend.yaml | 2 +- k8s/order-service.yaml | 2 +- k8s/product-service.yaml | 2 +- k8s/secrets.yaml | 4 ++-- 5 files changed, 16 insertions(+), 30 deletions(-) diff --git a/.github/workflows/backend-cd.yml b/.github/workflows/backend-cd.yml index f496f57d..be651948 100644 --- a/.github/workflows/backend-cd.yml +++ b/.github/workflows/backend-cd.yml @@ -1,22 +1,8 @@ name: CD - Deploy Backend Services to AKS on: - workflow_dispatch: - inputs: - aks_cluster_name: - description: 'Name of the AKS Cluster to deploy to' - required: true - default: '' - aks_resource_group: - description: 'Resource Group of the AKS Cluster' - required: true - default: '' - aks_acr_name: - description: 'Name of ACR' - required: true - default: '' - - workflow_run: + workflow_dispatch: # still allow manual runs + workflow_run: # auto-trigger after CI completes successfully workflows: ["Backend CI - Test, Build and Push Images to ACR"] types: - completed @@ -26,7 +12,7 @@ jobs: if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest environment: Production - + outputs: PRODUCT_API_IP: ${{ steps.set_product_ip.outputs.external_ip }} ORDER_API_IP: ${{ steps.set_order_ip.outputs.external_ip }} @@ -44,16 +30,16 @@ jobs: - 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 }} \ + --resource-group ${{ secrets.AKS_RESOURCE_GROUP }} \ + --name ${{ secrets.AKS_CLUSTER_NAME }} \ --overwrite-existing - 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 ${{ secrets.AKS_CLUSTER_NAME }} \ + --resource-group ${{ secrets.AKS_RESOURCE_GROUP }} \ + --attach-acr ${{ secrets.AZURE_CONTAINER_REGISTRY }} - name: Deploy Backend Infrastructure run: | @@ -75,7 +61,7 @@ jobs: 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}') @@ -88,12 +74,12 @@ jobs: 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 diff --git a/k8s/frontend.yaml b/k8s/frontend.yaml index e4680156..da4ceda8 100644 --- a/k8s/frontend.yaml +++ b/k8s/frontend.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: frontend-container - image: pasindu8p.azurecr.io/frontend:latest + image: pasindu9c.azurecr.io/frontend:latest imagePullPolicy: Always ports: - containerPort: 80 diff --git a/k8s/order-service.yaml b/k8s/order-service.yaml index 95709cb0..fb251a86 100644 --- a/k8s/order-service.yaml +++ b/k8s/order-service.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: order-service-container - image: pasindu8p.azurecr.io/order_service:latest + image: pasindu9c.azurecr.io/order_service:latest imagePullPolicy: Always ports: - containerPort: 8000 diff --git a/k8s/product-service.yaml b/k8s/product-service.yaml index 5861d162..8f43a003 100644 --- a/k8s/product-service.yaml +++ b/k8s/product-service.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: product-service-container - image: pasindu8p.azurecr.io/product_service:latest + image: pasindu9c.azurecr.io/product_service:latest imagePullPolicy: Always ports: - containerPort: 8000 diff --git a/k8s/secrets.yaml b/k8s/secrets.yaml index 066821f4..6da5ff26 100644 --- a/k8s/secrets.yaml +++ b/k8s/secrets.yaml @@ -13,6 +13,6 @@ data: # Azure Storage Account Credentials for Product Service image uploads # REPLACE WITH YOUR ACTUAL BASE64 ENCODED VALUES from your Azure Storage Account # Example: echo -n 'myblobstorageaccount' | base64 - AZURE_STORAGE_ACCOUNT_NAME: "cGFzaW5kdThw" + AZURE_STORAGE_ACCOUNT_NAME: "cGFzaW5kdTlj" # Example: echo -n 'your_storage_account_key_string' | base64 - AZURE_STORAGE_ACCOUNT_KEY: "djhZNWJ3NDlvU3RWL3FlYTNBT0pwZUFiZld5Yk8xM1pmWWt4ZG5MUjV6MWxNL2UyZlFZZ3pUVlVwYXkwTElIQkZ1MkRGTEcyeVhxWStBU3RCVEFhU1E9PQ==" + AZURE_STORAGE_ACCOUNT_KEY: "N0pGWmtJWkJPNW1lTUhiNVQweThNWGRQMng2NW9wZUQrZTRPN2txYUFNUmdWZUlaN3EyelhZVmVZRWdJZ2FJeEJiZmJERmlPdVZ1LytBU3RGbmJIdUE9PQ==" From f9e7d3c2283003d96b1b196fdf211e432ff867d8 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sat, 27 Sep 2025 00:22:50 +1000 Subject: [PATCH 09/29] Testing backend CI trigger --- .github/workflows/backend_ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index ed783d66..5fd1fa4c 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -1,5 +1,6 @@ # week08/.github/workflows/backend_ci.yml #this is for trigger the pipeline +#this is for trigger the pipeline in 9.2C name: Backend CI - Test, Build and Push Images to ACR From 2e6479f2b674db0f3008e5b5bbfea5a1f63e5ca1 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sat, 27 Sep 2025 14:29:17 +1000 Subject: [PATCH 10/29] updated code with image names --- k8s/frontend.yaml | 2 +- k8s/order-service.yaml | 2 +- k8s/product-service.yaml | 2 +- k8s/secrets.yaml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/k8s/frontend.yaml b/k8s/frontend.yaml index da4ceda8..f321e75a 100644 --- a/k8s/frontend.yaml +++ b/k8s/frontend.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: frontend-container - image: pasindu9c.azurecr.io/frontend:latest + image: pasindufernando9c.azurecr.io/frontend:latest imagePullPolicy: Always ports: - containerPort: 80 diff --git a/k8s/order-service.yaml b/k8s/order-service.yaml index fb251a86..fa9e8d30 100644 --- a/k8s/order-service.yaml +++ b/k8s/order-service.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: order-service-container - image: pasindu9c.azurecr.io/order_service:latest + image: pasindufernando9c.azurecr.io/order_service:latest imagePullPolicy: Always ports: - containerPort: 8000 diff --git a/k8s/product-service.yaml b/k8s/product-service.yaml index 8f43a003..6cd19b9e 100644 --- a/k8s/product-service.yaml +++ b/k8s/product-service.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: product-service-container - image: pasindu9c.azurecr.io/product_service:latest + image: pasindufernando9c.azurecr.io/product_service:latest imagePullPolicy: Always ports: - containerPort: 8000 diff --git a/k8s/secrets.yaml b/k8s/secrets.yaml index 6da5ff26..cde2fec0 100644 --- a/k8s/secrets.yaml +++ b/k8s/secrets.yaml @@ -13,6 +13,6 @@ data: # Azure Storage Account Credentials for Product Service image uploads # REPLACE WITH YOUR ACTUAL BASE64 ENCODED VALUES from your Azure Storage Account # Example: echo -n 'myblobstorageaccount' | base64 - AZURE_STORAGE_ACCOUNT_NAME: "cGFzaW5kdTlj" + AZURE_STORAGE_ACCOUNT_NAME: "cGFzaW5kdWZlcm5hbmRvOWM=" # Example: echo -n 'your_storage_account_key_string' | base64 - AZURE_STORAGE_ACCOUNT_KEY: "N0pGWmtJWkJPNW1lTUhiNVQweThNWGRQMng2NW9wZUQrZTRPN2txYUFNUmdWZUlaN3EyelhZVmVZRWdJZ2FJeEJiZmJERmlPdVZ1LytBU3RGbmJIdUE9PQ==" + AZURE_STORAGE_ACCOUNT_KEY: "L1RDWUt3VWIxM1N0TkVnelgrMFpVMkIxcStNMDVRNXN6YnRhU3VVMS9qTVVhbGtIam5uZ2Zwc01JdVpZdFEzUFYwazdNVHgzb21SNCtBU3RzQTBqTHc9PQ==" From 0185519ae68a3214462d2101fd822bde76790af9 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sat, 27 Sep 2025 14:32:28 +1000 Subject: [PATCH 11/29] Trying to trigger backend CI --- .github/workflows/backend_ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 5fd1fa4c..0ce272e6 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -1,6 +1,7 @@ # week08/.github/workflows/backend_ci.yml #this is for trigger the pipeline #this is for trigger the pipeline in 9.2C +#this is re testing name: Backend CI - Test, Build and Push Images to ACR From 3aa28c3744cce021ce3fd4de1940ccac4ad4a464 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sat, 27 Sep 2025 15:08:39 +1000 Subject: [PATCH 12/29] fix logout --- .github/workflows/backend_ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index ed783d66..f9a0aab5 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -153,3 +153,7 @@ jobs: - name: Call reusable Azure Logout if: always() uses: ./.github/workflows/azure-logout.yml +logout: + if: always() + uses: ./.github/workflows/azure-logout.yml + needs: build_and_push_images \ No newline at end of file From e52d2410c352ec4e89fe39b0d792ea40f68cbfb8 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sat, 27 Sep 2025 15:32:51 +1000 Subject: [PATCH 13/29] fix logout --- .github/workflows/backend_ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index f69d292c..be136879 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -154,8 +154,4 @@ jobs: # Logout from Azure for security (runs even if image push fails) - name: Call reusable Azure Logout if: always() - uses: ./.github/workflows/azure-logout.yml -logout: - if: always() - uses: ./.github/workflows/azure-logout.yml - needs: build_and_push_images \ No newline at end of file + uses: ./.github/workflows/azure-logout.yml \ No newline at end of file From 94ba25f02924b3636d883e4e493152ce3ab46f65 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sat, 27 Sep 2025 15:39:05 +1000 Subject: [PATCH 14/29] test --- .github/workflows/backend_ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index be136879..a6746cef 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -2,6 +2,7 @@ #this is for trigger the pipeline #this is for trigger the pipeline in 9.2C #this is re testing +#test name: Backend CI - Test, Build and Push Images to ACR From a2d923c6e552bacc29319e021a0feb44d5c4efe6 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 08:28:24 +1000 Subject: [PATCH 15/29] test --- .github/workflows/backend_ci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index a6746cef..9ca6e567 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -152,7 +152,8 @@ jobs: docker build -t ${{ env.ACR_LOGIN_SERVER }}/order_service:latest ./backend/order_service/ docker push ${{ env.ACR_LOGIN_SERVER }}/order_service:latest - # Logout from Azure for security (runs even if image push fails) - - name: Call reusable Azure Logout - if: always() - uses: ./.github/workflows/azure-logout.yml \ No newline at end of file +logout: + if: always() + runs-on: ubuntu-latest + needs: [test_and_lint_backends, build_and_push_images] + uses: ./.github/workflows/azure-logout.yml \ No newline at end of file From c46c98c416343d213f8ccf002a829378a78a0b3e Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 08:41:27 +1000 Subject: [PATCH 16/29] test --- .github/workflows/azure-logout.yml | 2 +- .github/workflows/backend_ci.yml | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/azure-logout.yml b/.github/workflows/azure-logout.yml index 0de1ec96..dee8c868 100644 --- a/.github/workflows/azure-logout.yml +++ b/.github/workflows/azure-logout.yml @@ -1,7 +1,7 @@ name: Azure Logout on: - workflow_call: {} + workflow_call: jobs: logout: diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 9ca6e567..33518b3f 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -152,8 +152,7 @@ jobs: docker build -t ${{ env.ACR_LOGIN_SERVER }}/order_service:latest ./backend/order_service/ docker push ${{ env.ACR_LOGIN_SERVER }}/order_service:latest -logout: - if: always() - runs-on: ubuntu-latest - needs: [test_and_lint_backends, build_and_push_images] - uses: ./.github/workflows/azure-logout.yml \ No newline at end of file + logout: + if: always() + needs: [test_and_lint_backends, build_and_push_images] + uses: ./.github/workflows/azure-logout.yml \ No newline at end of file From d39411e08a1167bb9b566fa838cda94f1dfaccae Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 08:50:44 +1000 Subject: [PATCH 17/29] test --- .github/workflows/azure-logout.yml | 11 ----------- .github/workflows/backend-cd.yml | 5 +++-- .github/workflows/backend_ci.yml | 22 +++++++++++----------- .github/workflows/frontend-cd.yml | 5 +++-- .github/workflows/frontend_ci.yml | 8 ++++---- 5 files changed, 21 insertions(+), 30 deletions(-) delete mode 100644 .github/workflows/azure-logout.yml diff --git a/.github/workflows/azure-logout.yml b/.github/workflows/azure-logout.yml deleted file mode 100644 index dee8c868..00000000 --- a/.github/workflows/azure-logout.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Azure Logout - -on: - workflow_call: - -jobs: - logout: - runs-on: ubuntu-latest - steps: - - name: Logout from Azure - run: az logout \ No newline at end of file diff --git a/.github/workflows/backend-cd.yml b/.github/workflows/backend-cd.yml index be651948..82e2425c 100644 --- a/.github/workflows/backend-cd.yml +++ b/.github/workflows/backend-cd.yml @@ -93,6 +93,7 @@ jobs: id: set_order_ip run: echo "external_ip=${{ env.ORDER_IP }}" >> $GITHUB_OUTPUT - - name: Azure Logout (Reusable) + # Logout from Azure for security (runs even if image push fails) + - name: Logout from Azure + run: az logout if: always() - uses: ./.github/workflows/azure-logout.yml diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 33518b3f..9af3731f 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -20,13 +20,13 @@ on: - 'backend/**' - '.github/workflows/backend_ci.yml' # Trigger if this workflow file changes - pull_request: - branches: - - development - - main - paths: - - 'backend/**' - - '.github/workflows/backend_ci.yml' # Trigger if this workflow file changes + pull_request: + branches: + - development + - main + paths: + - 'backend/**' + - '.github/workflows/backend_ci.yml' # Trigger if this workflow file changes # Define global environment variables that can be used across jobs env: @@ -152,7 +152,7 @@ jobs: docker build -t ${{ env.ACR_LOGIN_SERVER }}/order_service:latest ./backend/order_service/ docker push ${{ env.ACR_LOGIN_SERVER }}/order_service:latest - logout: - if: always() - needs: [test_and_lint_backends, build_and_push_images] - uses: ./.github/workflows/azure-logout.yml \ No newline at end of file + # Logout from Azure for security (runs even if image push fails) + - name: Logout from Azure + run: az logout + if: always() \ No newline at end of file diff --git a/.github/workflows/frontend-cd.yml b/.github/workflows/frontend-cd.yml index 0cd54014..3e4c8b17 100644 --- a/.github/workflows/frontend-cd.yml +++ b/.github/workflows/frontend-cd.yml @@ -68,6 +68,7 @@ jobs: cd k8s/ kubectl apply -f frontend.yaml - - name: Azure Logout (Reusable) + # Logout from Azure for security (runs even if image push fails) + - name: Logout from Azure + run: az logout if: always() - uses: ./.github/workflows/azure-logout.yml diff --git a/.github/workflows/frontend_ci.yml b/.github/workflows/frontend_ci.yml index e94d6331..c3558aba 100644 --- a/.github/workflows/frontend_ci.yml +++ b/.github/workflows/frontend_ci.yml @@ -56,7 +56,7 @@ jobs: docker build -t ${{ env.ACR_LOGIN_SERVER }}/frontend:latest ./frontend/ docker push ${{ env.ACR_LOGIN_SERVER }}/frontend:latest - # Calling the reusable logout - - name: Azure Logout (Reusable) - if: always() - uses: ./.github/workflows/azure-logout.yml \ No newline at end of file + # Logout from Azure for security (runs even if image push fails) + - name: Logout from Azure + run: az logout + if: always() \ No newline at end of file From c2cb44242dc948a2940e30ca8b1d1857f36575a1 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 09:03:38 +1000 Subject: [PATCH 18/29] test --- .github/workflows/backend_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 9af3731f..5014ea22 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -2,7 +2,7 @@ #this is for trigger the pipeline #this is for trigger the pipeline in 9.2C #this is re testing -#test +#test 1 name: Backend CI - Test, Build and Push Images to ACR From 494e74a104d6ee3505a5f193d0dcf06c24261288 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 09:12:58 +1000 Subject: [PATCH 19/29] test123 --- .github/workflows/backend_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 5014ea22..5e0ef338 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -2,7 +2,7 @@ #this is for trigger the pipeline #this is for trigger the pipeline in 9.2C #this is re testing -#test 1 +#test 123 name: Backend CI - Test, Build and Push Images to ACR From cf9cfc24a54bd129e68cb8cd9fd0221a05629ab6 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 09:37:07 +1000 Subject: [PATCH 20/29] test1234 --- .github/workflows/backend-cd.yml | 2 +- .github/workflows/backend_ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backend-cd.yml b/.github/workflows/backend-cd.yml index 82e2425c..2c6cddab 100644 --- a/.github/workflows/backend-cd.yml +++ b/.github/workflows/backend-cd.yml @@ -39,7 +39,7 @@ jobs: az aks update \ --name ${{ secrets.AKS_CLUSTER_NAME }} \ --resource-group ${{ secrets.AKS_RESOURCE_GROUP }} \ - --attach-acr ${{ secrets.AZURE_CONTAINER_REGISTRY }} + --attach-acr ${{ secrets.AZURE_CONTAINER_REGISTRY_NAME }} - name: Deploy Backend Infrastructure run: | diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 5e0ef338..cb6cb826 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -2,7 +2,7 @@ #this is for trigger the pipeline #this is for trigger the pipeline in 9.2C #this is re testing -#test 123 +#test 1234 name: Backend CI - Test, Build and Push Images to ACR From 47253efa9c3959d8b67ea53a2777b7e3dfbb670b Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 10:19:20 +1000 Subject: [PATCH 21/29] testing --- .github/workflows/backend_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index cb6cb826..86ef3fbf 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -3,7 +3,7 @@ #this is for trigger the pipeline in 9.2C #this is re testing #test 1234 - +#testing name: Backend CI - Test, Build and Push Images to ACR # Trigger the workflow on pushes to the 'main' branch From f2105a174cf0dc821adb7920dba82a1f8b2e82a5 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 10:48:28 +1000 Subject: [PATCH 22/29] testing --- .github/workflows/frontend-cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend-cd.yml b/.github/workflows/frontend-cd.yml index 3e4c8b17..25e7a000 100644 --- a/.github/workflows/frontend-cd.yml +++ b/.github/workflows/frontend-cd.yml @@ -23,7 +23,7 @@ on: default: '' workflow_run: - workflows: ["CD - Deploy Backend Services to AKS"] + workflows: ["Frontend CI - Build & Push Image"] types: - completed From d539d4a2da8d65682345ba96013e31d062cefe27 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 11:35:08 +1000 Subject: [PATCH 23/29] fix frontend issues --- .github/workflows/frontend-cd.yml | 31 +++++++++++-------------------- .github/workflows/frontend_ci.yml | 6 ++++++ 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.github/workflows/frontend-cd.yml b/.github/workflows/frontend-cd.yml index 25e7a000..704e94ee 100644 --- a/.github/workflows/frontend-cd.yml +++ b/.github/workflows/frontend-cd.yml @@ -1,27 +1,11 @@ # week08/.github/workflows/frontend-cd.yml - name: CD - Deploy Frontend to AKS on: + # Allow manual trigger workflow_dispatch: - inputs: - product_api_ip: - description: 'External IP of Product Service' - required: true - default: 'http://:8000' - order_api_ip: - description: 'External IP of Order Service (e.g., http://Y.Y.Y.Y:8001)' - required: true - default: 'http://:8001' - aks_cluster_name: - description: 'Name of the AKS Cluster to deploy to' - required: true - default: '' - aks_resource_group: - description: 'Resource Group of the AKS Cluster' - required: true - default: '' + # Automatically run after Frontend CI completes successfully workflow_run: workflows: ["Frontend CI - Build & Push Image"] types: @@ -37,31 +21,38 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + # Azure login - name: Azure Login uses: azure/login@v1 with: creds: ${{ secrets.AZURE_CREDENTIALS }} + # Login to Azure Container Registry - name: Login to Azure Container Registry run: az acr login --name ${{ secrets.AZURE_CONTAINER_REGISTRY }} + # Inject Backend IPs into Frontend main.js - name: Inject Backend IPs into Frontend main.js run: | echo "Injecting Product and Order IPs..." sed -i "s|_PRODUCT_API_URL_|${{ github.event.workflow_run.outputs.PRODUCT_API_IP }}|g" frontend/main.js sed -i "s|_ORDER_API_URL_|${{ github.event.workflow_run.outputs.ORDER_API_IP }}|g" frontend/main.js + echo "--- Modified main.js ---" cat frontend/main.js + echo "------------------------" + # Build and Push Docker image for Frontend - name: Build and Push Frontend Image run: | docker build -t ${{ secrets.AZURE_CONTAINER_REGISTRY }}/frontend:latest ./frontend/ docker push ${{ secrets.AZURE_CONTAINER_REGISTRY }}/frontend:latest + # Set Kubernetes context (from secrets instead of workflow inputs) - name: Set Kubernetes context uses: azure/aks-set-context@v3 with: - resource-group: ${{ github.event.inputs.aks_resource_group }} - cluster-name: ${{ github.event.inputs.aks_cluster_name }} + resource-group: ${{ secrets.AKS_RESOURCE_GROUP }} + cluster-name: ${{ secrets.AKS_CLUSTER_NAME }} - name: Deploy Frontend to AKS run: | diff --git a/.github/workflows/frontend_ci.yml b/.github/workflows/frontend_ci.yml index c3558aba..6ee2d345 100644 --- a/.github/workflows/frontend_ci.yml +++ b/.github/workflows/frontend_ci.yml @@ -23,6 +23,12 @@ on: - 'frontend/**' - '.github/workflows/frontend_ci.yml' # Trigger if this workflow file changes + # Automatically trigger after backend CD completes successfully + workflow_run: + workflows: ["CD - Deploy Backend Services to AKS"] + types: + - completed + # Define global environment variables that can be used across jobs env: # ACR Login Server (e.g., myregistry.azurecr.io) From a6236f5d8814c1f130ebb3713900b7a6fa603a0c Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 12:03:51 +1000 Subject: [PATCH 24/29] fix frontend issues --- .github/workflows/frontend-cd.yml | 2 +- .github/workflows/frontend_ci.yml | 50 ++++++------------------------- 2 files changed, 10 insertions(+), 42 deletions(-) diff --git a/.github/workflows/frontend-cd.yml b/.github/workflows/frontend-cd.yml index 704e94ee..9aafa802 100644 --- a/.github/workflows/frontend-cd.yml +++ b/.github/workflows/frontend-cd.yml @@ -7,7 +7,7 @@ on: # Automatically run after Frontend CI completes successfully workflow_run: - workflows: ["Frontend CI - Build & Push Image"] + workflows: ["CD - Deploy Backend Services to AKS"] types: - completed diff --git a/.github/workflows/frontend_ci.yml b/.github/workflows/frontend_ci.yml index 6ee2d345..1f60a2b5 100644 --- a/.github/workflows/frontend_ci.yml +++ b/.github/workflows/frontend_ci.yml @@ -1,6 +1,6 @@ # week08/.github/workflows/frontend_ci.yml #this is to trigger frontend pipeline -name: Frontend CI - Build & Push Image +name: Frontend CI - Build Frontend Image on: # Manual trigger @@ -10,59 +10,27 @@ on: push: branches: - development - paths: # Only trigger if changes are in the frontend directory + paths: - 'frontend/**' - - '.github/workflows/frontend_ci.yml' # Trigger if this workflow file changes + - '.github/workflows/frontend_ci.yml' # Run on pull requests targeting development or main branch pull_request: branches: - development - main - paths: # Only trigger if changes are in the frontend directory + paths: - 'frontend/**' - - '.github/workflows/frontend_ci.yml' # Trigger if this workflow file changes - - # Automatically trigger after backend CD completes successfully - workflow_run: - workflows: ["CD - Deploy Backend Services to AKS"] - types: - - completed - -# Define global environment variables that can be used across jobs -env: - # ACR Login Server (e.g., myregistry.azurecr.io) - # This needs to be set as a GitHub Repository Secret - ACR_LOGIN_SERVER: ${{ secrets.AZURE_CONTAINER_REGISTRY }} - # Dynamically generate image tags based on Git SHA and GitHub Run ID - # This provides unique, traceable tags for each image build - IMAGE_TAG: ${{ github.sha }}-${{ github.run_id }} + - '.github/workflows/frontend_ci.yml' jobs: - build_and_push_frontend: + build_frontend: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - # Azure login using a Service Principal secret - - name: Azure Login - uses: azure/login@v1 - with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - # Login to Azure Container Registry (ACR) - - name: Login to Azure Container Registry - run: az acr login --name ${{ env.ACR_LOGIN_SERVER }} - - # Build and Push Docker image for Frontend - - name: Build and Push Frontend Image - run: | - docker build -t ${{ env.ACR_LOGIN_SERVER }}/frontend:latest ./frontend/ - docker push ${{ env.ACR_LOGIN_SERVER }}/frontend:latest - - # Logout from Azure for security (runs even if image push fails) - - name: Logout from Azure - run: az logout - if: always() \ No newline at end of file + # Build Docker image only (no push) + - name: Build Frontend Image (validation only) + run: docker build -t frontend-ci-test ./frontend/ From 1734b007b4da6edd05d49fdcecd39b31bf9b15a1 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 12:05:41 +1000 Subject: [PATCH 25/29] fix frontend issues --- .github/workflows/backend_ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 86ef3fbf..35085544 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -1,9 +1,8 @@ # week08/.github/workflows/backend_ci.yml #this is for trigger the pipeline -#this is for trigger the pipeline in 9.2C -#this is re testing -#test 1234 -#testing +#test the workflow + + name: Backend CI - Test, Build and Push Images to ACR # Trigger the workflow on pushes to the 'main' branch From 49db581fcf0688e26c08d8eecd32807bbdd7ff16 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 12:34:46 +1000 Subject: [PATCH 26/29] test the workflow --- .github/workflows/backend_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 35085544..dda189b3 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -1,6 +1,6 @@ # week08/.github/workflows/backend_ci.yml #this is for trigger the pipeline -#test the workflow +#test the workflow 123 name: Backend CI - Test, Build and Push Images to ACR From a50fee8710e3a968973117cecfa3c265fb0d1f08 Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 12:49:48 +1000 Subject: [PATCH 27/29] fix secret access --- .github/workflows/frontend-cd.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/frontend-cd.yml b/.github/workflows/frontend-cd.yml index 9aafa802..b25274e4 100644 --- a/.github/workflows/frontend-cd.yml +++ b/.github/workflows/frontend-cd.yml @@ -48,11 +48,12 @@ jobs: docker push ${{ secrets.AZURE_CONTAINER_REGISTRY }}/frontend:latest # Set Kubernetes context (from secrets instead of workflow inputs) - - name: Set Kubernetes context - uses: azure/aks-set-context@v3 - with: - resource-group: ${{ secrets.AKS_RESOURCE_GROUP }} - cluster-name: ${{ secrets.AKS_CLUSTER_NAME }} + - name: Set Kubernetes context (get AKS credentials) + run: | + az aks get-credentials \ + --resource-group ${{ secrets.AKS_RESOURCE_GROUP }} \ + --name ${{ secrets.AKS_CLUSTER_NAME }} \ + --overwrite-existing - name: Deploy Frontend to AKS run: | From 0f2f3054c3a4603d09656f1e27c780af5a3c4f8f Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 13:02:58 +1000 Subject: [PATCH 28/29] test again --- .github/workflows/backend_ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index dda189b3..b6908339 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -1,6 +1,7 @@ # week08/.github/workflows/backend_ci.yml #this is for trigger the pipeline #test the workflow 123 +#test workflow name: Backend CI - Test, Build and Push Images to ACR From a3987e8cb329b09a7f7ea2031e7ffda1c31a6cfd Mon Sep 17 00:00:00 2001 From: Pasindu Fernando <116358471+Pasindufdo98@users.noreply.github.com> Date: Sun, 28 Sep 2025 14:23:02 +1000 Subject: [PATCH 29/29] Test CI trigger via PR --- .github/workflows/backend_ci.yml | 2 +- frontend/main.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index b6908339..9d9a29f8 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -7,7 +7,7 @@ name: Backend CI - Test, Build and Push Images to ACR # Trigger the workflow on pushes to the 'main' branch -# You can also add 'pull_request:' to run on PRs +# 'pull_request:' to run on PRs on: # Manual trigger workflow_dispatch: diff --git a/frontend/main.js b/frontend/main.js index f321fd91..f6c338b2 100644 --- a/frontend/main.js +++ b/frontend/main.js @@ -1,4 +1,5 @@ // week08/frontend/main.js +// this line to trigger frontend CI document.addEventListener('DOMContentLoaded', () => { // API endpoints for the Product and Order services.