From e92156e3ff8b0d3ade94af68331c3684b842ffd1 Mon Sep 17 00:00:00 2001 From: dkurepa Date: Mon, 25 Mar 2024 12:54:26 +0100 Subject: [PATCH] Revert "Remove prepare-artifacts.proj (#4251)" This reverts commit bccc0807fc7f4d53a5aed6823cbe728475b36945. --- azure-pipelines-PR.yml | 12 +- azure-pipelines.yml | 22 +- build.cmd | 2 +- eng/AfterSigning.targets | 19 -- eng/Publishing.props | 67 +---- eng/Signing.props | 29 ++ eng/Versions.props | 2 + .../jobs/prepare-signed-artifacts-PR.yml | 50 ++++ .../jobs/prepare-signed-artifacts.yml | 55 ++++ eng/pipelines/jobs/windows-build-PR.yml | 39 +-- eng/pipelines/jobs/windows-build.yml | 48 +--- .../steps/upload-job-artifacts-PR.yml | 35 +++ eng/pipelines/steps/upload-job-artifacts.yml | 39 +++ src/publish/prepare-artifacts.proj | 255 ++++++++++++++++++ .../tests/NuGetArtifactTester.cs | 5 + 15 files changed, 519 insertions(+), 160 deletions(-) delete mode 100644 eng/AfterSigning.targets create mode 100644 eng/pipelines/jobs/prepare-signed-artifacts-PR.yml create mode 100644 eng/pipelines/jobs/prepare-signed-artifacts.yml create mode 100644 eng/pipelines/steps/upload-job-artifacts-PR.yml create mode 100644 eng/pipelines/steps/upload-job-artifacts.yml create mode 100644 src/publish/prepare-artifacts.proj diff --git a/azure-pipelines-PR.yml b/azure-pipelines-PR.yml index 98ae82ca1..ea66325f3 100644 --- a/azure-pipelines-PR.yml +++ b/azure-pipelines-PR.yml @@ -20,6 +20,15 @@ variables: # Skip Running CI tests - name: SkipTests value: false + # Set Official Build Id + - name: OfficialBuildId + value: $(Build.BuildNumber) + - ${{ if or(startswith(variables['Build.SourceBranch'], 'refs/heads/release/'), startswith(variables['Build.SourceBranch'], 'refs/heads/internal/release/'), eq(variables['Build.Reason'], 'Manual')) }}: + - name: PostBuildSign + value: false + - ${{ else }}: + - name: PostBuildSign + value: true # Set the target blob feed for package publish during official and validation builds. - name: _DotNetArtifactsCategory @@ -39,19 +48,16 @@ stages: - template: /eng/pipelines/jobs/windows-build-PR.yml parameters: name: win_x64 - displayName: win-x64 targetArchitecture: x64 # Windows x86 - template: /eng/pipelines/jobs/windows-build-PR.yml parameters: name: win_x86 - displayName: win-x86 targetArchitecture: x86 # Windows arm64 - template: /eng/pipelines/jobs/windows-build-PR.yml parameters: name: win_arm64 - displayName: win-arm64 targetArchitecture: arm64 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c45506627..9e541cf28 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -14,7 +14,7 @@ variables: value: dotnet-core-acquisition # Skip Running CI tests - name: SkipTests - value: true + value: false # Set Official Build Id - name: OfficialBuildId value: $(Build.BuildNumber) @@ -60,32 +60,34 @@ extends: - template: /eng/pipelines/jobs/windows-build.yml@self parameters: name: win_x64 - displayName: win-x64 targetArchitecture: x64 # Windows x86 - template: /eng/pipelines/jobs/windows-build.yml@self parameters: name: win_x86 - displayName: win-x86 targetArchitecture: x86 # Windows arm64 - template: /eng/pipelines/jobs/windows-build.yml@self parameters: name: win_arm64 - displayName: win-arm64 targetArchitecture: arm64 + - stage: PrepareForPublish + displayName: Prepare for Publish + dependsOn: Build + jobs: + # Prep artifacts: sign them and upload pipeline artifacts expected by stages-based publishing. + - template: /eng/pipelines/jobs/prepare-signed-artifacts.yml@self + parameters: + PublishRidAgnosticPackagesFromJobName: win_x64 # Publish to Build Asset Registry in order to generate the ReleaseConfigs artifact. - template: /eng/common/templates-official/job/publish-build-assets.yml@self parameters: publishUsingPipelines: true publishAssetsImmediately: true - dependsOn: - - win_x64 - - win_x86 - - win_arm64 + dependsOn: PrepareSignedArtifacts pool: name: NetCore1ESPool-Internal demands: ImageOverride -equals windows.vs2022preview.amd64 @@ -93,11 +95,15 @@ extends: # Stages-based publishing entry point - template: /eng/common/templates-official/post-build/post-build.yml@self parameters: + publishingInfraVersion: 3 + validateDependsOn: + - PrepareForPublish enableSymbolValidation: false enableSigningValidation: false enableNugetValidation: false enableSourceLinkValidation: false publishAssetsImmediately: true + SDLValidationParameters: enable: false params: >- diff --git a/build.cmd b/build.cmd index 675fdf83f..79d95dc5b 100644 --- a/build.cmd +++ b/build.cmd @@ -1,2 +1,2 @@ @echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore -build %*" +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore -build -bl %*" diff --git a/eng/AfterSigning.targets b/eng/AfterSigning.targets deleted file mode 100644 index af21b1072..000000000 --- a/eng/AfterSigning.targets +++ /dev/null @@ -1,19 +0,0 @@ - - - - <_SuppressSdkImports>false - - - - - - - - - - - \ No newline at end of file diff --git a/eng/Publishing.props b/eng/Publishing.props index 2e352a8e8..83454c779 100644 --- a/eng/Publishing.props +++ b/eng/Publishing.props @@ -2,44 +2,20 @@ true - - false - - false - + - - - - - - - - - - - - - - - + Condition="'$(DotNetBuildRepo)' == 'true'"> + - + - - - - - - - - - - - - - - - - - - - - - + RelativeBlobPath="WindowsDesktop/$(WindowsDesktopRuntimePackProductVersion)/%(Filename)%(Extension)" /> diff --git a/eng/Signing.props b/eng/Signing.props index 9aff13e33..454ba3279 100644 --- a/eng/Signing.props +++ b/eng/Signing.props @@ -1,11 +1,40 @@ + + true true + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/Versions.props b/eng/Versions.props index d651d2a03..15ab62f16 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -11,8 +11,10 @@ + 9.0.0-beta.24168.1 9.0.0-beta.24168.1 9.0.0-beta.24168.1 + 9.0.0-beta.24168.1 4.5.0 4.8.6 diff --git a/eng/pipelines/jobs/prepare-signed-artifacts-PR.yml b/eng/pipelines/jobs/prepare-signed-artifacts-PR.yml new file mode 100644 index 000000000..5a4150fcd --- /dev/null +++ b/eng/pipelines/jobs/prepare-signed-artifacts-PR.yml @@ -0,0 +1,50 @@ +parameters: + dependsOn: [] + PublishRidAgnosticPackagesFromJobName: '' + +jobs: +- job: PrepareSignedArtifacts + displayName: Prepare Signed Artifacts + dependsOn: ${{ parameters.dependsOn }} + pool: + name: NetCore1ESPool-Svc-Internal + demands: ImageOverride -equals windows.vs2019.amd64 + # Double the default timeout. + timeoutInMinutes: 120 + workspace: + clean: all + + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download IntermediateUnsignedArtifacts + inputs: + artifactName: IntermediateUnsignedArtifacts + downloadPath: $(Build.SourcesDirectory)\artifacts\PackageDownload + + - script: > + build.cmd -ci + -projects $(Build.SourcesDirectory)\src\publish\prepare-artifacts.proj + -c Release + /p:PublishRidAgnosticPackagesFromJobName=${{ parameters.PublishRidAgnosticPackagesFromJobName }} + /p:SignType=$(SignType) + /p:DotNetSignType=$(SignType) + /bl:$(Build.SourcesDirectory)\prepare-artifacts.binlog + displayName: Prepare artifacts and upload to build + + - task: CopyFiles@2 + displayName: Copy Files to $(Build.StagingDirectory)\BuildLogs + inputs: + SourceFolder: '$(Build.SourcesDirectory)' + Contents: | + **/*.log + **/*.binlog + TargetFolder: '$(Build.StagingDirectory)\BuildLogs' + continueOnError: true + condition: succeededOrFailed() + + - task: PublishBuildArtifacts@1 + displayName: Publish Artifact BuildLogs + inputs: + PathtoPublish: '$(Build.StagingDirectory)\BuildLogs' + ArtifactName: Logs-PrepareSignedArtifacts + condition: succeededOrFailed() \ No newline at end of file diff --git a/eng/pipelines/jobs/prepare-signed-artifacts.yml b/eng/pipelines/jobs/prepare-signed-artifacts.yml new file mode 100644 index 000000000..d2349feea --- /dev/null +++ b/eng/pipelines/jobs/prepare-signed-artifacts.yml @@ -0,0 +1,55 @@ +parameters: + dependsOn: [] + PublishRidAgnosticPackagesFromJobName: '' + +jobs: +- job: PrepareSignedArtifacts + displayName: Prepare Signed Artifacts + dependsOn: ${{ parameters.dependsOn }} + # Double the default timeout. + timeoutInMinutes: 120 + workspace: + clean: all + + templateContext: + outputs: + - output: pipelineArtifact + displayName: 'Publish Artifact BuildLogs' + condition: succeededOrFailed() + targetPath: '$(Build.StagingDirectory)\BuildLogs' + artifactName: Logs-PrepareSignedArtifacts + steps: + - task: NuGetAuthenticate@1 + - task: MicroBuildSigningPlugin@2 + displayName: Install MicroBuild plugin for Signing + inputs: + signType: $(SignType) + zipSources: false + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + condition: and(succeeded(), in(variables['SignType'], 'real', 'test')) + - task: DownloadBuildArtifacts@0 + displayName: Download IntermediateUnsignedArtifacts + inputs: + artifactName: IntermediateUnsignedArtifacts + downloadPath: $(Build.SourcesDirectory)\artifacts\PackageDownload + + - script: > + build.cmd -ci + -projects $(Build.SourcesDirectory)\src\publish\prepare-artifacts.proj + -c Release + /p:PublishRidAgnosticPackagesFromJobName=${{ parameters.PublishRidAgnosticPackagesFromJobName }} + /p:SignType=$(SignType) + /p:DotNetSignType=$(SignType) + /bl:$(Build.SourcesDirectory)\prepare-artifacts.binlog + displayName: Prepare artifacts and upload to build + + - task: CopyFiles@2 + displayName: Copy Files to $(Build.StagingDirectory)\BuildLogs + inputs: + SourceFolder: '$(Build.SourcesDirectory)' + Contents: | + **/*.log + **/*.binlog + TargetFolder: '$(Build.StagingDirectory)\BuildLogs' + continueOnError: true + condition: succeededOrFailed() \ No newline at end of file diff --git a/eng/pipelines/jobs/windows-build-PR.yml b/eng/pipelines/jobs/windows-build-PR.yml index 7644ec11c..2d7ea07b5 100644 --- a/eng/pipelines/jobs/windows-build-PR.yml +++ b/eng/pipelines/jobs/windows-build-PR.yml @@ -11,7 +11,7 @@ jobs: timeoutInMinutes: ${{ parameters.timeoutInMinutes }} pool: # Use a hosted pool when possible. - vmImage: 'windows-2022' + vmImage: 'windows-2019' strategy: matrix: Debug: @@ -24,6 +24,7 @@ jobs: - name: CommonMSBuildArgs value: >- -c $(_BuildConfig) + /p:OfficialBuildId=$(OfficialBuildId) /p:TargetArchitecture=${{ parameters.targetArchitecture }} /p:SkipTests=${{ parameters.skipTests }} - name: MsbuildSigningArguments @@ -40,40 +41,12 @@ jobs: displayName: Clear NuGet http cache (if exists) - script: >- - eng/common/cibuild.cmd + build.cmd -ci -test $(CommonMSBuildArgs) $(MsbuildSigningArguments) $(_InternalRuntimeDownloadArgs) displayName: Build - - ${{ if ne(parameters.skipTests, 'true') }}: - - task: PublishTestResults@2 - displayName: Publish Test Results - inputs: - testResultsFormat: 'xUnit' - testResultsFiles: '*.xml' - searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' - mergeTestResults: true - testRunTitle: ${{ parameters.name }}-$(_BuildConfig) - continueOnError: true - condition: always() - - - task: CopyFiles@2 - displayName: Prepare BuildLogs staging directory - inputs: - SourceFolder: '$(Build.SourcesDirectory)' - Contents: | - **/*.log - **/*.binlog - TargetFolder: '$(Build.StagingDirectory)/BuildLogs' - CleanTargetFolder: true - continueOnError: true - condition: succeededOrFailed() - - - task: PublishBuildArtifacts@1 - displayName: Publish BuildLogs - inputs: - PathtoPublish: '$(Build.StagingDirectory)/BuildLogs' - ArtifactName: Logs-${{ parameters.name }}-$(_BuildConfig) - continueOnError: true - condition: succeededOrFailed() \ No newline at end of file + - template: /eng/pipelines/steps/upload-job-artifacts-PR.yml + parameters: + name: ${{ parameters.name }} \ No newline at end of file diff --git a/eng/pipelines/jobs/windows-build.yml b/eng/pipelines/jobs/windows-build.yml index 69a3137d3..90740c90c 100644 --- a/eng/pipelines/jobs/windows-build.yml +++ b/eng/pipelines/jobs/windows-build.yml @@ -11,6 +11,8 @@ jobs: timeoutInMinutes: ${{ parameters.timeoutInMinutes }} strategy: matrix: + Debug: + _BuildConfig: Debug Release: _BuildConfig: Release workspace: @@ -20,7 +22,6 @@ jobs: value: >- -c $(_BuildConfig) /p:OfficialBuildId=$(OfficialBuildId) - /p:DotNetPublishUsingPipelines=true /p:TargetArchitecture=${{ parameters.targetArchitecture }} /p:SkipTests=${{ parameters.skipTests }} - name: MsbuildSigningArguments @@ -35,6 +36,12 @@ jobs: templateContext: outputs: + - output: buildArtifacts + displayName: 'Publish Artifacts' + condition: and(succeeded(), eq(variables._BuildConfig, 'Release')) + PathtoPublish: '$(Build.StagingDirectory)/Artifacts' + ArtifactName: IntermediateUnsignedArtifacts + ArtifactType: container - output: pipelineArtifact displayName: 'Publish BuildLogs' condition: succeededOrFailed() @@ -65,7 +72,7 @@ jobs: displayName: Clear NuGet http cache (if exists) - script: >- - eng/common/cibuild.cmd + build.cmd -ci -test $(CommonMSBuildArgs) $(MsbuildSigningArguments) $(_InternalRuntimeDownloadArgs) @@ -76,37 +83,6 @@ jobs: parameters: name: Generate_SBOM_${{ parameters.name }} - # Upload build outputs as build artifacts. - - task: CopyFiles@2 - displayName: Prepare job-specific Artifacts subdirectory - inputs: - SourceFolder: '$(Build.SourcesDirectory)/artifacts/packages/$(_BuildConfig)' - Contents: | - Shipping/**/* - NonShipping/**/* - TargetFolder: '$(Build.StagingDirectory)/Artifacts/${{ parameters.name }}' - CleanTargetFolder: true - condition: and(succeeded(), eq(variables._BuildConfig, 'Release')) - - - ${{ if ne(parameters.skipTests, 'true') }}: - - task: PublishTestResults@2 - displayName: Publish Test Results - inputs: - testResultsFormat: 'xUnit' - testResultsFiles: '*.xml' - searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' - mergeTestResults: true - testRunTitle: ${{ parameters.name }}-$(_BuildConfig) - continueOnError: true - - - task: CopyFiles@2 - displayName: Prepare BuildLogs staging directory - inputs: - SourceFolder: '$(Build.SourcesDirectory)' - Contents: | - **/*.log - **/*.binlog - TargetFolder: '$(Build.StagingDirectory)/BuildLogs' - CleanTargetFolder: true - continueOnError: true - condition: succeededOrFailed() \ No newline at end of file + - template: /eng/pipelines/steps/upload-job-artifacts.yml@self + parameters: + name: ${{ parameters.name }} \ No newline at end of file diff --git a/eng/pipelines/steps/upload-job-artifacts-PR.yml b/eng/pipelines/steps/upload-job-artifacts-PR.yml new file mode 100644 index 000000000..83cfaea11 --- /dev/null +++ b/eng/pipelines/steps/upload-job-artifacts-PR.yml @@ -0,0 +1,35 @@ +parameters: + name: '' + +steps: +# Always upload test outputs and build logs. +- task: PublishTestResults@2 + displayName: Publish Test Results + inputs: + testResultsFormat: 'xUnit' + testResultsFiles: '*.xml' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + mergeTestResults: true + testRunTitle: ${{ parameters.name }}-$(_BuildConfig) + continueOnError: true + condition: always() + +- task: CopyFiles@2 + displayName: Prepare BuildLogs staging directory + inputs: + SourceFolder: '$(Build.SourcesDirectory)' + Contents: | + **/*.log + **/*.binlog + TargetFolder: '$(Build.StagingDirectory)/BuildLogs' + CleanTargetFolder: true + continueOnError: true + condition: succeededOrFailed() + +- task: PublishBuildArtifacts@1 + displayName: Publish BuildLogs + inputs: + PathtoPublish: '$(Build.StagingDirectory)/BuildLogs' + ArtifactName: Logs-${{ parameters.name }}-$(_BuildConfig) + continueOnError: true + condition: succeededOrFailed() \ No newline at end of file diff --git a/eng/pipelines/steps/upload-job-artifacts.yml b/eng/pipelines/steps/upload-job-artifacts.yml new file mode 100644 index 000000000..368969596 --- /dev/null +++ b/eng/pipelines/steps/upload-job-artifacts.yml @@ -0,0 +1,39 @@ +parameters: + name: '' + +steps: +# Upload build outputs as build artifacts. +- task: CopyFiles@2 + displayName: Prepare job-specific Artifacts subdirectory + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/packages/$(_BuildConfig)' + Contents: | + Shipping/**/* + NonShipping/**/* + TargetFolder: '$(Build.StagingDirectory)/Artifacts/${{ parameters.name }}' + CleanTargetFolder: true + condition: and(succeeded(), eq(variables._BuildConfig, 'Release')) + +# Always upload test outputs and build logs. +- task: PublishTestResults@2 + displayName: Publish Test Results + inputs: + testResultsFormat: 'xUnit' + testResultsFiles: '*.xml' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + mergeTestResults: true + testRunTitle: ${{ parameters.name }}-$(_BuildConfig) + continueOnError: true + condition: always() + +- task: CopyFiles@2 + displayName: Prepare BuildLogs staging directory + inputs: + SourceFolder: '$(Build.SourcesDirectory)' + Contents: | + **/*.log + **/*.binlog + TargetFolder: '$(Build.StagingDirectory)/BuildLogs' + CleanTargetFolder: true + continueOnError: true + condition: succeededOrFailed() \ No newline at end of file diff --git a/src/publish/prepare-artifacts.proj b/src/publish/prepare-artifacts.proj new file mode 100644 index 000000000..dc8c18933 --- /dev/null +++ b/src/publish/prepare-artifacts.proj @@ -0,0 +1,255 @@ + + + + $(NetCurrent) + + false + true + + false + + $(ArtifactsDir)PackageDownload/ + + + $([System.IO.Path]::GetDirectoryName('$(ArcadeSdkBuildTasksAssembly)'))\..\ + $(ArcadeSdkMSBuildProjectDir)Sign.proj + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + DotNetReleaseShipping=true + + + + + + WindowsDesktop/$(Version)/ + + Manifest.xml + $(ArtifactsLogDir)AssetManifest/$(AssetManifestFilename) + + + $(ArtifactsObjDir)TempWorkingDir\$([System.Guid]::NewGuid())\ + + $(VersionPrefix) + $(Version) + + + + + + + + + + + + + + + + + $(InstallersRelativePath)%(Filename)%(Extension) + true + NonShipping=true + + + + $(InstallersRelativePath)%(Filename)%(Extension) + true + + + + + + $(InstallersRelativePath)%(Filename)%(Extension) + Checksum + true + + + + $(InstallersRelativePath)windowsdesktop-productVersion.txt + true + + + + $(InstallersRelativePath)productVersion.txt + true + + + + + + + $(SYSTEM_TEAMFOUNDATIONCOLLECTIONURI) + + $(CollectionUri.Split('/')[3]) + + $(CollectionUri.Split('.')[0].Split('/')[2]) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/windowsdesktop/tests/NuGetArtifactTester.cs b/src/windowsdesktop/tests/NuGetArtifactTester.cs index 0993abd47..69a4d1213 100644 --- a/src/windowsdesktop/tests/NuGetArtifactTester.cs +++ b/src/windowsdesktop/tests/NuGetArtifactTester.cs @@ -83,6 +83,11 @@ public void IsTargetingPackForPlatform() HasGoodPlatformManifest(); } + public void IsAppHostPack() + { + IsRuntimeSpecificPack(); + } + public void IsRuntimePack() { IsRuntimeSpecificPack();