-
Notifications
You must be signed in to change notification settings - Fork 336
Pipelines | Validate every package the OneBranch build produces #4655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
paulmedynski
wants to merge
7
commits into
dev/paul/onebranch-version-cleanup
from
dev/paul/onebranch-validate-packages
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f586f3b
Derive APIScan versions from package versions
paulmedynski 4312fc6
Pipelines | Pre-compute all OneBranch package and file versions
paulmedynski 4e24a32
Pipelines | Validate every package the OneBranch build produces
paulmedynski de763f5
Pipelines | Disable Roslyn SDL analysis in the package validation job
paulmedynski 28c86ad
Pipelines | Fail fast on validator errors and normalize FailOn tokens
paulmedynski 73bb6c3
Pipelines | Gate package validation on dependency and strong-name fin…
paulmedynski 4df798d
Pipelines | Gate strong-name findings on every run, not just official
paulmedynski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,206 @@ | ||
| ################################################################################# | ||
| # Licensed to the .NET Foundation under one or more agreements. # | ||
| # The .NET Foundation licenses this file to you under the MIT license. # | ||
| # See the LICENSE file in the project root for more information. # | ||
| ################################################################################# | ||
|
|
||
| # Validates every NuGet package produced by this run. | ||
| # | ||
| # All packages are downloaded into a single tree and validated together in one job, rather than one | ||
| # job per package, so that PackageValidator can apply its cross-package rules: the SqlClient family | ||
| # must share a single version, and their inter-package dependency ranges must agree. | ||
| # | ||
| # The job runs on Windows because Authenticode verification has no equivalent on the Linux agents. | ||
| # PackageValidator itself is cross-platform, so only the signature checks are OS-bound. | ||
|
|
||
| parameters: | ||
| # Package Parameters ----------------------------------------------------- | ||
|
|
||
| - name: abstractionsArtifactsName | ||
| type: string | ||
|
|
||
| - name: akvProviderArtifactsName | ||
| type: string | ||
|
|
||
| - name: azureArtifactsName | ||
| type: string | ||
|
|
||
| - name: loggingArtifactsName | ||
| type: string | ||
|
|
||
| - name: sqlClientArtifactsName | ||
| type: string | ||
|
|
||
| - name: sqlServerArtifactsName | ||
| type: string | ||
|
|
||
| # Version Parameters ----------------------------------------------------- | ||
| # Pre-computed by the compute-versions stage. Validation asserts the produced packages carry | ||
| # exactly these versions, so nothing here is re-derived. | ||
|
|
||
| - name: sqlClientPackageVersion | ||
| type: string | ||
|
|
||
| - name: sqlClientFileVersion | ||
| type: string | ||
|
|
||
| - name: sqlServerPackageVersion | ||
| type: string | ||
|
|
||
| - name: sqlServerFileVersion | ||
| type: string | ||
|
|
||
| # Behaviour Parameters --------------------------------------------------- | ||
|
|
||
| # Whether Microsoft.SqlServer.Server was built this run. When false there is no SqlServer | ||
| # artifact to download and no SqlServer package in the drop to validate. | ||
| - name: buildSqlServer | ||
| type: boolean | ||
|
|
||
| # True for official builds, which sign their packages and assemblies. Signature verification is | ||
| # skipped otherwise, because non-official runs deliberately produce unsigned output. | ||
| - name: isOfficial | ||
| type: boolean | ||
|
|
||
| jobs: | ||
| - job: validate_packages | ||
| displayName: 'Validate Packages' | ||
|
|
||
| pool: | ||
| type: windows | ||
|
|
||
| # 1ES auto-injects Roslyn into any job holding a DotNetCoreCLI build task, which here is only | ||
| # the PackageValidator tool build -- never shipped, so out of SDL scope. | ||
| templateContext: | ||
| sdl: | ||
| roslyn: | ||
| enabled: false | ||
|
|
||
| variables: | ||
| - name: ob_outputDirectory | ||
| value: '$(JOB_OUTPUT)' | ||
|
|
||
| # This job inspects already-built packages and produces no assemblies, so it has nothing for | ||
| # APIScan or BinSkim to scan and no shipping component to describe in an SBOM. The build | ||
| # jobs cover all three for the packages they produce. | ||
| - name: ob_sdl_apiscan_enabled | ||
| value: false | ||
| - name: ob_sdl_binskim_enabled | ||
| value: false | ||
| - name: ob_sdl_sbom_enabled | ||
| value: false | ||
|
|
||
| # Every package artifact is downloaded beneath this root, each into its own subdirectory so | ||
| # that identically-named files from different packages cannot collide. | ||
| - name: packagesRoot | ||
| value: '$(Pipeline.Workspace)/validate-packages' | ||
|
|
||
| - name: extractRoot | ||
| value: '$(Pipeline.Workspace)/validate-extract' | ||
|
|
||
| steps: | ||
| - template: /eng/pipelines/onebranch/steps/script-output-environment-variables-step.yml@self | ||
|
|
||
| # Only the packages themselves are needed, not the full build output each artifact carries. | ||
| - task: DownloadPipelineArtifact@2 | ||
| displayName: 'Download Packages - Logging' | ||
| inputs: | ||
| artifactName: '${{ parameters.loggingArtifactsName }}' | ||
| targetPath: '$(packagesRoot)/Logging' | ||
| patterns: '**/*.*nupkg' | ||
|
|
||
| - task: DownloadPipelineArtifact@2 | ||
| displayName: 'Download Packages - Abstractions' | ||
| inputs: | ||
| artifactName: '${{ parameters.abstractionsArtifactsName }}' | ||
| targetPath: '$(packagesRoot)/Abstractions' | ||
| patterns: '**/*.*nupkg' | ||
|
|
||
| - task: DownloadPipelineArtifact@2 | ||
| displayName: 'Download Packages - SqlClient' | ||
| inputs: | ||
| artifactName: '${{ parameters.sqlClientArtifactsName }}' | ||
| targetPath: '$(packagesRoot)/SqlClient' | ||
| patterns: '**/*.*nupkg' | ||
|
|
||
| - task: DownloadPipelineArtifact@2 | ||
| displayName: 'Download Packages - Azure' | ||
| inputs: | ||
| artifactName: '${{ parameters.azureArtifactsName }}' | ||
| targetPath: '$(packagesRoot)/Azure' | ||
| patterns: '**/*.*nupkg' | ||
|
|
||
| - task: DownloadPipelineArtifact@2 | ||
| displayName: 'Download Packages - AkvProvider' | ||
| inputs: | ||
| artifactName: '${{ parameters.akvProviderArtifactsName }}' | ||
| targetPath: '$(packagesRoot)/AkvProvider' | ||
| patterns: '**/*.*nupkg' | ||
|
|
||
| - ${{ if eq(parameters.buildSqlServer, true) }}: | ||
| - task: DownloadPipelineArtifact@2 | ||
| displayName: 'Download Packages - SqlServer' | ||
| inputs: | ||
| artifactName: '${{ parameters.sqlServerArtifactsName }}' | ||
| targetPath: '$(packagesRoot)/SqlServer' | ||
| patterns: '**/*.*nupkg' | ||
|
|
||
| # PackageValidator targets net10.0, which the repo's global.json already pins. | ||
| - template: /eng/pipelines/common/steps/install-dotnet.yml@self | ||
|
|
||
| - template: /eng/pipelines/onebranch/steps/validate-packages-step.yml@self | ||
| parameters: | ||
| packagesPath: '$(packagesRoot)' | ||
| reportPath: '$(JOB_OUTPUT)/validation/package-validation.json' | ||
| sqlClientPackageVersion: '${{ parameters.sqlClientPackageVersion }}' | ||
| sqlClientFileVersion: '${{ parameters.sqlClientFileVersion }}' | ||
| # Omitted when SqlServer is not built: its package is absent from the drop, and the | ||
| # validator rejects an expectation with an empty value. | ||
| ${{ if eq(parameters.buildSqlServer, true) }}: | ||
| sqlServerPackageVersion: '${{ parameters.sqlServerPackageVersion }}' | ||
| sqlServerFileVersion: '${{ parameters.sqlServerFileVersion }}' | ||
| # The error severity covers only error-severity findings, so every warning/info category | ||
| # this job relies on must be named explicitly: missing-symbols, dependency-inconsistency | ||
| # and delay-signed are warnings, and unsigned and package-unsigned are info. | ||
| # | ||
| # Strong-name signing is unconditional in build-buildproj-step.yml, so delay-signed and | ||
| # unsigned gate on every run. NuGet package signing is ESRP and runs on official builds | ||
| # only, so package-unsigned would fire on every non-official build. | ||
| ${{ if eq(parameters.isOfficial, true) }}: | ||
| failOn: | ||
| - error | ||
| - missing-symbols | ||
| - dependency-inconsistency | ||
| - delay-signed | ||
| - unsigned | ||
| - package-unsigned | ||
| ${{ else }}: | ||
| failOn: | ||
| - error | ||
| - missing-symbols | ||
| - dependency-inconsistency | ||
| - delay-signed | ||
| - unsigned | ||
|
|
||
| # Signature verification, official builds only. PackageValidator reports strong-name and | ||
| # NuGet signature *presence* cross-platform; these steps additionally verify that the | ||
| # signatures are trusted, which requires the Windows trust store. | ||
| - ${{ if eq(parameters.isOfficial, true) }}: | ||
| - task: PowerShell@2 | ||
| displayName: 'Verify NuGet package signatures' | ||
| inputs: | ||
| targetType: filePath | ||
| pwsh: true | ||
| filePath: $(REPO_ROOT)/eng/pipelines/onebranch/scripts/verify-package-signatures.ps1 | ||
| arguments: >- | ||
| -PackagesPath "$(packagesRoot)" | ||
|
|
||
| - task: PowerShell@2 | ||
| displayName: 'Verify assembly Authenticode signatures' | ||
| inputs: | ||
| targetType: filePath | ||
| pwsh: true | ||
| filePath: $(REPO_ROOT)/eng/pipelines/onebranch/scripts/verify-assembly-signatures.ps1 | ||
| arguments: >- | ||
| -PackagesPath "$(packagesRoot)" | ||
| -ExtractPath "$(extractRoot)" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.