Skip to content

PR Pipeline

The PR pipeline (cicd/pr.yaml) validates code quality on every pull request. It is configured as a Build Validation policy in Azure DevOps, not via YAML triggers (trigger: none).

What It Runs

The PR pipeline runs a single code_analysis stage with all checks enabled:

  • Type checking -- pnpx turbo typecheck --affected
  • Linting -- Oxlint + ESLint (affected packages only via Turbo)
  • Formatting -- pnpm oxfmt --check
  • Unit tests -- pnpm vitest run --coverage
  • Build -- pnpm build:affected (verifies the project compiles)
  • SonarQube -- full analysis with quality gate enforcement
  • Terraform validation -- terraform init + terraform validate for all apps with infrastructure

Change Detection

The PR pipeline compares the PR source against its target branch:

yaml
TURBO_SCM_BASE: origin/$(System.PullRequest.targetBranchName)
TURBO_SCM_HEAD: $(Build.SourceVersion)

Turbo uses these variables to determine which packages are affected and only runs checks on changed code.

SonarQube

SonarQube performs static analysis and enforces quality gates. The analysis:

  • Requires a full git checkout (fetchDepth: 0) for accurate blame data
  • Caches analyzer plugins between runs (Cache@2 with version-pinned key)
  • Covers TypeScript, JavaScript, CSS, YAML, Markdown, and Dockerfiles
  • Reports code coverage from Vitest (coverage/**/lcov.info)
  • Enforces quality gate -- the PR build fails if the gate is not passed

Terraform Validation

Terraform validation runs in a separate job within the code_analysis stage. It validates infrastructure code for: api, web, match-gateway, and api-gateway.

Each app's Terraform is initialized (terraform init) and validated (terraform validate) against the tst environment backend.

Turbo Remote Cache

Build steps expose TURBO_TOKEN as an environment variable, allowing Turbo to read from and write to the remote cache. This means subsequent builds (including the release pipeline) can reuse cached build artifacts from PR runs.

Differences from Release Pipeline

AspectPR PipelineRelease Pipeline
TriggerBuild Validation (Azure DevOps)Branch/tag push
Code analysisAll checks enabledAll checks disabled (already done)
Docker buildsNoneFull Docker build and push
TerraformValidate onlyPlan + Apply
DeploymentNoneFull deployment to target env