Skip to content

[Internal] Pipelines: Fixes fork-runnable CI#5854

Closed
NaluTripician wants to merge 4 commits into
mainfrom
feature/fork-ci-split
Closed

[Internal] Pipelines: Fixes fork-runnable CI#5854
NaluTripician wants to merge 4 commits into
mainfrom
feature/fork-ci-split

Conversation

@NaluTripician
Copy link
Copy Markdown
Contributor

Description

Follow-up to #5298 to fix the recurring pattern where fork-submitted PRs always red-X two required CI checks (EmulatorTests Release - MultiMaster, EmulatorTests Release - MultiRegion) regardless of what the PR actually changes.

Root cause

Both jobs depend on the $(COSMOSDB_MULTI_REGION) and $(COSMOSDB_MULTIMASTER) secret variables. Azure DevOps does not mount secret variables on builds triggered by pull requests from forks (security default). The connection strings arrive empty, and CosmosClient construction fails before any test logic runs.

Fix

Structurally separate live-account CI from fork-runnable CI, matching the pattern already used by azure-sdk-for-rust (sdk/cosmos/ci.yml + eng/pipelines/pullrequest.yml + archetype-sdk-client.yml if and(eq(System.TeamProject, ''internal''), eq(RunLiveTests, ''true''))), azure-sdk-for-java (cosmos-sdk-client.yml / archetype-sdk-client.yml), and azure-sdk-for-python:

  • templates/build-test.yml no longer defines or accepts live-account params or jobs. The default PR pipeline (azure-pipelines.yml) consumes only this template now and is fully fork-safe.
  • templates/build-test-live.yml (new) — contains just the MultiRegion + MultiMaster jobs, parameterized by the connection-string secrets.
  • azure-pipelines-live-account.yml (new) — on-demand top-level pipeline that invokes build-test-live.yml. pr: none so it never auto-runs on fork PRs; maintainers dispatch it on a PR with /azp run dotnet-v3-live-account.
  • azure-pipelines-official.yml and azure-pipelines-rolling.yml invoke both build-test.yml and build-test-live.yml so live coverage on the release / rolling cadences is preserved.
  • CONTRIBUTING.md gains a "How CI works for pull requests from forks" section explaining the /azp run flow contributors will see, plus a "Working on the pipeline split itself" guidance section.
  • docs/builds-and-pipelines.md gains a "Live account validation" section describing the new pipeline and a "Manual ADO setup" runbook for the one-time configuration that cannot be expressed in YAML.

Validation

  • All 6 touched/new YAML pipeline files parse cleanly with yaml.safe_load.
  • Local repro of the underlying problem (PR Fix Expression constant folding inside of MemberInitExpression #5298 unit tests) passes locally; that PR''s only test-bearing job (dotnet-v3-ci (Microsoft.Azure.Cosmos.Tests)) was already green — confirming MultiRegion/MultiMaster failures were unrelated to the change.

Required follow-up ADO + GitHub configuration (cannot be in YAML)

These steps must be performed by a repo administrator after merge (also documented in docs/builds-and-pipelines.md#manual-ado-setup):

  1. Create the ADO pipeline definition dotnet-v3-live-account in cosmos-db-sdk-public, pointing at azure-pipelines-live-account.yml.
  2. Bind the existing COSMOSDB_MULTI_REGION and COSMOSDB_MULTIMASTER secret variables to that pipeline definition.
  3. On the new pipeline''s Triggers / Pull request validation settings:
    • Build PRs from forks: ON
    • Make secrets available to builds of forks: ON
    • Require a team member''s comment before building a pull request: ON ← this is the maintainer-approval gate (/azp run dotnet-v3-live-account).
  4. Confirm dotnet-v3-ci PR-validation settings: Build PRs from forks ON, Make secrets available OFF, Require a comment OFF.
  5. Add dotnet-v3-live-account to required status checks in GitHub branch protection for main.
  6. Smoke-test with a throwaway fork PR: dotnet-v3-ci should run automatically and green; dotnet-v3-live-account should show pending until a maintainer comments /azp run dotnet-v3-live-account.

Type of change

  • CI / build pipeline change
  • Documentation update

Closing issues

Related: #5298 (and other fork PRs that hit the same red-X pattern).

The MultiRegion and MultiMaster EmulatorTests jobs were causing every
fork PR to red-X two required checks because Azure DevOps does not mount
secret variables (COSMOSDB_MULTI_REGION, COSMOSDB_MULTIMASTER) on builds
triggered by fork PRs. With the connection strings arriving empty, the
CosmosClient constructor failed before any test logic ran.

Following the same pattern used by azure-sdk-for-rust, azure-sdk-for-java,
and azure-sdk-for-python, the live-account jobs are now structurally
separated:

  * templates/build-test.yml: no longer defines or accepts live-account
    parameters. Public/fork PR pipeline (azure-pipelines.yml) consumes
    only this template now and is fully fork-safe.

  * templates/build-test-live.yml (new): contains just the two
    live-account jobs (MultiRegion, MultiMaster), parameterized by the
    connection-string secrets.

  * azure-pipelines-live-account.yml (new): on-demand top-level pipeline
    invoking build-test-live.yml. Configured (via ADO UI) to require a
    team-member /azp run comment to dispatch on fork PRs.

  * azure-pipelines-official.yml and azure-pipelines-rolling.yml now
    invoke both templates so the live-account tests still run on the
    release and rolling cadences with their existing secret access.

CONTRIBUTING.md and docs/builds-and-pipelines.md document the new layout,
the /azp run trigger for fork PRs, and the one-time ADO + GitHub
configuration steps needed before this lands on main.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good!

@NaluTripician NaluTripician changed the title Split fork-runnable CI from live-account CI (#5298 follow-up) [Internal] Pipelines: Split fork-runnable CI from live-account CI (#5298 follow-up) May 11, 2026
@NaluTripician NaluTripician changed the title [Internal] Pipelines: Split fork-runnable CI from live-account CI (#5298 follow-up) [Internal] Pipelines: Fixes fork-runnable CI May 12, 2026
NaluTripician and others added 2 commits May 14, 2026 09:56
Resolves CONTRIBUTING.md conflict by placing the new fork-CI
documentation (### How CI works for pull requests from forks,
### Working on the pipeline split itself) under ## Contribution
flow, ahead of the new ## Changelog entry section that was added
to main in PR #5864.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant