diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b8dcdf848..de7077ddf 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -197,19 +197,19 @@ - + https://github.com/dotnet/arcade - fe5cc1841d12196d94a4ae3b276cb92d8d7ca73d + 7215d8265a7fbcd022eb72ff7a6e2048444c985f - + https://github.com/dotnet/arcade - fe5cc1841d12196d94a4ae3b276cb92d8d7ca73d + 7215d8265a7fbcd022eb72ff7a6e2048444c985f - + https://github.com/dotnet/arcade - fe5cc1841d12196d94a4ae3b276cb92d8d7ca73d + 7215d8265a7fbcd022eb72ff7a6e2048444c985f https://github.com/dotnet/source-build-reference-packages diff --git a/eng/Versions.props b/eng/Versions.props index 968967e0d..2dd179319 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -19,7 +19,7 @@ - 6.0.0-beta.22107.2 + 6.0.0-beta.22122.7 diff --git a/eng/common/generate-sbom-prep.ps1 b/eng/common/generate-sbom-prep.ps1 new file mode 100644 index 000000000..a733a8885 --- /dev/null +++ b/eng/common/generate-sbom-prep.ps1 @@ -0,0 +1,19 @@ +Param( + [Parameter(Mandatory=$true)][string] $ManifestDirPath # Manifest directory where sbom will be placed +) + +Write-Host "Creating dir $ManifestDirPath" +# create directory for sbom manifest to be placed +if (!(Test-Path -path $ManifestDirPath)) +{ + New-Item -ItemType Directory -path $ManifestDirPath + Write-Host "Successfully created directory $ManifestDirPath" +} +else{ + Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." +} + +Write-Host "Updating artifact name" +$artifact_name = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" -replace '["/:<>\\|?@*"() ]', '_' +Write-Host "Artifact name $artifact_name" +Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$artifact_name" diff --git a/eng/common/generate-sbom-prep.sh b/eng/common/generate-sbom-prep.sh new file mode 100644 index 000000000..f6c774531 --- /dev/null +++ b/eng/common/generate-sbom-prep.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +manifest_dir=$1 + +if [ ! -d "$manifest_dir" ] ; then + mkdir -p "$manifest_dir" + echo "Sbom directory created." $manifest_dir +else + Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." +fi + +artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM" +echo "Artifact name before : "$artifact_name +# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts. +safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}" +echo "Artifact name after : "$safe_artifact_name +export ARTIFACT_NAME=$safe_artifact_name +echo "##vso[task.setvariable variable=ARTIFACT_NAME]$safe_artifact_name" + +exit 0 diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 30d1de583..547d878da 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -31,6 +31,10 @@ parameters: name: '' preSteps: [] runAsPublic: false +# Sbom related params + enableSbom: true + PackageVersion: 6.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' jobs: - job: ${{ parameters.name }} @@ -247,3 +251,9 @@ jobs: ArtifactName: AssetManifests continueOnError: ${{ parameters.continueOnError }} condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - template: /eng/common/templates/steps/generate-sbom.yml + parameters: + PackageVersion: ${{ parameters.packageVersion}} + BuildDropPath: ${{ parameters.buildDropPath }} diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index 70d44735a..554e71cfc 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -8,10 +8,6 @@ parameters: # Optional: Enable publishing using release pipelines enablePublishUsingPipelines: false - # Optional: Disable component governance detection. In general, component governance - # should be on for all jobs. Use only in the event of issues. - disableComponentGovernance: false - # Optional: Enable running the source-build jobs to build repo from source enableSourceBuild: false diff --git a/eng/common/templates/steps/generate-sbom.yml b/eng/common/templates/steps/generate-sbom.yml new file mode 100644 index 000000000..f4d7937f3 --- /dev/null +++ b/eng/common/templates/steps/generate-sbom.yml @@ -0,0 +1,44 @@ +# BuildDropPath - The root folder of the drop directory for which the manifest file will be generated. +# PackageName - The name of the package this SBOM represents. +# PackageVersion - The version of the package this SBOM represents. +# ManifestDirPath - The path of the directory where the generated manifest files will be placed + +parameters: + PackageVersion: 6.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + PackageName: '.NET' + ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom + sbomContinueOnError: true + +steps: +- task: PowerShell@2 + displayName: Prep for SBOM generation in (Non-linux) + condition: or(eq(variables['Agent.Os'], 'Windows_NT'), eq(variables['Agent.Os'], 'Darwin')) + inputs: + filePath: ./eng/common/generate-sbom-prep.ps1 + arguments: ${{parameters.manifestDirPath}} + +# Chmodding is a workaround for https://github.com/dotnet/arcade/issues/8461 +- script: | + chmod +x ./eng/common/generate-sbom-prep.sh + ./eng/common/generate-sbom-prep.sh ${{parameters.manifestDirPath}} + displayName: Prep for SBOM generation in (Linux) + condition: eq(variables['Agent.Os'], 'Linux') + continueOnError: ${{ parameters.sbomContinueOnError }} + +- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 + displayName: 'Generate SBOM manifest' + continueOnError: ${{ parameters.sbomContinueOnError }} + inputs: + PackageName: ${{ parameters.packageName }} + BuildDropPath: ${{ parameters.buildDropPath }} + PackageVersion: ${{ parameters.packageVersion }} + ManifestDirPath: ${{ parameters.manifestDirPath }} + +- task: PublishPipelineArtifact@1 + displayName: Publish SBOM manifest + continueOnError: ${{parameters.sbomContinueOnError}} + inputs: + targetPath: '${{parameters.manifestDirPath}}' + artifactName: $(ARTIFACT_NAME) + diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml index abb1b2bcd..ba40dc82f 100644 --- a/eng/common/templates/steps/source-build.yml +++ b/eng/common/templates/steps/source-build.yml @@ -43,8 +43,8 @@ steps: # In that case, add variables to allow the download of internal runtimes if the specified versions are not found # in the default public locations. internalRuntimeDownloadArgs= - if [ '$(dotnetbuilds-internal-container-read-token-base64)' != '$''(dotnetbuilds-internal-container-read-token-base64)' ]; then - internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://dotnetbuilds.blob.core.windows.net/internal --runtimesourcefeedkey $(dotnetbuilds-internal-container-read-token-base64)' + if [ '$(dotnetclimsrc-read-sas-token-base64)' != '$''(dotnetclimsrc-read-sas-token-base64)' ]; then + internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetclimsrc.blob.core.windows.net/dotnet /p:DotNetRuntimeSourceFeedKey=$(dotnetclimsrc-read-sas-token-base64) --runtimesourcefeed https://dotnetclimsrc.blob.core.windows.net/dotnet --runtimesourcefeedkey $(dotnetclimsrc-read-sas-token-base64)' fi buildConfig=Release diff --git a/global.json b/global.json index 8d9bc761f..8a183c7de 100644 --- a/global.json +++ b/global.json @@ -11,7 +11,7 @@ "cmake": "3.16.4" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.22107.2", - "Microsoft.DotNet.CMake.Sdk": "6.0.0-beta.22107.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.22122.7", + "Microsoft.DotNet.CMake.Sdk": "6.0.0-beta.22122.7" } } diff --git a/src/SourceBuild/tarball/patches/arcade/0005-Build-Microsoft.DotNet.Build.Tasks.Workloads-for-net.patch b/src/SourceBuild/tarball/patches/arcade/0005-Build-Microsoft.DotNet.Build.Tasks.Workloads-for-net.patch deleted file mode 100644 index b1cdb03da..000000000 --- a/src/SourceBuild/tarball/patches/arcade/0005-Build-Microsoft.DotNet.Build.Tasks.Workloads-for-net.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 3610fdc1ac6437973d539177c1427ed7f4f65c2e Mon Sep 17 00:00:00 2001 -From: Michael Simons -Date: Fri, 27 Aug 2021 13:34:55 +0000 -Subject: [PATCH] Build Microsoft.DotNet.Build.Tasks.Workloads for net6.0 - ---- - .../src/Microsoft.DotNet.Build.Tasks.Workloads.csproj | 1 + - 1 files changed, 1 insertions(+) - -diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj -index ae34705a..bda5d581 100644 ---- a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj -+++ b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj -@@ -2,6 +2,7 @@ - - - net472;netcoreapp3.1 -+ net6.0 - true - Latest - true --- -2.29.2 - diff --git a/src/SourceBuild/tarball/patches/arcade/0005-Patch-sdk.props-to-target-net6.0.patch b/src/SourceBuild/tarball/patches/arcade/0005-Patch-sdk.props-to-target-net6.0.patch deleted file mode 100644 index 5141348f2..000000000 --- a/src/SourceBuild/tarball/patches/arcade/0005-Patch-sdk.props-to-target-net6.0.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 676bb5aa455dcf877c78792e4e5a62ca6a1d72c1 Mon Sep 17 00:00:00 2001 -From: Michael Simons -Date: Wed, 8 Sep 2021 16:43:11 +0000 -Subject: [PATCH] Patch sdk.props to target net6.0 - -Workaround for https://github.com/dotnet/arcade/issues/7413 ---- - src/Microsoft.DotNet.SharedFramework.Sdk/sdk/Sdk.props | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/Microsoft.DotNet.SharedFramework.Sdk/sdk/Sdk.props b/src/Microsoft.DotNet.SharedFramework.Sdk/sdk/Sdk.props -index e3c50582..a577f923 100644 ---- a/src/Microsoft.DotNet.SharedFramework.Sdk/sdk/Sdk.props -+++ b/src/Microsoft.DotNet.SharedFramework.Sdk/sdk/Sdk.props -@@ -8,7 +8,7 @@ - --> - - -- $(MSBuildThisFileDirectory)../tools/netcoreapp3.1/ -+ $(MSBuildThisFileDirectory)../tools/net6.0/ - $(MSBuildThisFileDirectory)../tools/net472/ - - --- -2.29.2 - diff --git a/src/SourceBuild/tarball/patches/arcade/0009-Disable-Workloads-WiX-dependency-in-source-build.patch b/src/SourceBuild/tarball/patches/arcade/0009-Disable-Workloads-WiX-dependency-in-source-build.patch deleted file mode 100644 index 188312413..000000000 --- a/src/SourceBuild/tarball/patches/arcade/0009-Disable-Workloads-WiX-dependency-in-source-build.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Davis Goodin -Date: Fri, 8 Oct 2021 16:15:42 -0700 -Subject: [PATCH] Disable Workloads WiX dependency in source-build - -This removes the prebuilt WiX dependency: https://github.com/dotnet/arcade/issues/8014 - -The patch is temporary, pending upstream fix and dependency flow. ---- - .../src/{FileRow.cs => FileRow.wix.cs} | 0 - ...ifestMsi.cs => GenerateManifestMsi.wix.cs} | 0 - .../{GenerateMsi.cs => GenerateMsi.wix.cs} | 0 - ...erateMsiBase.cs => GenerateMsiBase.wix.cs} | 0 - ...erateVisualStudioMsiPackageProject.wix.cs} | 0 - ...cs => GenerateVisualStudioWorkload.wix.cs} | 0 - ...oadMsis.cs => GenerateWorkloadMsis.wix.cs} | 0 - ...rosoft.DotNet.Build.Tasks.Workloads.csproj | 23 ++++++++++++++++--- - ...{MsiProperties.cs => MsiProperties.wix.cs} | 0 - .../src/{MsiUtils.cs => MsiUtils.wix.cs} | 0 - ...elatedProduct.cs => RelatedProduct.wix.cs} | 0 - 11 files changed, 20 insertions(+), 3 deletions(-) - rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{FileRow.cs => FileRow.wix.cs} (100%) - rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{GenerateManifestMsi.cs => GenerateManifestMsi.wix.cs} (100%) - rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{GenerateMsi.cs => GenerateMsi.wix.cs} (100%) - rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{GenerateMsiBase.cs => GenerateMsiBase.wix.cs} (100%) - rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{GenerateVisualStudioMsiPackageProject.cs => GenerateVisualStudioMsiPackageProject.wix.cs} (100%) - rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{GenerateVisualStudioWorkload.cs => GenerateVisualStudioWorkload.wix.cs} (100%) - rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{GenerateWorkloadMsis.cs => GenerateWorkloadMsis.wix.cs} (100%) - rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{MsiProperties.cs => MsiProperties.wix.cs} (100%) - rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{MsiUtils.cs => MsiUtils.wix.cs} (100%) - rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{RelatedProduct.cs => RelatedProduct.wix.cs} (100%) - -diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/FileRow.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/FileRow.wix.cs -similarity index 100% -rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/FileRow.cs -rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/FileRow.wix.cs -diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateManifestMsi.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateManifestMsi.wix.cs -similarity index 100% -rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateManifestMsi.cs -rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateManifestMsi.wix.cs -diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsi.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsi.wix.cs -similarity index 100% -rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsi.cs -rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsi.wix.cs -diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsiBase.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsiBase.wix.cs -similarity index 100% -rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsiBase.cs -rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsiBase.wix.cs -diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioMsiPackageProject.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioMsiPackageProject.wix.cs -similarity index 100% -rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioMsiPackageProject.cs -rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioMsiPackageProject.wix.cs -diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioWorkload.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioWorkload.wix.cs -similarity index 100% -rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioWorkload.cs -rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioWorkload.wix.cs -diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateWorkloadMsis.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateWorkloadMsis.wix.cs -similarity index 100% -rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateWorkloadMsis.cs -rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateWorkloadMsis.wix.cs -diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj -index 19cf67b5..2d02b7f4 100644 ---- a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj -+++ b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj -@@ -11,6 +11,16 @@ - $(NoWarn);NU5127 - false - Microsoft.DotNet.Build.Tasks.Workloads -+ -+ -+ true - - - -@@ -19,13 +29,16 @@ - - - -- - -- -+ - - - -- -+ -+ -+ -+ -+ - - - -@@ -48,6 +61,10 @@ - - - -+ -+ -+ -+ - - - -diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiProperties.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiProperties.wix.cs -similarity index 100% -rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiProperties.cs -rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiProperties.wix.cs -diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiUtils.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiUtils.wix.cs -similarity index 100% -rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiUtils.cs -rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiUtils.wix.cs -diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/RelatedProduct.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/RelatedProduct.wix.cs -similarity index 100% -rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/RelatedProduct.cs -rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/RelatedProduct.wix.cs