Skip to content

Update main.py

Update main.py #2

Workflow file for this run

name: CI Pipeline
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
id-token: write # Needed for OIDC (if enabled)
contents: read
jobs:
lint-and-validate:
name: Lint & Validate Terraform + Bicep
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
# TERRAFORM VALIDATION
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.6.3
- name: Terraform init
working-directory: terraform/
run: terraform init
- name: Terraform format check
working-directory: terraform/
run: terraform fmt -check -recursive
- name: TFLint
uses: terraform-linters/setup-tflint@v1
with:
tflint_version: latest
- name: Run tflint
working-directory: terraform/
run: tflint
- name: Terraform validate
working-directory: terraform/
run: terraform validate
# BICEP VALIDATION
- name: Install Bicep CLI
run: |
az bicep install
az bicep upgrade
- name: Bicep build
working-directory: bicep/
run: bicep build main.bicep
- name: Bicep what-if (simulated)
run: echo "Skipped: would run az deployment group what-if here"

Check failure on line 62 in .github/workflows/ci‑cd.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci‑cd.yml

Invalid workflow file

You have an error in your yaml syntax on line 62
#
# OPTIONAL: OIDC Login to Azure (commented)
#
# - name: Azure login (OIDC)
# uses: azure/login@v1
# with:
# client-id: ${{ secrets.AZURE_CLIENT_ID }}
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
terratest:
name: Terraform Integration Tests (Parallel)
runs-on: ubuntu-latest
strategy:
matrix:
region: [canadacentral, eastus2]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Simulated Terratest
run: |
echo "Running Terratest for region: ${{ matrix.region }}"
echo "(Stubbed) Would deploy to sandbox, run Go test, and destroy."
blue-green-swap:
name: Blue-Green Swap & E2E Test
runs-on: ubuntu-latest
needs: terratest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Simulate blue-green swap
run: |
echo "Simulating Traffic Manager swap: staging -> production"
# Would run something like:
# az network traffic-manager endpoint update \
# --name prod-app --profile-name traffic-prof --resource-group rg-demo \
# --type azureEndpoints --target-resource-id /subscriptions/.../aks-green \
echo "(Swap logic stubbed for showcase)"
- name: Run E2E test
id: e2e
run: |
echo "Running end-to-end health check against production endpoint..."
# Simulate test result
echo "Simulated failure"
exit 1 # force failure to trigger rollback path
- name: Rollback Traffic Manager to blue slot
if: failure() && steps.e2e.outcome == 'failure'
run: |
echo "Rolling back traffic to previous (blue) deployment"
# Would normally call:
# az network traffic-manager endpoint update --target-resource-id /aks-blue