Skip to content

Split SBRP license scanning into separate sub-scans - #6009

Merged
mthalman merged 6 commits into
dotnet:mainfrom
mthalman:dev/mthalman/issue5470-license-scan-timeout
Apr 15, 2026
Merged

mthalman merged 6 commits into
dotnet:mainfrom
mthalman:dev/mthalman/issue5470-license-scan-timeout

Conversation

@mthalman

Copy link
Copy Markdown
Member

Split the source-build-reference-packages license scan into separate pipeline jobs - one per subdirectory under src/source-build-reference-packages/src/ plus a root scan with --ignore src for non-src content. This avoids the scancode timeout caused by processing too many files in a single run (dotnet/source-build#5470).

Fixes dotnet/source-build#5470

Split the source-build-reference-packages license scan into separate
pipeline jobs - one per subdirectory under src/source-build-reference-packages/src/
plus a root scan with --ignore src for non-src content. This avoids
the scancode timeout caused by processing too many files in a single run
(dotnet/source-build#5470).

Co-authored-by: Copilot <[email protected]>
@mthalman
mthalman requested review from a team as code owners April 14, 2026 14:22
Copilot AI review requested due to automatic review settings April 14, 2026 14:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 splits the source-build-reference-packages license scan into multiple smaller scans to avoid scancode timeouts by scanning per-subdirectory jobs plus a root scan with ignores.

Changes:

  • Update license-scan test harness to support per-scan-target baselines and optional scan ignore patterns.
  • Update the AzDO pipeline template to generate a matrix with additional sub-scan jobs and pass ignore patterns into the test run.
  • Adjust an existing license baseline JSON to reflect the new scan root/path layout.

Reviewed changes

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

Show a summary per file
File Description
test/Microsoft.DotNet.SourceBuild.Tests/assets/LicenseScanTests/Licenses.source-build-reference-packages.externalPackages.json Updates expected paths in the baseline to match the new sub-scan root.
test/Microsoft.DotNet.SourceBuild.Tests/Microsoft.DotNet.SourceBuild.Tests.csproj Passes optional ignore patterns into runtime config for tests.
test/Microsoft.DotNet.SourceBuild.Tests/LicenseScanTests.cs Adds scan-target naming logic and merges default + pipeline-provided ignore patterns; scopes exclusions per scan.
test/Microsoft.DotNet.SourceBuild.Tests/Config.cs Adds configuration access for ignore patterns.
eng/pipelines/templates/stages/vmr-license-scan.yml Builds a matrix that splits source-build-reference-packages into root + per-subdirectory scan jobs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

mthalman and others added 5 commits April 14, 2026 09:56
- Derive repoName from _relativeScanPath instead of the absolute path
  to avoid matching an earlier src/ segment in the filesystem hierarchy.
- Build scancode ignore patterns dynamically from subdirectory names
  instead of ignoring 'src' wholesale, so files directly under src/
  (e.g. SourceBuildAssemblyMetdata.cs) are still scanned by the root job.

Co-authored-by: Copilot <[email protected]>
The semicolons in the SourceBuildTestsLicenseScanIgnorePatterns value
were interpreted by bash as command separators since the script block
uses YAML folded scalar (single line). Switch to comma as the
delimiter in both the pipeline and C# code.

Co-authored-by: Copilot <[email protected]>
MSBuild interprets commas in /p: values as property separators.
Quote the entire argument so the comma-delimited list is treated
as a single property value.

Co-authored-by: Copilot <[email protected]>
Commas are special to MSBuild even when quoted on the command line.
Switch to space-delimited patterns which are safe for bash, MSBuild,
and JSON. The quoted argument ensures bash treats the space-separated
list as a single value.

Co-authored-by: Copilot <[email protected]>
@mthalman
mthalman merged commit ae664fc into dotnet:main Apr 15, 2026
11 checks passed
@mthalman
mthalman deleted the dev/mthalman/issue5470-license-scan-timeout branch April 15, 2026 17:40

# Repos whose src/ subdirectories should be scanned as separate jobs.
# The repo root is also scanned with --ignore to skip subdirectories covered by sub-scans.
splitRepos="source-build-reference-packages"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is will need to be updated once #6044 is merged. We'd also need to update the json filename in assets, for this repo.

Or, maybe I could just pull this PR into my PR instead, and make additional changes in there.

mthalman added a commit to mthalman/dotnet that referenced this pull request Apr 15, 2026
Apply the matrix sub-scanning logic from PR dotnet#6009 to the existing
vmr-license-scan.yml pipeline on release/9.0.1xx. On main, this file
lived at eng/pipelines/templates/stages/vmr-license-scan.yml (which
doesn't exist on this branch).

Co-authored-by: Copilot <[email protected]>
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.

License scanning timing out at 7 hrs for SBRP

4 participants