Skip to content

Decouple diff-cover enforcement from integration test job#648

Merged
hdwhdw merged 5 commits intosonic-net:masterfrom
hdwhdw:diff-coverage
Apr 21, 2026
Merged

Decouple diff-cover enforcement from integration test job#648
hdwhdw merged 5 commits intosonic-net:masterfrom
hdwhdw:diff-coverage

Conversation

@hdwhdw
Copy link
Copy Markdown
Contributor

@hdwhdw hdwhdw commented Apr 13, 2026

Why I did it

The build job previously served double duty: running integration tests and hosting the diff-cover wrapper hook. This coupled the job displayName to the wrapper's GitHub check name (coverage.{DefinitionName}.{displayName}), preventing any renaming without breaking branch protection rules.

How I did it

  • Moved DIFF_COVER_ENABLE, DIFF_COVER_CHECK_THRESHOLD, and related variables from the integration test job to a dedicated lightweight job that only downloads coverage artifacts and hosts the wrapper decorator.
  • Renamed the integration test job from build to IntegrationTest with displayName "Integration Tests".
  • Kept the diff-cover job's displayName as build to preserve the existing wrapper check name (coverage.sonic-net.sonic-gnmi.build) and avoid branch protection changes.
  • Removed the native diff-cover --fail-under step since the wrapper handles threshold enforcement via GitHub checks.
  • Removed the unused global DIFF_COVER_THRESHOLD variable.
  • Added DIFF_COVER_COVERAGE_FILES to explicitly point the wrapper at both pure and integration coverage XML artifacts.

How to verify it

  1. The wrapper's GitHub check coverage.sonic-net.sonic-gnmi.build still appears and enforces the 80% threshold.
  2. The integration test job now shows as "Integration Tests" in the pipeline UI.
  3. All existing branch protection rules continue to work without admin changes.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Decouple diff-cover wrapper hook from integration test job, allowing the test job to be renamed independently.

Link to config_db schema for YANG module changes

N/A

A picture of a cute animal (not mandatory but encouraged)

Remove DIFF_COVER_* variables from the build job so it can be renamed
without breaking the wrapper's GitHub check name coupling. The
DiffCoverageCheck job now sets DIFF_COVER_ENABLE and related variables,
making it the sole hook point for the sonic-build-web coverage wrapper.

The native diff-cover --fail-under step is removed since the wrapper
handles threshold enforcement via GitHub checks.

Also remove the now-unused global DIFF_COVER_THRESHOLD variable.

Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
Copilot AI review requested due to automatic review settings April 13, 2026 17:26
@mssonicbld
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

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

Moves diff-coverage configuration out of the build job and into the dedicated DiffCoverageCheck job so the external coverage wrapper can rely on a single, stable job/check hook point.

Changes:

  • Removed global DIFF_COVER_THRESHOLD and the diff-cover --fail-under enforcement step.
  • Removed DIFF_COVER_* variables from the build job and added them to DiffCoverageCheck.
  • Added DIFF_COVER_COVERAGE_FILES to point the wrapper at both integration and pure coverage XML artifacts.

Comment thread azure-pipelines.yml
@hdwhdw
Copy link
Copy Markdown
Contributor Author

hdwhdw commented Apr 15, 2026

@copilot resolve the merge conflicts in this pull request

# Conflicts:
#	azure-pipelines.yml

Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Now that diff-cover enforcement is on DiffCoverageCheck, the build job
name is no longer coupled to the wrapper's GitHub check name. Rename it
to IntegrationTest to better describe what it does.

Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Reuse the 'build' job id for the diff-coverage job so the wrapper's
GitHub check name remains coverage.{DefName}.build, matching existing
branch protection rules. No admin changes needed.

Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Azure Pipelines uses displayName (not job id) for the status context
reported to GitHub. The wrapper also uses Agent.JobName which resolves
to displayName. Set it back to 'build' so both the Azure Pipelines
check (sonic-net.sonic-gnmi (Build build)) and the wrapper check
(coverage.sonic-net.sonic-gnmi.build) match existing branch protection
rules.

Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@hdwhdw hdwhdw changed the title Move diff-cover enforcement from build job to DiffCoverageCheck Decouple diff-cover enforcement from integration test job Apr 21, 2026
@hdwhdw hdwhdw enabled auto-merge (squash) April 21, 2026 14:51
@hdwhdw hdwhdw merged commit 73adaa2 into sonic-net:master Apr 21, 2026
12 checks passed
@hdwhdw hdwhdw deleted the diff-coverage branch April 21, 2026 19:21
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.

4 participants