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 }} diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml new file mode 100644 index 0000000..7ff5530 --- /dev/null +++ b/.github/workflows/pr-ci.yml @@ -0,0 +1,20 @@ +name: PR CI (basic) + +on: + pull_request: + branches: [ dev, main ] + +permissions: + contents: read + +jobs: + ci: # <-- Job ID is 'ci' to get the check name you need + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + # Tiny sanity step – replace with real unit tests later if you like + - name: Sanity check + run: | + echo "Repo: $GITHUB_REPOSITORY" + echo "PR: $GITHUB_HEAD_REF -> $GITHUB_BASE_REF" 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" 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