feat: add CI/CD best-practices project for GitHub Actions to Azure Container Apps - #138
Merged
Merged
Conversation
…ntainer Apps New sample project: a minimal Express app plus a GitHub Actions pipeline demonstrating OIDC-only auth (no stored client secret or registry password), immutable commit-SHA image tags, a vulnerability scan gated before push, Dockerfile linting, remote Terraform state, a typed confirmation plus environment-approval gate before traffic shifts, a smoke test that checks the deployed commit (not just a 200), automatic rollback on smoke-test failure, and deploy concurrency control. The PR verify path and the deploy path share one definition of "passing" via a reusable workflow. Verified locally: app builds, lints, unit-tests, and runs correctly in a real Docker container; Terraform validates against the installed provider schema and resolves its full local graph via `terraform init -backend=false`; both workflow YAML files pass `actionlint` with zero findings. Not run through a real workflow_dispatch deploy — no Azure credentials or OIDC federated identity exist in this environment, matching every other Azure project in this repo.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New project:
cicd-best-practices-container-apps— a deliberately minimal Express app, and a GitHub Actions pipeline built to be an actual checklist of production deploy-pipeline practices, not just a happy-path demo:azCLI and the Terraformazurermprovider (ARM_USE_OIDC); ACR hasadmin_enabled = false, CI pushes via its own grantedAcrPushrole, the Container App pulls via its own user-assigned managed identity withAcrPull— no shared registry password.workflow_calljob, so a production deploy can never skip a check a PR would have had to pass.github.sha, never:latest."deploy"confirmation input, on top of aproductionGitHub Environment approval gate, on top ofconcurrencycontrol so deploys can't overlap.commitShamatches the commit being deployed, not just a 200 status.backend "azurerm" {}, populated via-backend-configfrom repo secrets) instead of runner-local state.What was verified locally (no Azure credentials in this environment)
app/: builds, lints (eslint), unit-tests (jest+supertest), builds as a real multi-stage Docker image, runs correctly in a container, serves/and/health, confirmed non-root (whoami→node) and confirmed test files never reach the runtime image.terraform/:fmt/validatepass;terraform init -backend=false+terraform planresolve the entire local dependency graph (including thelifecycle.ignore_changeson the container image, so app deploys andterraform applydon't fight each other) against the real installed provider schema.actionlintwith zero findings — catches expression-syntax errors and malformedwith:inputs, a stronger check than YAML-syntax validation alone.What was NOT verified (documented in the project README)
workflow_dispatchrun ofdeploy-cicd-best-practices-container-apps.yml— needs a real Azure subscription, an OIDC federated identity, and a pre-existing Terraform state storage account, none of which exist here. The project README's "Deploying for real" section is the complete setup walkthrough (OIDC app registration, state bootstrap, repo secrets,productionEnvironment).Test plan
./demo_project.shrun end-to-end (app build/lint/test/run + Terraform validate) — all greenactionlinton both new workflow files — zero findingsREADME.mdproject table updated (row 23)workflow_dispatchdeploy against an actual Azure subscription (left for whoever configures OIDC + secrets for this repo — see project README)https://claude.ai/code/session_01DgVRQrXf1xhAHKYsV2xVAQ