Skip to content

Prevent scanning/signing of unrelated packages#3998

Open
samsharma2700 wants to merge 6 commits intomainfrom
dev/samsharma2700/fix_singning_packages
Open

Prevent scanning/signing of unrelated packages#3998
samsharma2700 wants to merge 6 commits intomainfrom
dev/samsharma2700/fix_singning_packages

Conversation

@samsharma2700
Copy link
Contributor

@samsharma2700 samsharma2700 commented Mar 4, 2026

Description

(Part 1 of 2) OneBranch pipeline jobs download dependency packages from previous stages into packages/, and the build also outputs newly-built NuGet packages into packages/. Since ob_outputDirectory and ESRP signing both operate on packages/ with a *.*nupkg glob, they scan, sign, and upload all packages in the directory, including ones downloaded from previous stages that were already signed.

Solution

Redirect NuGet pack output from packages/ to a new top-level output/ directory, giving each concern its own location:

  • packages/: Downloaded NuGets from previous stages (NuGet.config local feed for restore)
  • artifacts/: Intermediate build output - DLLs, PDBs (unchanged)
  • apiScan/: Signed DLLs/PDBs copied for APIScan (unchanged)
  • output/: Built .nupkg/.snupkg - ESRP NuGet signing, ob_outputDirectory, OneBranch artifact upload

Notes

This PR (Part 1) covers the OneBranch official/non-official pipelines, the ones that do ESRP signing, package validation and NuGet releases. It also covers the MSBuild build system (PackagesDir, Clean target) which is shared across both.

Part 2 will cover the CI/PR validation pipelines, the ones that build packages for testing during pull requests and continuous integration, using packagePath and ci-build-nugets-job.yml.

@samsharma2700 samsharma2700 requested a review from a team as a code owner March 4, 2026 19:28
Copilot AI review requested due to automatic review settings March 4, 2026 19:28
@github-project-automation github-project-automation bot moved this to To triage in SqlClient Board Mar 4, 2026
Copy link
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 changes the build/pipeline directory layout so OneBranch ESRP signing and OneBranch artifact publishing only operate on NuGet packages produced by the current job, avoiding re-scanning/re-signing already-signed dependency packages downloaded from earlier stages.

Changes:

  • Redirect NuGet pack output from packages/ to a new repo-root output/ directory (MSBuild + OneBranch pipeline variables/templates).
  • Update OneBranch templates to use output/ for ob_outputDirectory and default nuget pack -OutputDirectory.
  • Update cleanup and repo ignores to account for the new output/ folder.

Reviewed changes

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

Show a summary per file
File Description
src/Directory.Build.props Changes default PackagesDir to $(RepoRoot)output\ so MSBuild PackageOutputPath writes to output/.
eng/pipelines/libraries/common-variables.yml Updates PACK_OUTPUT to $(REPO_ROOT)/output and documents separation from packages/.
eng/pipelines/common/templates/steps/generate-nuget-package-step.yml Changes default outputDirectory parameter to $(Build.SourcesDirectory)/output.
eng/pipelines/common/templates/jobs/publish-nuget-package-job.yml Updates ob_outputDirectory to $(Build.SourcesDirectory)/output.
build.proj Updates Clean to delete generated *.nupkg/*.snupkg from output/ instead of packages/.
.gitignore Ignores the new output/ directory.

…amsharma2700/fix_singning_packages

# Conflicts:
#	eng/pipelines/onebranch/jobs/publish-nuget-package-job.yml
@cheenamalhotra
Copy link
Member

cheenamalhotra commented Mar 4, 2026

Can you paste link in description to a successful non-official build with this change?

@samsharma2700
Copy link
Contributor Author

@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.07%. Comparing base (3303d80) to head (cd8c910).

❗ There is a different number of reports uploaded between BASE (3303d80) and HEAD (cd8c910). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (3303d80) HEAD (cd8c910)
CI-SqlClient 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3998      +/-   ##
==========================================
- Coverage   72.33%   67.07%   -5.26%     
==========================================
  Files         287      282       -5     
  Lines       43149    67171   +24022     
==========================================
+ Hits        31211    45056   +13845     
- Misses      11938    22115   +10177     
Flag Coverage Δ
CI-SqlClient ?
PR-SqlClient-Project 67.07% <ø> (?)

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.

Copilot AI review requested due to automatic review settings March 4, 2026 23:04
Copy link
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 6 out of 7 changed files in this pull request and generated 2 comments.

@paulmedynski paulmedynski self-assigned this Mar 5, 2026
@paulmedynski paulmedynski moved this from To triage to In review in SqlClient Board Mar 5, 2026
@paulmedynski paulmedynski added this to the 7.0.0 milestone Mar 5, 2026
@paulmedynski paulmedynski added the Area\Engineering Use this for issues that are targeted for changes in the 'eng' folder or build systems. label Mar 5, 2026
@github-project-automation github-project-automation bot moved this from In review to In progress in SqlClient Board Mar 5, 2026
Copilot AI review requested due to automatic review settings March 5, 2026 16:57
Copy link
Contributor

@mdaigle mdaigle left a comment

Choose a reason for hiding this comment

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

Looks good. Will also review the unofficial pipeline run before approving.

@paulmedynski
Copy link
Contributor

The Non-Official run's artifacts look better now. Each package's artifacts only contain that package's .nuget files. Well done!

Copy link
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@samsharma2700
Copy link
Contributor Author

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.

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

5 participants