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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions .github/workflows/backend-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,30 @@ on:
inputs:
aks_cluster_name:
description: 'Name of the AKS Cluster to deploy to'
required: true
required: false
default: '<aks_cluster_name>'
aks_resource_group:
description: 'Resource Group of the AKS Cluster'
required: true
required: false
default: '<resource_group_name>'
aks_acr_name:
description: 'Name of ACR'
required: true
required: false
default: '<acr_name>'
################################################################################
workflow_run:
workflows: ["Backend CI - Test, Build and Push Images to ACR"]


types: [completed]


jobs:
deploy_backend:
runs-on: ubuntu-latest

if: ${{ github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main') }}

environment: Production

outputs:
Expand All @@ -37,11 +47,14 @@ 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 "${{ vars.AKS_RESOURCE_GROUP }}" --name "${{ vars.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 "${{ vars.AKS_CLUSTER_NAME }}" --resource-group "${{ vars.AKS_RESOURCE_GROUP }}" --attach-acr "${{ vars.ACR_NAME }}"


- name: Deploy Backend Infrastructure (Namespace, ConfigMaps, Secrets, Databases)
run: |
Expand Down Expand Up @@ -99,3 +112,5 @@ jobs:

- name: Logout from Azure
run: az logout

#Adding a line to trigger the code...
5 changes: 5 additions & 0 deletions .github/workflows/frontend_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
paths: # Only trigger if changes are in the frontend directory
- 'frontend/**'
- '.github/workflows/frontend_ci.yml' # Trigger if this workflow file changes
workflow_run:
workflows: ["CD - Deploy Backend Services to AKS"]
types: [completed]

# Define global environment variables that can be used across jobs
env:
Expand All @@ -26,6 +29,8 @@ env:
jobs:
build_and_push_frontend:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main') }}


steps:
- name: Checkout repository
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ image: <YOUR_ACR_NAME>.azurecr.io/<image_name>:<image_tag>
### 2. Update Backend Pipeline (`.github/workflows/backend-cd.yml`) & Frontend Pipeline (`.github/workflows/frontend-cd.yml`)

Ensure you replace all placeholders value to actual values.


# Adding a line to trigger the code...
2 changes: 1 addition & 1 deletion k8s/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
spec:
containers:
- name: frontend-container
image: durgeshsamariya.azurecr.io/frontend:latest
image: soorajw9cacr.azurecr.io/frontend:latest
imagePullPolicy: Always
ports:
- containerPort: 80
Expand Down
2 changes: 1 addition & 1 deletion k8s/order-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
spec:
containers:
- name: order-service-container
image: durgeshsamariya.azurecr.io/order_service:latest
image: soorajw9cacr.azurecr.io/order_service:latest
imagePullPolicy: Always
ports:
- containerPort: 8000
Expand Down
2 changes: 1 addition & 1 deletion k8s/product-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
spec:
containers:
- name: product-service-container
image: durgeshsamariya.azurecr.io/product_service:latest
image: soorajw9cacr.azurecr.io/product_service:latest
imagePullPolicy: Always
ports:
- containerPort: 8000
Expand Down
6 changes: 3 additions & 3 deletions k8s/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
# Example: echo -n 'your_storage_account_key_string' | base64
AZURE_STORAGE_ACCOUNT_KEY: "aEFNQ24rbkh2cmhwSGFEaW5jSnAxNFlHaU5nTnJja2NJR05Bc3Y5VXZPUlpsblJkbkVUR3drdTREdSszblBDR3E4ZEVTVjlFNE1jMytBU3RubmZ5QVE9PQ=="
AZURE_STORAGE_ACCOUNT_NAME: "c29vcmFqd2Vlazljc3RvcmFnZQ=="
# Example: echo -n 'your_storage_account_key_string' | base64 wq swq s
AZURE_STORAGE_ACCOUNT_KEY: "YXREN3MwRWF0TkFXbFk5ZUJkUFZqdnRYQzljS1dvZVlhN05HZkRZNkxGZjhpVDliS1g1c0g0RVBUZTVWcGovZGlLSDNPQ3JvWGtsRitBU3RlVWZaUGc9PQ=="