From 5ccc4b3f39e0898d52c615496f32b96293fc194e Mon Sep 17 00:00:00 2001 From: himanshudhaka17 Date: Fri, 26 Sep 2025 17:27:48 +1000 Subject: [PATCH 1/6] W09: baseline before branching --- example-3/k8s/order-service.yaml | 2 +- example-3/k8s/product-service.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example-3/k8s/order-service.yaml b/example-3/k8s/order-service.yaml index 867a015..aa51693 100644 --- a/example-3/k8s/order-service.yaml +++ b/example-3/k8s/order-service.yaml @@ -22,7 +22,7 @@ spec: spec: containers: - name: order-service-container - image: /order:latest + image: himanshudhakaw09acr10504.azurecr.io/backend-order:week09 imagePullPolicy: Always ports: - containerPort: 8001 diff --git a/example-3/k8s/product-service.yaml b/example-3/k8s/product-service.yaml index 52c7c28..aed8f79 100644 --- a/example-3/k8s/product-service.yaml +++ b/example-3/k8s/product-service.yaml @@ -22,7 +22,7 @@ spec: spec: containers: - name: product-service-container - image: AZURE_CONTAINER_REGISTRY/product_service:latest + image: himanshudhakaw09acr10504.azurecr.io/backend-product:week09 imagePullPolicy: Always ports: - containerPort: 8000 From fc4a88c606936392fa74a68e5bb9f6bc30d83410 Mon Sep 17 00:00:00 2001 From: himanshudhaka17 Date: Fri, 26 Sep 2025 18:26:10 +1000 Subject: [PATCH 2/6] ci: add basic reusable CI and PR workflow --- .github/workflows/pr-ci.yml | 13 +++++++++++++ .github/workflows/reusable-ci.yml | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 .github/workflows/pr-ci.yml create mode 100644 .github/workflows/reusable-ci.yml diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml new file mode 100644 index 0000000..e179b7d --- /dev/null +++ b/.github/workflows/pr-ci.yml @@ -0,0 +1,13 @@ +name: PR CI (basic) + +on: + pull_request: + branches: [dev, main] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + run-ci: + uses: ./.github/workflows/reusable-ci.yml diff --git a/.github/workflows/reusable-ci.yml b/.github/workflows/reusable-ci.yml new file mode 100644 index 0000000..7d17864 --- /dev/null +++ b/.github/workflows/reusable-ci.yml @@ -0,0 +1,13 @@ +name: reusable-ci (basic) + +on: + workflow_call: + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Sanity check + run: | + echo "✅ Reusable CI ran on $GITHUB_REF from $GITHUB_REPOSITORY" From 5a7afd6476b8647d6a00bdd3185eeba0a24be88d Mon Sep 17 00:00:00 2001 From: himanshudhaka17 Date: Fri, 26 Sep 2025 19:56:38 +1000 Subject: [PATCH 3/6] ci: Azure ACR release workflow (build & push on main) --- .github/workflows/build-and-push.yml | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/build-and-push.yml diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml new file mode 100644 index 0000000..cd99fe4 --- /dev/null +++ b/.github/workflows/build-and-push.yml @@ -0,0 +1,48 @@ +name: Build & Push Images (main) + +on: + push: + branches: [main] + workflow_dispatch: + +env: + IMAGE_TAG: ${{ github.sha }}-${{ github.run_number }} + +concurrency: + group: deploy-main + cancel-in-progress: true + +jobs: + build_and_push: + runs-on: ubuntu-latest + environment: prod + strategy: + matrix: + include: + - name: product-service + context: example-1/backend/product_Service + - name: frontend + context: example-1/frontend + + steps: + - uses: actions/checkout@v4 + + - name: Azure login + uses: azure/login@v2 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: ACR login + uses: azure/cli@v2 + with: + inlineScript: az acr login --name ${{ vars.ACR_NAME }} + + - name: Set up Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build & Push ${{ matrix.name }} + uses: docker/build-push-action@v6 + with: + context: ${{ matrix.context }} + push: true + tags: ${{ vars.ACR_LOGIN_SERVER }}/${{ matrix.name }}:${{ env.IMAGE_TAG }} From 68305192a1eb3064a11475e68fa61773f69222ad Mon Sep 17 00:00:00 2001 From: himanshudhaka17 Date: Fri, 26 Sep 2025 21:08:59 +1000 Subject: [PATCH 4/6] chore: retrigger PR CI From c11018603f35efa473548e27aa8a7b3dfbbfb404 Mon Sep 17 00:00:00 2001 From: himanshudhaka17 Date: Fri, 26 Sep 2025 21:11:39 +1000 Subject: [PATCH 5/6] chore: retrigger PR CI (clear expected status) From dc3d772e113c4edc6cf528f94c451918fd933c5a Mon Sep 17 00:00:00 2001 From: himanshudhaka17 Date: Wed, 1 Oct 2025 20:50:32 +1000 Subject: [PATCH 6/6] Update build-and-push.yml --- .github/workflows/build-and-push.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index cd99fe4..c3ceee2 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -16,6 +16,7 @@ jobs: build_and_push: runs-on: ubuntu-latest environment: prod + strategy: matrix: include: @@ -25,17 +26,22 @@ jobs: context: example-1/frontend steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 + # Log in to Azure (so az is authenticated if you ever need it) - name: Azure login uses: azure/login@v2 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - - name: ACR login - uses: azure/cli@v2 + # Docker login to your ACR (REPLACES `az acr login`) + - name: Login to ACR + uses: docker/login-action@v3 with: - inlineScript: az acr login --name ${{ vars.ACR_NAME }} + registry: ${{ vars.ACR_LOGIN_SERVER }} + username: ${{ fromJSON(secrets.AZURE_CREDENTIALS).clientId }} + password: ${{ fromJSON(secrets.AZURE_CREDENTIALS).clientSecret }} - name: Set up Buildx uses: docker/setup-buildx-action@v3 @@ -46,3 +52,4 @@ jobs: context: ${{ matrix.context }} push: true tags: ${{ vars.ACR_LOGIN_SERVER }}/${{ matrix.name }}:${{ env.IMAGE_TAG }} +