From d16e2f7c9454ee39644d8723d8b5b0bc3a7db6f8 Mon Sep 17 00:00:00 2001 From: Parvathy Krishna Date: Thu, 18 Sep 2025 22:32:14 +1000 Subject: [PATCH 1/9] Update configuration for parvathy Azure resources --- .github/workflows/backend-cd.yml | 6 +++--- .github/workflows/frontend-cd.yml | 4 ++-- k8s/frontend.yaml | 2 +- k8s/order-service.yaml | 2 +- k8s/product-service.yaml | 2 +- k8s/secrets.yaml | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/backend-cd.yml b/.github/workflows/backend-cd.yml index 6035ed15..29bc2bd7 100644 --- a/.github/workflows/backend-cd.yml +++ b/.github/workflows/backend-cd.yml @@ -6,15 +6,15 @@ on: aks_cluster_name: description: 'Name of the AKS Cluster to deploy to' required: true - default: '' + default: 'parvathy' aks_resource_group: description: 'Resource Group of the AKS Cluster' required: true - default: '' + default: 'week8' aks_acr_name: description: 'Name of ACR' required: true - default: '' + default: 'parvathy' jobs: deploy_backend: diff --git a/.github/workflows/frontend-cd.yml b/.github/workflows/frontend-cd.yml index 0a0879c8..24fba659 100644 --- a/.github/workflows/frontend-cd.yml +++ b/.github/workflows/frontend-cd.yml @@ -18,11 +18,11 @@ on: aks_cluster_name: description: 'Name of the AKS Cluster to deploy to' required: true - default: '' + default: 'parvathy' aks_resource_group: description: 'Resource Group of the AKS Cluster' required: true - default: '<' + default: 'week8' workflow_call: inputs: diff --git a/k8s/frontend.yaml b/k8s/frontend.yaml index 1948536d..475531b0 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: parvathy.azurecr.io/frontend:latest imagePullPolicy: Always ports: - containerPort: 80 diff --git a/k8s/order-service.yaml b/k8s/order-service.yaml index c9d92e4d..24144da3 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: parvathy.azurecr.io/order_service:latest imagePullPolicy: Always ports: - containerPort: 8000 diff --git a/k8s/product-service.yaml b/k8s/product-service.yaml index 0cbbd505..ce6e84f7 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: parvathy.azurecr.io/product_service:latest imagePullPolicy: Always ports: - containerPort: 8000 diff --git a/k8s/secrets.yaml b/k8s/secrets.yaml index 5eebe1fa..b55c7c72 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: "cGFydmF0aHk=" # Example: echo -n 'your_storage_account_key_string' | base64 - AZURE_STORAGE_ACCOUNT_KEY: "aEFNQ24rbkh2cmhwSGFEaW5jSnAxNFlHaU5nTnJja2NJR05Bc3Y5VXZPUlpsblJkbkVUR3drdTREdSszblBDR3E4ZEVTVjlFNE1jMytBU3RubmZ5QVE9PQ==" + AZURE_STORAGE_ACCOUNT_KEY: "L1VwVW0wbjFyT0ZjVXpWSy9vcnBzNHB6M2xWVmhtcmpHY01HUGZlNmpkOHljcWxpVVNaVXZRWXZsMWpqK3V1WHluNmt0OCtVTmlMcStBU3RzUTFuRXc9PQ==" From c14feb3081eab3b94e12ca7ff0c2b4866d3b4f90 Mon Sep 17 00:00:00 2001 From: Parvathy Krishna Date: Thu, 18 Sep 2025 23:04:59 +1000 Subject: [PATCH 2/9] Update workflow configurations for parvathy resources --- .github/workflows/backend_ci.yml | 1 + .github/workflows/frontend-cd.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index d69725aa..76d8bc94 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -1,5 +1,6 @@ # week08/.github/workflows/backend_ci.yml + name: Backend CI - Test, Build and Push Images to ACR # Trigger the workflow on pushes to the 'main' branch diff --git a/.github/workflows/frontend-cd.yml b/.github/workflows/frontend-cd.yml index 24fba659..537e479d 100644 --- a/.github/workflows/frontend-cd.yml +++ b/.github/workflows/frontend-cd.yml @@ -1,4 +1,5 @@ # week08/.github/workflows/frontend-cd.yml +#add a command name: CD - Deploy Frontend to AKS From 819fbb054b9ac5e49afebe813b7a233b4e3cb9be Mon Sep 17 00:00:00 2001 From: Parvathy Krishna Date: Thu, 18 Sep 2025 23:59:26 +1000 Subject: [PATCH 3/9] Update IP address of each service in frontend/main.js --- frontend/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/main.js b/frontend/main.js index f321fd91..8f06f127 100644 --- a/frontend/main.js +++ b/frontend/main.js @@ -4,8 +4,8 @@ document.addEventListener('DOMContentLoaded', () => { // API endpoints for the Product and Order services. // These ports (30000 for Product, 30001 for Order) are mapped // from the Docker containers to the host machine in docker-compose.yml for Example 2. - const PRODUCT_API_BASE_URL = '_PRODUCT_API_URL_'; - const ORDER_API_BASE_URL = '_ORDER_API_URL_'; + const PRODUCT_API_BASE_URL = 'http://20.213.218.227:8000'; + const ORDER_API_BASE_URL = 'http://4.198.107.174:8001'; // Product Service is named 'product-service-w04e2' and exposes port 8000 internally. //const PRODUCT_API_BASE_URL = 'http://product-service-w04e2:8000'; From 78ceb3e62427be498dba599276f0429802bb3557 Mon Sep 17 00:00:00 2001 From: Parvathy Krishna Date: Thu, 25 Sep 2025 23:06:15 +1000 Subject: [PATCH 4/9] Test CI/CD improvements --- .github/workflows/backend-cd.yml | 3 +++ .github/workflows/backend_ci.yml | 15 +++++++++++---- .github/workflows/frontend-cd.yml | 3 +++ .github/workflows/frontend_ci.yml | 12 ++++++++++-- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/backend-cd.yml b/.github/workflows/backend-cd.yml index 29bc2bd7..c24e5aa6 100644 --- a/.github/workflows/backend-cd.yml +++ b/.github/workflows/backend-cd.yml @@ -15,6 +15,9 @@ on: description: 'Name of ACR' required: true default: 'parvathy' + push: + branches: + - main jobs: deploy_backend: diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 76d8bc94..39527341 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -13,9 +13,14 @@ on: push: branches: - main + - dev paths: # Only trigger if changes are in backend directories - 'backend/**' - '.github/workflows/backend_ci.yml' # Trigger if this workflow file changes + pull_request: + branches: + - main + - dev # Define global environment variables that can be used across jobs env: @@ -132,14 +137,16 @@ jobs: # Build and Push Docker image for Product Service - name: Build and Push Product Service Image run: | - docker build -t ${{ env.ACR_LOGIN_SERVER }}/product_service:latest ./backend/product_service/ - docker push ${{ env.ACR_LOGIN_SERVER }}/product_service:latest + docker build -t ${{ env.ACR_LOGIN_SERVER }}/product_service:${{ env.IMAGE_TAG }} ./backend/product_service/ + docker push ${{ env.ACR_LOGIN_SERVER }}/product_service:${{ env.IMAGE_TAG }} + # Build and Push Docker image for Order Service - name: Build and Push Order Service Image run: | - docker build -t ${{ env.ACR_LOGIN_SERVER }}/order_service:latest ./backend/order_service/ - docker push ${{ env.ACR_LOGIN_SERVER }}/order_service:latest + docker build -t ${{ env.ACR_LOGIN_SERVER }}/order_service:${{ env.IMAGE_TAG }} ./backend/order_service/ + docker push ${{ env.ACR_LOGIN_SERVER }}/order_service:${{ env.IMAGE_TAG }} + # Logout from Azure for security (runs even if image push fails) - name: Logout from Azure diff --git a/.github/workflows/frontend-cd.yml b/.github/workflows/frontend-cd.yml index 537e479d..2564b16a 100644 --- a/.github/workflows/frontend-cd.yml +++ b/.github/workflows/frontend-cd.yml @@ -24,6 +24,9 @@ on: description: 'Resource Group of the AKS Cluster' required: true default: 'week8' + push: + branches: + - main workflow_call: inputs: diff --git a/.github/workflows/frontend_ci.yml b/.github/workflows/frontend_ci.yml index 9f9e76d9..cf31d7f4 100644 --- a/.github/workflows/frontend_ci.yml +++ b/.github/workflows/frontend_ci.yml @@ -10,9 +10,16 @@ on: push: branches: - main + - dev + + paths: # Only trigger if changes are in the frontend directory - 'frontend/**' - '.github/workflows/frontend_ci.yml' # Trigger if this workflow file changes + pull_request: + branches: + - main + - dev # Define global environment variables that can be used across jobs env: @@ -44,8 +51,9 @@ jobs: # 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 + docker build -t ${{ env.ACR_LOGIN_SERVER }}/frontend:${{ env.IMAGE_TAG }} ./frontend + docker push ${{ env.ACR_LOGIN_SERVER }}/frontend:${{ env.IMAGE_TAG }} + # Logout from Azure for security (runs even if image push fails) - name: Logout from Azure From dc7780003d2bf20d6f2bfe90eb4372cf7295cd1b Mon Sep 17 00:00:00 2001 From: Parvathy Krishna Date: Thu, 25 Sep 2025 23:11:35 +1000 Subject: [PATCH 5/9] Test CI/CD improvements 2 --- .github/workflows/frontend_ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/frontend_ci.yml b/.github/workflows/frontend_ci.yml index cf31d7f4..b0f98cb3 100644 --- a/.github/workflows/frontend_ci.yml +++ b/.github/workflows/frontend_ci.yml @@ -59,3 +59,4 @@ jobs: - name: Logout from Azure run: az logout if: always() +#add a comment \ No newline at end of file From bd8a775d0ec03195c6da929b4cf16cc8af5b6522 Mon Sep 17 00:00:00 2001 From: Parvathy Krishna Date: Fri, 26 Sep 2025 01:43:16 +1000 Subject: [PATCH 6/9] Test change --- .github/workflows/backend-cd.yml | 41 +++++++++++----- .github/workflows/backend_ci.yml | 14 +++--- .github/workflows/ci_cd_pipeline.yml | 73 ++++++++++++++++++++++++++++ .github/workflows/frontend_ci.yml | 12 ++--- 4 files changed, 116 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/ci_cd_pipeline.yml diff --git a/.github/workflows/backend-cd.yml b/.github/workflows/backend-cd.yml index c24e5aa6..e95496d4 100644 --- a/.github/workflows/backend-cd.yml +++ b/.github/workflows/backend-cd.yml @@ -1,21 +1,40 @@ name: CD - Deploy Backend Services to AKS on: - workflow_dispatch: + workflow_call: inputs: aks_cluster_name: - description: 'Name of the AKS Cluster to deploy to' - required: true - default: 'parvathy' + required: true + type: string aks_resource_group: - description: 'Resource Group of the AKS Cluster' - required: true - default: 'week8' + required: true + type: string aks_acr_name: - description: 'Name of ACR' - required: true - default: 'parvathy' - push: + required: true + type: string + outputs: + PRODUCT_API_IP: + description: 'External IP of Product Service' + value: ${{ jobs.deploy_backend.outputs.PRODUCT_API_IP }} + ORDER_API_IP: + description: 'External IP of Order Service' + value: ${{ jobs.deploy_backend.outputs.ORDER_API_IP }} + + # workflow_dispatch: + # inputs: + # aks_cluster_name: + # description: 'Name of the AKS Cluster to deploy to' + # required: true + # default: 'parvathy' + # aks_resource_group: + # description: 'Resource Group of the AKS Cluster' + # required: true + # default: 'week8' + # aks_acr_name: + # description: 'Name of ACR' + # required: true + # default: 'parvathy' + push: branches: - main diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 39527341..5e8c21fb 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -10,17 +10,14 @@ on: workflow_dispatch: # Automatically on pushes to main branch - push: + pull_request: branches: - - main - - dev + - mainq + paths: # Only trigger if changes are in backend directories - 'backend/**' - '.github/workflows/backend_ci.yml' # Trigger if this workflow file changes - pull_request: - branches: - - main - - dev + # Define global environment variables that can be used across jobs env: @@ -147,6 +144,9 @@ jobs: docker build -t ${{ env.ACR_LOGIN_SERVER }}/order_service:${{ env.IMAGE_TAG }} ./backend/order_service/ docker push ${{ env.ACR_LOGIN_SERVER }}/order_service:${{ env.IMAGE_TAG }} + docker tag ${{ env.ACR_LOGIN_SERVER }}/order_service:${{ env.IMAGE_TAG }} ${{ env.ACR_LOGIN_SERVER }}/order_service:latest + docker push ${{ env.ACR_LOGIN_SERVER }}/order_service:latest + # Logout from Azure for security (runs even if image push fails) - name: Logout from Azure diff --git a/.github/workflows/ci_cd_pipeline.yml b/.github/workflows/ci_cd_pipeline.yml new file mode 100644 index 00000000..dfbad9f0 --- /dev/null +++ b/.github/workflows/ci_cd_pipeline.yml @@ -0,0 +1,73 @@ +name: CI/CD Pipeline - Test, Build, Deploy + +on: + push: + branches: + - main + # Only trigger CD if there are changes to application code + paths: + - 'backend/**' + - 'frontend/**' + - 'k8s/**' + - '.github/workflows/backend_ci.yml' + - '.github/workflows/frontend_ci.yml' + - '.github/workflows/backend-cd.yml' + - '.github/workflows/frontend-cd.yml' + - '.github/workflows/ci_cd_pipeline.yml' + + workflow_dispatch: + inputs: + aks_cluster_name: + description: 'Name of the AKS Cluster to deploy to' + required: true + default: 'parvathy' # REPLACE with your default + aks_resource_group: + description: 'Resource Group of the AKS Cluster' + required: true + default: 'week8' # REPLACE with your default + aks_acr_name: + description: 'Name of ACR' + required: true + default: 'parvathy' # REPLACE with your default + +jobs: + # Job 1: Run CI for both backend and frontend. Note: This assumes you've made the CI workflows callable (Step 3A). + run_ci: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Run Backend CI as a reusable workflow (assumes you have a commit with the latest code to build) + - name: Run Backend CI + uses: ./.github/workflows/backend_ci.yml + # Note: Since the backend_ci.yml now has workflow_call, this will run it. + # This will only run build and push if the underlying logic is correct. + # For a truly linked pipeline, we would call the jobs directly, or rely on the push trigger. + # Since we changed backend_ci to only run on PR, we'll revert it back to push main + # OR use a more complex setup. For simplicity, we'll keep the backend/frontend CI push triggers + # and rely on them to push :latest on merge to main. + + # Job 2: Deploy Backend + deploy_backend: + runs-on: ubuntu-latest + needs: run_ci # Deploy only if CI is successful (CI should have pushed images) + uses: ./.github/workflows/backend-cd.yml # Call the backend CD workflow as a reusable workflow + with: + aks_cluster_name: ${{ github.event.inputs.aks_cluster_name || 'parvathy' }} # Use input or default + aks_resource_group: ${{ github.event.inputs.aks_resource_group || 'week8' }} # Use input or default + aks_acr_name: ${{ github.event.inputs.aks_acr_name || 'parvathy' }} # Use input or default + secrets: inherit # Pass secrets to the called workflow + + # Job 3: Deploy Frontend + deploy_frontend: + runs-on: ubuntu-latest + needs: deploy_backend # Deploy frontend only after backend is deployed and IPs are available + uses: ./.github/workflows/frontend-cd.yml # Call the frontend CD workflow as a reusable workflow + with: + aks_cluster_name: ${{ github.event.inputs.aks_cluster_name || 'parvathy' }} + aks_resource_group: ${{ github.event.inputs.aks_resource_group || 'week8' }} + # Pass the dynamic IPs from the output of the deploy_backend job + product_api_ip: http://${{ needs.deploy_backend.outputs.PRODUCT_API_IP }}:8000 + order_api_ip: http://${{ needs.deploy_backend.outputs.ORDER_API_IP }}:8001 + secrets: inherit # Pass secrets to the called workflow \ No newline at end of file diff --git a/.github/workflows/frontend_ci.yml b/.github/workflows/frontend_ci.yml index b0f98cb3..4aefebdf 100644 --- a/.github/workflows/frontend_ci.yml +++ b/.github/workflows/frontend_ci.yml @@ -7,19 +7,16 @@ on: workflow_dispatch: # Automatically on pushes to main branch - push: + pull_request: branches: - main - - dev + paths: # Only trigger if changes are in the frontend directory - 'frontend/**' - '.github/workflows/frontend_ci.yml' # Trigger if this workflow file changes - pull_request: - branches: - - main - - dev + # Define global environment variables that can be used across jobs env: @@ -54,6 +51,9 @@ jobs: docker build -t ${{ env.ACR_LOGIN_SERVER }}/frontend:${{ env.IMAGE_TAG }} ./frontend docker push ${{ env.ACR_LOGIN_SERVER }}/frontend:${{ env.IMAGE_TAG }} + docker tag ${{ env.ACR_LOGIN_SERVER }}/frontend:${{ env.IMAGE_TAG }} ${{ env.ACR_LOGIN_SERVER }}/frontend:latest + docker push ${{ env.ACR_LOGIN_SERVER }}/frontend:latest + # Logout from Azure for security (runs even if image push fails) - name: Logout from Azure From 75a29e9e9de29d341824a350709c4ef637a5eefa Mon Sep 17 00:00:00 2001 From: Parvathy Krishna Date: Fri, 26 Sep 2025 02:31:06 +1000 Subject: [PATCH 7/9] added changes --- .github/workflows/backend-cd.yml | 5 +++- .github/workflows/backend_ci.yml | 46 ++++++++++++++++++++++++------- .github/workflows/frontend-cd.yml | 18 ++++++++++++ .github/workflows/frontend_ci.yml | 11 ++++++-- 4 files changed, 67 insertions(+), 13 deletions(-) diff --git a/.github/workflows/backend-cd.yml b/.github/workflows/backend-cd.yml index e95496d4..23522af6 100644 --- a/.github/workflows/backend-cd.yml +++ b/.github/workflows/backend-cd.yml @@ -1,4 +1,7 @@ -name: CD - Deploy Backend Services to AKS +deploy_backend_to_aks: + name: CD - Deploy Backend Services to AKS + runs-on: ubuntu-latest + environment: Production on: workflow_call: diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 5e8c21fb..0eae265c 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -6,18 +6,26 @@ 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 on: - # Manual trigger - workflow_dispatch: - - # Automatically on pushes to main branch + # # Manual trigger + # workflow_dispatch: + + # # Automatically on pushes to main branch + # pull_request: + # branches: + # - mainq + + # paths: # Only trigger if changes are in backend directories + # - 'backend/**' + # - '.github/workflows/backend_ci.yml' # Trigger if this workflow file changes + # CI TRIGGERS: Test and Build + push: + branches: [ dev ] # Run CI when we push to the development branch pull_request: - branches: - - mainq + branches: [ main ] # Also run CI when a PR is opened to main (a safety check) - paths: # Only trigger if changes are in backend directories - - 'backend/**' - - '.github/workflows/backend_ci.yml' # Trigger if this workflow file changes - + # CD TRIGGER: Deploy + push: + branches: [ main ] # Only deploy when code is pushed to the main branch (after a PR is merged) # Define global environment variables that can be used across jobs env: @@ -152,3 +160,21 @@ jobs: - name: Logout from Azure run: az logout if: always() + + # ADD THIS NEW JOB AFTER THE 'deploy_backend_to_aks' JOB + deploy_frontend_via_workflow: + name: Trigger Frontend Deployment + runs-on: ubuntu-latest + needs: deploy_backend_to_aks # This ensures it only runs if the backend deployed successfully + environment: Production + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Trigger Frontend CD Workflow + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: frontend-cd.yml # Name of the frontend CD workflow file + token: ${{ secrets.GITHUB_TOKEN }} + inputs: '{"product_api_ip": "${{ needs.deploy_backend_to_aks.outputs.PRODUCT_API_IP }}", "order_api_ip": "${{ needs.deploy_backend_to_aks.outputs.ORDER_API_IP }}", "aks_cluster_name": "parvathy", "aks_resource_group": "week8"}' diff --git a/.github/workflows/frontend-cd.yml b/.github/workflows/frontend-cd.yml index 2564b16a..6475de21 100644 --- a/.github/workflows/frontend-cd.yml +++ b/.github/workflows/frontend-cd.yml @@ -6,6 +6,24 @@ 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: + on: + # PRIMARY TRIGGER: Called by the backend deployment workflow + 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_dispatch: inputs: product_api_ip: diff --git a/.github/workflows/frontend_ci.yml b/.github/workflows/frontend_ci.yml index 4aefebdf..e15d9cd5 100644 --- a/.github/workflows/frontend_ci.yml +++ b/.github/workflows/frontend_ci.yml @@ -7,15 +7,22 @@ on: workflow_dispatch: # Automatically on pushes to main branch - pull_request: + push: branches: - - main + - development paths: # Only trigger if changes are in the frontend directory - 'frontend/**' - '.github/workflows/frontend_ci.yml' # Trigger if this workflow file changes + pull_request: + branches: + - main + paths: + - 'frontend/**' + - '.github/workflows/frontend_ci.yml' + # Define global environment variables that can be used across jobs From e266416b1d7ed316dc3b14b3def1e7413a95ce51 Mon Sep 17 00:00:00 2001 From: Parvathy Krishna Date: Fri, 26 Sep 2025 02:43:24 +1000 Subject: [PATCH 8/9] added changes --- .github/workflows/backend_ci.yml | 167 +++++++++++++++++---------- .github/workflows/ci_cd_pipeline.yml | 134 ++++++++++----------- 2 files changed, 174 insertions(+), 127 deletions(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 0eae265c..314375f7 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -1,25 +1,10 @@ -# week08/.github/workflows/backend_ci.yml +name: Backend CI/CD Pipeline - -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 +# NEW TRIGGERS: Run CI on PR to main and push to dev. Run CD only on push to main. on: - # # Manual trigger - # workflow_dispatch: - - # # Automatically on pushes to main branch - # pull_request: - # branches: - # - mainq - - # paths: # Only trigger if changes are in backend directories - # - 'backend/**' - # - '.github/workflows/backend_ci.yml' # Trigger if this workflow file changes - # CI TRIGGERS: Test and Build + # CI TRIGGERS: Test and Build push: - branches: [ dev ] # Run CI when we push to the development branch + branches: [ development ] # Run CI when we push to the development branch pull_request: branches: [ main ] # Also run CI when a PR is opened to main (a safety check) @@ -27,29 +12,23 @@ on: push: branches: [ main ] # Only deploy when code is pushed to the main branch (after a PR is merged) -# 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 }} + env: + ACR_LOGIN_SERVER: ${{ secrets.AZURE_CONTAINER_REGISTRY }} + IMAGE_TAG: ${{ github.sha }}-${{ github.run_id }} jobs: # Job 1: Run tests and linting for all backend services test_and_lint_backends: - runs-on: ubuntu-latest # Use a GitHub-hosted runner + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/development' || github.event_name == 'pull_request' services: - # Product DB container product_db: image: postgres:15 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: products - # Make pg_isready available so the service is healthy before tests run options: >- --health-cmd "pg_isready -U postgres" --health-interval 10s @@ -58,7 +37,6 @@ jobs: ports: - 5432:5432 - # Order DB order_db: image: postgres:15 env: @@ -74,29 +52,23 @@ jobs: --health-retries 5 steps: - # 1. Checkout the repository code to the runner - name: Checkout repository - uses: actions/checkout@v4 # Action to check out your repository code + uses: actions/checkout@v4 - # 2. Set up Python environment - name: Set up Python 3.10 - uses: actions/setup-python@v5 # Action to set up Python environment + uses: actions/setup-python@v5 with: python-version: '3.10' - # 3. Install dependencies and run code quality checks - name: Install dependencies - run: | # Use a multi-line script to install pip dependencies + run: | pip install --upgrade pip - # Loop through each backend service folder for req in backend/*/requirements.txt; do echo "Installing $req" pip install -r "$req" done - # Install CI tools pip install pytest httpx - # 5. Run tests for product service - name: Run product_service tests working-directory: backend/product_service env: @@ -108,7 +80,6 @@ jobs: run: | pytest tests --maxfail=1 --disable-warnings -q - # 6. Run tests for order service - name: Run order_service tests working-directory: backend/order_service env: @@ -124,48 +95,124 @@ jobs: build_and_push_images: runs-on: ubuntu-latest needs: test_and_lint_backends + if: github.event_name == 'push' && github.ref == 'refs/heads/development' || github.event_name == 'pull_request' 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 }} # Needs to be set as a GitHub Secret (Service Principal JSON) + 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 Product Service - name: Build and Push Product Service Image run: | - docker build -t ${{ env.ACR_LOGIN_SERVER }}/product_service:${{ env.IMAGE_TAG }} ./backend/product_service/ - docker push ${{ env.ACR_LOGIN_SERVER }}/product_service:${{ env.IMAGE_TAG }} - + docker build -t ${{ env.ACR_LOGIN_SERVER }}/product_service:latest ./backend/product_service/ + docker push ${{ env.ACR_LOGIN_SERVER }}/product_service:latest - # Build and Push Docker image for Order Service - name: Build and Push Order Service Image run: | - docker build -t ${{ env.ACR_LOGIN_SERVER }}/order_service:${{ env.IMAGE_TAG }} ./backend/order_service/ - docker push ${{ env.ACR_LOGIN_SERVER }}/order_service:${{ env.IMAGE_TAG }} - - docker tag ${{ env.ACR_LOGIN_SERVER }}/order_service:${{ env.IMAGE_TAG }} ${{ env.ACR_LOGIN_SERVER }}/order_service:latest + 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: Logout from Azure run: az logout if: always() - # ADD THIS NEW JOB AFTER THE 'deploy_backend_to_aks' JOB - deploy_frontend_via_workflow: + # Job 3: Deploy Backend to AKS (only runs on push to main) + deploy_backend_to_aks: + name: Deploy Backend to AKS + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + environment: Production + + outputs: + PRODUCT_API_IP: ${{ steps.get_product_ip.outputs.external_ip }} + ORDER_API_IP: ${{ steps.get_order_ip.outputs.external_ip }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to Azure + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + enable-AzPSSession: true + + - name: Set Kubernetes context + run: | + az aks get-credentials --resource-group week8 --name parvathy --overwrite-existing + + - name: Attach ACR + run: | + az aks update --name parvathy --resource-group week8 --attach-acr parvathy + + - name: Deploy Backend Infrastructure + 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 + + - name: Deploy Backend Microservices + 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 + 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}') + + 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 + done + + if [[ -z "$PRODUCT_IP" || -z "$ORDER_IP" ]]; then + echo "Error: One or more LoadBalancer IPs not assigned after timeout." + exit 1 + fi + + 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 + + # Job 4: Trigger Frontend Deployment (only runs after successful backend deployment) + trigger_frontend_deployment: name: Trigger Frontend Deployment runs-on: ubuntu-latest - needs: deploy_backend_to_aks # This ensures it only runs if the backend deployed successfully + needs: deploy_backend_to_aks + if: github.event_name == 'push' && github.ref == 'refs/heads/main' environment: Production steps: @@ -175,6 +222,6 @@ jobs: - name: Trigger Frontend CD Workflow uses: benc-uk/workflow-dispatch@v1 with: - workflow: frontend-cd.yml # Name of the frontend CD workflow file + workflow: frontend-cd.yml token: ${{ secrets.GITHUB_TOKEN }} - inputs: '{"product_api_ip": "${{ needs.deploy_backend_to_aks.outputs.PRODUCT_API_IP }}", "order_api_ip": "${{ needs.deploy_backend_to_aks.outputs.ORDER_API_IP }}", "aks_cluster_name": "parvathy", "aks_resource_group": "week8"}' + inputs: '{"product_api_ip": "${{ needs.deploy_backend_to_aks.outputs.PRODUCT_API_IP }}", "order_api_ip": "${{ needs.deploy_backend_to_aks.outputs.ORDER_API_IP }}", "aks_cluster_name": "parvathy", "aks_resource_group": "week8"}' \ No newline at end of file diff --git a/.github/workflows/ci_cd_pipeline.yml b/.github/workflows/ci_cd_pipeline.yml index dfbad9f0..b9d009e1 100644 --- a/.github/workflows/ci_cd_pipeline.yml +++ b/.github/workflows/ci_cd_pipeline.yml @@ -1,73 +1,73 @@ -name: CI/CD Pipeline - Test, Build, Deploy +# name: CI/CD Pipeline - Test, Build, Deploy -on: - push: - branches: - - main - # Only trigger CD if there are changes to application code - paths: - - 'backend/**' - - 'frontend/**' - - 'k8s/**' - - '.github/workflows/backend_ci.yml' - - '.github/workflows/frontend_ci.yml' - - '.github/workflows/backend-cd.yml' - - '.github/workflows/frontend-cd.yml' - - '.github/workflows/ci_cd_pipeline.yml' +# on: +# push: +# branches: +# - main +# # Only trigger CD if there are changes to application code +# paths: +# - 'backend/**' +# - 'frontend/**' +# - 'k8s/**' +# - '.github/workflows/backend_ci.yml' +# - '.github/workflows/frontend_ci.yml' +# - '.github/workflows/backend-cd.yml' +# - '.github/workflows/frontend-cd.yml' +# - '.github/workflows/ci_cd_pipeline.yml' - workflow_dispatch: - inputs: - aks_cluster_name: - description: 'Name of the AKS Cluster to deploy to' - required: true - default: 'parvathy' # REPLACE with your default - aks_resource_group: - description: 'Resource Group of the AKS Cluster' - required: true - default: 'week8' # REPLACE with your default - aks_acr_name: - description: 'Name of ACR' - required: true - default: 'parvathy' # REPLACE with your default +# workflow_dispatch: +# inputs: +# aks_cluster_name: +# description: 'Name of the AKS Cluster to deploy to' +# required: true +# default: 'parvathy' # REPLACE with your default +# aks_resource_group: +# description: 'Resource Group of the AKS Cluster' +# required: true +# default: 'week8' # REPLACE with your default +# aks_acr_name: +# description: 'Name of ACR' +# required: true +# default: 'parvathy' # REPLACE with your default -jobs: - # Job 1: Run CI for both backend and frontend. Note: This assumes you've made the CI workflows callable (Step 3A). - run_ci: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 +# jobs: +# # Job 1: Run CI for both backend and frontend. Note: This assumes you've made the CI workflows callable (Step 3A). +# run_ci: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout repository +# uses: actions/checkout@v4 - # Run Backend CI as a reusable workflow (assumes you have a commit with the latest code to build) - - name: Run Backend CI - uses: ./.github/workflows/backend_ci.yml - # Note: Since the backend_ci.yml now has workflow_call, this will run it. - # This will only run build and push if the underlying logic is correct. - # For a truly linked pipeline, we would call the jobs directly, or rely on the push trigger. - # Since we changed backend_ci to only run on PR, we'll revert it back to push main - # OR use a more complex setup. For simplicity, we'll keep the backend/frontend CI push triggers - # and rely on them to push :latest on merge to main. +# # Run Backend CI as a reusable workflow (assumes you have a commit with the latest code to build) +# - name: Run Backend CI +# uses: ./.github/workflows/backend_ci.yml +# # Note: Since the backend_ci.yml now has workflow_call, this will run it. +# # This will only run build and push if the underlying logic is correct. +# # For a truly linked pipeline, we would call the jobs directly, or rely on the push trigger. +# # Since we changed backend_ci to only run on PR, we'll revert it back to push main +# # OR use a more complex setup. For simplicity, we'll keep the backend/frontend CI push triggers +# # and rely on them to push :latest on merge to main. - # Job 2: Deploy Backend - deploy_backend: - runs-on: ubuntu-latest - needs: run_ci # Deploy only if CI is successful (CI should have pushed images) - uses: ./.github/workflows/backend-cd.yml # Call the backend CD workflow as a reusable workflow - with: - aks_cluster_name: ${{ github.event.inputs.aks_cluster_name || 'parvathy' }} # Use input or default - aks_resource_group: ${{ github.event.inputs.aks_resource_group || 'week8' }} # Use input or default - aks_acr_name: ${{ github.event.inputs.aks_acr_name || 'parvathy' }} # Use input or default - secrets: inherit # Pass secrets to the called workflow +# # Job 2: Deploy Backend +# deploy_backend: +# runs-on: ubuntu-latest +# needs: run_ci # Deploy only if CI is successful (CI should have pushed images) +# uses: ./.github/workflows/backend-cd.yml # Call the backend CD workflow as a reusable workflow +# with: +# aks_cluster_name: ${{ github.event.inputs.aks_cluster_name || 'parvathy' }} # Use input or default +# aks_resource_group: ${{ github.event.inputs.aks_resource_group || 'week8' }} # Use input or default +# aks_acr_name: ${{ github.event.inputs.aks_acr_name || 'parvathy' }} # Use input or default +# secrets: inherit # Pass secrets to the called workflow - # Job 3: Deploy Frontend - deploy_frontend: - runs-on: ubuntu-latest - needs: deploy_backend # Deploy frontend only after backend is deployed and IPs are available - uses: ./.github/workflows/frontend-cd.yml # Call the frontend CD workflow as a reusable workflow - with: - aks_cluster_name: ${{ github.event.inputs.aks_cluster_name || 'parvathy' }} - aks_resource_group: ${{ github.event.inputs.aks_resource_group || 'week8' }} - # Pass the dynamic IPs from the output of the deploy_backend job - product_api_ip: http://${{ needs.deploy_backend.outputs.PRODUCT_API_IP }}:8000 - order_api_ip: http://${{ needs.deploy_backend.outputs.ORDER_API_IP }}:8001 - secrets: inherit # Pass secrets to the called workflow \ No newline at end of file +# # Job 3: Deploy Frontend +# deploy_frontend: +# runs-on: ubuntu-latest +# needs: deploy_backend # Deploy frontend only after backend is deployed and IPs are available +# uses: ./.github/workflows/frontend-cd.yml # Call the frontend CD workflow as a reusable workflow +# with: +# aks_cluster_name: ${{ github.event.inputs.aks_cluster_name || 'parvathy' }} +# aks_resource_group: ${{ github.event.inputs.aks_resource_group || 'week8' }} +# # Pass the dynamic IPs from the output of the deploy_backend job +# product_api_ip: http://${{ needs.deploy_backend.outputs.PRODUCT_API_IP }}:8000 +# order_api_ip: http://${{ needs.deploy_backend.outputs.ORDER_API_IP }}:8001 +# secrets: inherit # Pass secrets to the called workflow \ No newline at end of file From f731eec726d66f9dbda020fc0ab0a5a7d577548e Mon Sep 17 00:00:00 2001 From: Parvathy Krishna Date: Fri, 26 Sep 2025 03:37:20 +1000 Subject: [PATCH 9/9] added changes --- .github/workflows/backend_ci.yml | 132 ++---------------------------- .github/workflows/frontend-cd.yml | 42 ++-------- 2 files changed, 12 insertions(+), 162 deletions(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 314375f7..95a5c0c5 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -1,133 +1,17 @@ -name: Backend CI/CD Pipeline +name: Backend CD - Deploy to AKS -# NEW TRIGGERS: Run CI on PR to main and push to dev. Run CD only on push to main. +# Only deploy when code is pushed to main branch on: - # CI TRIGGERS: Test and Build push: - branches: [ development ] # Run CI when we push to the development branch - pull_request: - branches: [ main ] # Also run CI when a PR is opened to main (a safety check) - - # CD TRIGGER: Deploy - push: - branches: [ main ] # Only deploy when code is pushed to the main branch (after a PR is merged) - - env: - ACR_LOGIN_SERVER: ${{ secrets.AZURE_CONTAINER_REGISTRY }} - IMAGE_TAG: ${{ github.sha }}-${{ github.run_id }} + branches: [ main ] + paths: + - 'backend/**' + - 'k8s/**' + - '.github/workflows/backend-cd.yml' jobs: - # Job 1: Run tests and linting for all backend services - test_and_lint_backends: - runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/development' || github.event_name == 'pull_request' - - services: - product_db: - image: postgres:15 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: products - options: >- - --health-cmd "pg_isready -U postgres" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - - order_db: - image: postgres:15 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: orders - ports: - - 5433:5432 - options: >- - --health-cmd "pg_isready -U postgres" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - - name: Install dependencies - run: | - pip install --upgrade pip - for req in backend/*/requirements.txt; do - echo "Installing $req" - pip install -r "$req" - done - pip install pytest httpx - - - name: Run product_service tests - working-directory: backend/product_service - env: - POSTGRES_HOST: localhost - POSTGRES_PORT: 5432 - POSTGRES_DB: products - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - run: | - pytest tests --maxfail=1 --disable-warnings -q - - - name: Run order_service tests - working-directory: backend/order_service - env: - POSTGRES_HOST: localhost - POSTGRES_PORT: 5433 - POSTGRES_DB: orders - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - run: | - pytest tests --maxfail=1 --disable-warnings -q - - # Job 2: Build and Push Docker Images (runs only if tests pass) - build_and_push_images: - runs-on: ubuntu-latest - needs: test_and_lint_backends - if: github.event_name == 'push' && github.ref == 'refs/heads/development' || github.event_name == 'pull_request' - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Azure Login - uses: azure/login@v1 - with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - name: Login to Azure Container Registry - run: az acr login --name ${{ env.ACR_LOGIN_SERVER }} - - - name: Build and Push Product Service Image - run: | - docker build -t ${{ env.ACR_LOGIN_SERVER }}/product_service:latest ./backend/product_service/ - docker push ${{ env.ACR_LOGIN_SERVER }}/product_service:latest - - - name: Build and Push Order Service Image - run: | - docker build -t ${{ env.ACR_LOGIN_SERVER }}/order_service:latest ./backend/order_service/ - docker push ${{ env.ACR_LOGIN_SERVER }}/order_service:latest - - - name: Logout from Azure - run: az logout - if: always() - - # Job 3: Deploy Backend to AKS (only runs on push to main) deploy_backend_to_aks: - name: Deploy Backend to AKS runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/main' environment: Production outputs: @@ -207,12 +91,10 @@ jobs: - name: Logout from Azure run: az logout - # Job 4: Trigger Frontend Deployment (only runs after successful backend deployment) trigger_frontend_deployment: name: Trigger Frontend Deployment runs-on: ubuntu-latest needs: deploy_backend_to_aks - if: github.event_name == 'push' && github.ref == 'refs/heads/main' environment: Production steps: diff --git a/.github/workflows/frontend-cd.yml b/.github/workflows/frontend-cd.yml index 6475de21..175638f1 100644 --- a/.github/workflows/frontend-cd.yml +++ b/.github/workflows/frontend-cd.yml @@ -1,13 +1,6 @@ -# week08/.github/workflows/frontend-cd.yml -#add a command - 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: - on: - # PRIMARY TRIGGER: Called by the backend deployment workflow workflow_call: inputs: product_api_ip: @@ -23,7 +16,6 @@ on: required: true type: string - workflow_dispatch: inputs: product_api_ip: @@ -31,35 +23,17 @@ on: required: true default: 'http://:8000' order_api_ip: - description: 'External IP of Order Service (e.g., http://Y.Y.Y.Y:8001)' + description: 'External IP of Order Service' required: true default: 'http://:8001' aks_cluster_name: - description: 'Name of the AKS Cluster to deploy to' + description: 'Name of the AKS Cluster' required: true default: 'parvathy' aks_resource_group: description: 'Resource Group of the AKS Cluster' required: true default: 'week8' - push: - branches: - - main - - 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 jobs: deploy_frontend: @@ -70,35 +44,30 @@ 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 ---" 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 }} @@ -108,8 +77,7 @@ jobs: 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: Logout from Azure + run: az logout \ No newline at end of file