Parts 1 and 2 split who deploys. This post is how ADO should behave before the zip hits S3: parallel jobs, artifacts, coverage that means something, triggers that respect main, and a source archive CodeBuild can actually synth.
Azure DevOps pipeline AWS handoff fails in boring ways—a 40-minute serial pipeline, 2% coverage dashboards, or a docs/ commit that ships Bedrock config to production.

In Brief
- Parallel jobs for .NET and web client; package source only after both succeed.
- Caches on NuGet and npm paths—restore keys scoped to lockfiles and csproj graphs.
- One Cobertura publish via ReportGenerator merging backend + client artifacts.
- Narrow instrumentation: Coverlet
Include/Exclude; Vitestcoverage.includeonservices/**only. - Path triggers on
src/**andinfra/**; upload stageconditiononrefs/heads/mainonly. - Optional multi-remote git: sandbox mirror vs production ADO—same Pattern A, different remotes.
Stage Graph
stage: CI (parallel)
┌──────────────┐ ┌──────────────┐
│ job: DotNet │ │ job: WebClient│
│ restore/build│ │ npm ci/build │
│ dotnet test │ │ vitest │
│ publish trx │ │ publish trx │
│ cobertura │ │ cobertura │
└──────┬───────┘ └──────┬───────┘
│ │
└────────┬────────┘
▼
┌────────────────┐
│ job: Coverage │ dependsOn: both
│ ReportGenerator│
│ single publish │
└────────┬───────┘
▼
┌────────────────┐
│ job: Package │ dependsOn: both
│ ris-source.zip │
└────────┬───────┘
▼
stage: TriggerAWS (main only)
S3 upload + start-pipeline
Serial “build everything in one job” is simpler YAML and worse wall-clock. On a document platform with gRPC backend and a Vite SPA, 25 + 15 minutes parallel beats 45 minutes stacked.
Parallel .NET Job
Goals: restore once, build Release, test with TRX + Cobertura, publish results even on partial failure.
Patterns that matter:
| Practice | Why |
|---|---|
Cache@2 on NUGET_PACKAGES under $(Pipeline.Workspace) |
Agents are ephemeral; cache is the speed win |
Cache key includes **/*.csproj and packages.lock.json |
Invalidates when dependencies change |
dotnet test with --collect:"XPlat Code Coverage" |
Standard Cobertura for ADO |
coverlet.runsettings |
Stops counting migrations, protos, test assemblies |
PublishTestResults@2 + condition: succeededOrFailed() |
PR shows failures without hiding flaky history |
Example Coverlet scope (product assemblies only):
<Include>[Adama.Ris.Backend]*,[Adama.Ris.Infrastructure]*,[Adama.Ris.Backend.Data]*</Include>
<Exclude>[*]*.Tests*,[*]*.Protos*,[*]*.Migrations*,[*]*Program</Exclude>
<ExcludeByFile>**/Migrations/**/*.cs,**/obj/**,**/bin/**</ExcludeByFile>
Without Include, you instrument the universe and wonder why coverage “improved” to 4%.
Publish Cobertura as a pipeline artifact (coverage-backend)—not PublishCodeCoverageResults in this job. One publish at the end.
Parallel Web Client Job
Goals: npm ci, production build, Vitest unit tests, Cobertura artifact for merge.
Vitest defaults will instrument every shadcn page and route if you let them. That drove ~2% line coverage on dashboards while service-layer tests were fine.
Tighten vitest.config.ts:
coverage: {
provider: 'v8',
reporter: ['text-summary', 'cobertura'],
include: ['src/services/**/*.ts'],
exclude: [
'e2e/**',
'src/components/ui/**',
'src/pages/**',
'src/main.tsx',
'src/router.tsx',
'**/*.{test,spec}.{ts,tsx}',
],
},
Rule: measure what you unit-test today; widen include when you add component tests on purpose—not by accident.
Artifact: coverage-webclient with cobertura-coverage.xml (Vitest) or equivalent.
Merged Coverage (One Tab, One Truth)
Two PublishCodeCoverageResults@2 tasks → two tabs, conflicting totals, management asks which number is real.
Fix: a small downstream job:
dependsOn: [DotNet, WebClient]withcondition: succeededOrFailed()so you still merge when one side failed (optional policy choice).- Download both artifacts.
- Run ReportGenerator on all
coverage.cobertura.xml/cobertura-coverage.xmlfiles found. - Single
PublishCodeCoverageResults@2withpathToSourceslisting both roots (backend + clientsrc).
reportgenerator \
-reports:"$REPORTS_JOINED" \
-targetdir:"$COVERAGE_MERGE_DIR" \
-reporttypes:Cobertura
Fail the job if zero reports—silent “green with no data” is worse than red.
Do not fail on empty coverage for the whole repo if you only instrument subsets (failIfCoverageEmpty: false is reasonable until thresholds are real).
Package Source (What CodePipeline Consumes)
After CI passes, a PackageSource job depends on DotNet + WebClient—not on Coverage (coverage should not block shipping fixes unless you want it to).
Script responsibilities:
git archiveor filtered zip ofsrc/,infra/cdk/, Dockerfiles, pipeline scripts- Exclude
.git, localnode_modules,bin/,obj/ - Embed
Build.SourceVersionin metadata or a small manifest inside the zip
Publish ris-source pipeline artifact. The upload stage downloads it—no second full checkout build.
Mismatch symptom: CodeBuild synth succeeds locally but fails in pipeline because the zip omitted infra/cdk/cdk.json. Treat the zip manifest as part of the contract; review it when adding new top-level folders.
Upload Stage Guardrails
trigger:
paths:
include:
- src/**
- infra/**
- infra/ado-pipelines/**
stages:
- stage: TriggerAWS
dependsOn: CI
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
| Guard | Prevents |
|---|---|
| Path filters | README-only commit → production deploy |
main condition on upload |
Feature branch experiments hitting S3 |
Explicit risEnv + awsRegion parameters |
Wrong bucket / wrong pipeline name |
S3 object metadata git-sha, ado-build-id |
“Which commit is in prod?” archaeology |
Upload task uses OIDC connection + inline script: aws s3 cp then aws codepipeline start-pipeline-execution—see part 2.
Duplicate Work: ADO vs CodeBuild
Hybrid Pattern A often runs tests in ADO and still has a BuildAndTest wave in CodePipeline during migration.
| Phase | Action |
|---|---|
| Now | Accept duplicate minutes while proving ADO parity |
| Next | Slim CodeBuild to synth-only or smoke-only |
| Target | ADO = quality gate; AWS = deploy + integration smoke |
Document the intent in your ADR so nobody “optimizes” by removing ADO tests and wonders why PRs stop catching breaks.
Multi-Remote Git (Optional Pattern)
Some teams keep:
- Production remote → Azure DevOps (Pattern A upload to prod account)
- Sandbox remote → CodeCommit or second ADO project (faster iteration)
Same repo, different push URLs. Rules:
- Never assume
git pushgoes to the environment you think—checkgit remote -v. - Sandbox pipeline names and buckets use
ris-sandbox-*, not prod prefixes. - OIDC subjects differ per service connection—do not reuse prod connection in sandbox YAML.
No customer names required; it is a workflow post, not a case study.
PR vs Main Behavior
| Event | CI jobs | Upload to AWS |
|---|---|---|
PR to main |
Run | Skip (no upload stage) |
Merge to main |
Run | Upload + start pipeline |
Optional: require merged coverage trend on PR without publishing to AWS. Keep deploy side effects on main only unless you enjoy sandbox pollution.
Checklist Before Calling Hybrid “Done”
- DotNet and WebClient jobs run in parallel with caches.
- One merged Cobertura publish; plausible percentages.
-
ris-source.zipartifact matches CodePipeline synth inputs. - Path filters +
main-only upload. - Upload uses OIDC upload role (part 2).
- CodePipeline started exactly once per zip.
- Plan to dedupe CodeBuild tests after ADO stabilizes.
Series
Series: Part 1 — Pattern A · Part 2 — OIDC & SCP · Part 3 (this)
From here, jump back to the CDK series for what happens after the zip lands: layered stacks, document pipeline deploy.
Tuning ADO pipelines or merging coverage without the theater? Connect with me.