Skip to content

Gate test steps on setup success in CI pipeline#4141

Open
paulmedynski wants to merge 3 commits intomainfrom
dev/paul/pipeline-run-tests
Open

Gate test steps on setup success in CI pipeline#4141
paulmedynski wants to merge 3 commits intomainfrom
dev/paul/pipeline-run-tests

Conversation

@paulmedynski
Copy link
Copy Markdown
Contributor

Summary

Gate all test-run steps in the CI pipeline so they only execute when all preceding setup steps succeed, while remaining independent of each other (a failing test step does not skip sibling test steps).

Changes

eng/pipelines/common/templates/jobs/ci-run-tests-job.yml

  • Moved the x86 SDK install step before the gate (it was previously after the x64 test runs)
  • Added a gate step (Gate: Mark Setup Succeeded) that sets setupSucceeded=true after all setup completes (artifact download, SDK install, project build, SQL config, x86 SDK install)

eng/pipelines/common/templates/steps/run-all-tests-step.yml

  • Changed all 12 test step conditions from succeededOrFailed() to and(eq(variables['setupSucceeded'], 'true'), succeededOrFailed())

Behavior

Scenario Before After
Setup step fails Test steps still run (waste time, noisy failures) Test steps are skipped
Test step fails Other test steps still run Other test steps still run (unchanged)
All setup succeeds Tests run Tests run (unchanged)

Checklist

  • Tests added or updated — N/A (pipeline-only change)
  • Public API changes documented — N/A
  • Ensure no breaking changes introduced

@paulmedynski paulmedynski requested a review from a team as a code owner April 6, 2026 15:08
@paulmedynski paulmedynski added this to the 7.1.0-preview1 milestone Apr 6, 2026
Copilot AI review requested due to automatic review settings April 6, 2026 15:08
@github-project-automation github-project-automation bot moved this to To triage in SqlClient Board Apr 6, 2026
@paulmedynski paulmedynski added the Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems. label Apr 6, 2026
@paulmedynski paulmedynski moved this from To triage to In review in SqlClient Board Apr 6, 2026
@paulmedynski paulmedynski added the Hotfix 7.0.2 PRs targeting main whose changes should be backported to release/7.0 for the 7.0.2 release. label Apr 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the CI test job to run test-execution steps only when all prior setup steps completed successfully, reducing wasted runtime and noisy failures after setup errors.

Changes:

  • Adds a “setup succeeded” gate in ci-run-tests-job.yml and moves the x86 dotnet install before that gate.
  • Updates all test execution step conditions in run-all-tests-step.yml to require setupSucceeded == true while still using succeededOrFailed() to keep sibling test steps independent.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
eng/pipelines/common/templates/steps/run-all-tests-step.yml Gates all test-run tasks on setupSucceeded to skip tests when setup fails.
eng/pipelines/common/templates/jobs/ci-run-tests-job.yml Adds a gate variable setter after setup and reorders the x86 dotnet installation before tests.

… setupSucceeded

- Use pwsh instead of script for the gate step to avoid cmd.exe quote
  handling issues on Windows agents.
- Gate publish-test-results and publish-pipeline-artifact steps on
  setupSucceeded to prevent secondary errors when TestResults/ doesn't
  exist because tests were skipped.
Ensure TestResults/ exists before the gate step so publish-test-results
steps can run unconditionally (succeededOrFailed) without failing when
tests are skipped due to a setup failure.
Copilot AI review requested due to automatic review settings April 6, 2026 15:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.49%. Comparing base (60d4b92) to head (e99fc4f).
⚠️ Report is 16 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (60d4b92) and HEAD (e99fc4f). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (60d4b92) HEAD (e99fc4f)
CI-SqlClient 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4141      +/-   ##
==========================================
- Coverage   73.22%   66.49%   -6.73%     
==========================================
  Files         280      274       -6     
  Lines       43000    65785   +22785     
==========================================
+ Hits        31486    43744   +12258     
- Misses      11514    22041   +10527     
Flag Coverage Δ
CI-SqlClient ?
PR-SqlClient-Project 66.49% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems. Hotfix 7.0.2 PRs targeting main whose changes should be backported to release/7.0 for the 7.0.2 release.

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

3 participants