diff --git a/Documentation/AzureDevOps/TemplateSchema.md b/Documentation/AzureDevOps/TemplateSchema.md new file mode 100644 index 00000000000..c304c87dd86 --- /dev/null +++ b/Documentation/AzureDevOps/TemplateSchema.md @@ -0,0 +1,119 @@ +# Templates Schema + +Arcade provides many templates which help consumers conform to Arcade standards and provide additional functionality (additional jobs or stages that provide features). + +- [eng/common/jobs/jobs.yml](#jobs.yml) +- [eng/common/job/job.yml](#job.yml) + +## Jobs.yml + +Jobs.yml is a wrapper around one or more Azure DevOps [jobs](https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#job) but additionally adds more jobs which are commonly used by .NET Core Arcade repos. ie a job to publish asset manifests from a build and a job to generate the graph files for a build. + +### Jobs schema + +```yaml +parameters: + continueOnError: boolean # 'true' if future jobs should run even if this job fails; defaults to 'false' + enablePublishBuildArtifacts: boolean # Enables publishing build logs as an Azure DevOps artifact. + enablePublishUsingPipelines: boolean # Enable publishing using release pipelines + graphFileGeneration: + enabled: boolean # Enable generating the graph files at the end of the build + includeToolset: boolean # Include toolset dependencies in the generated graph files + jobs: [ jobSchema ] # see "Job schema" below + publishBuildAssetsDependsOn: [ string ] # Override automatically derived dependsOn value for "publish build assets" job + runAsPublic: boolean # Specify if job should run as a public build even in the internal project +``` + +## Job.yml + +Job.yml wraps common Arcade functionality in an effort to provide automatic support for Azure DevOps builds which rely on common Arcade features / conventions. + +### Job schema + +```yaml +parameters: + # accepts all job schema properties as parameters (https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#job) + + # additional parameters + artifacts: { artifactsReference } + # 'true' if Microbuild plugin should be installed for internal builds. + # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix + # _TeamName - the name of your team + # _SignType - 'test' or 'real' + enableMicrobuild: boolean + enablePublishBuildArtifacts: boolean # deprecated (replaced by 'artifacts' parameter). Enables publishing build logs as an Azure DevOps artifact. + enablePublishBuildAssets: boolean # deprecated (replaced by 'artifacts' parameter). Enables publishing asset manifests as an Azure DevOps artifact. + enablePublishUsingPipelines: boolean # prevent gather / push manifest from executing when using publishing pipelines + enablePublishTestResults: boolean # include publish test results task + enableTelemetry: boolean # specifies whether to set the DOTNET_CLI_TELEMETRY_PROFILE environment variable. Default 'true', must explicitly set 'enableTelemetry: false' to disable + name: string # Required: + # steps to run before artifacts are downloaded task is executed. ie, a clean step should happen before downloading artifacts. + preSteps: [ script | bash | pwsh | powershell | task | templateReference ] + runAsPublic: boolean +``` + +Find [artifactsReference](#artifact-schema) below. + +### Artifact schema + +The artifact parameter is used by [job.yml](#job-schema) to control what artifacts are published to Azure DevOps during a pipeline. + +```yaml +artifacts: + # 'true' to download default pipeline artifacts to default location. Use 'downloadArtifact' to change name and/or path + download: true | { downloadArtifactReference } + publish: + artifacts: true | { publishArtifactReference } # 'true' to publish to artifacts/bin and artifacts/packages to default named Azure DevOps artifact. Use 'publishArtifact' to change Azure DevOps artifact name + logs: true | { publishArtifactReference } # 'true' to publish logs to default named Azure DevOps artifact. Use 'publishArtifact' to change Azure DevOps artifact name + manifests: true | { publishArtifactReference } # 'true' to publish asset manifests to default named Azure DevOps artifact. Use 'publishArtifact' to change Azure DevOps artifact name +``` + +Find [downloadArtifactReference](#downloadartifact-schema) and [publishArtifactReference](#publishartifact-schema) below. + +#### Artifact Example + +```yaml +jobs: +- \eng\common\templates\job\job.yml + parameters: + name: build + artifacts: + publish: + artifacts: + name: myartifacts # publish artifacts/bin and artifacts/packages from the build to the 'myartifacts' Azure DevOps artifact + logs: true # publish logs from the build to the default named artifact + manifests: true # publish asset manifests from the build to the default named artifact + steps: + - script: build.cmd + +- \eng\common\templates\job\job.yml + parameters: + name: test + artifacts: + download: + name: myartifacts # download artifacts the the 'myartifacts' Azure DevOps artifact + path: pipelineartifacts # download to the 'pipelineartifacts' folder instead of the default ('artifacts') + publish: + logs: true # publish logs to the default named artifact + steps: + - script: test.cmd +``` + +### DownloadArtifact schema + +```yaml +artifacts: + download: + name: string # artifact name to download + path: string # target path for artifact contents + pattern: string # filter pattern representing files to include +``` + +### PublishArtifact schema + +```yaml +artifacts: + publish: + artifacts | logs | manifests: + name: string # Azure DevOps artifact name +``` diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 056945fb644..f8de00bf9a2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,15 +16,7 @@ pr: - Documentation/* variables: - # Cannot use key:value syntax in root defined variables - - name: _TeamName - value: DotNetCore - - name: _PublishUsingPipelines - value: true - - name: _DotNetArtifactsCategory - value: .NETCore - - name: _DotNetValidationArtifactsCategory - value: .NETCoreValidation +- template: eng/common-variables.yml resources: containers: @@ -32,168 +24,157 @@ resources: image: microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20170319080304 stages: -- stage: build +- stage: Build displayName: Build jobs: - template: /eng/common/templates/jobs/jobs.yml parameters: + artifacts: + publish: + artifacts: true + logs: true + manifests: true enableMicrobuild: true - enablePublishBuildArtifacts: true - enablePublishBuildAssets: true - enablePublishUsingPipelines: ${{ variables._PublishUsingPipelines }} - enableTelemetry: true + enablePublishUsingPipelines: true graphFileGeneration: enabled: true includeToolset: true - helixRepo: dotnet/arcade + workspace: + clean: all jobs: - job: Windows_NT timeoutInMinutes: 90 pool: - # For public or PR jobs, use the hosted pool. For internal jobs use the internal pool. - # Will eventually change this to two BYOC pools. - ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}: + ${{ if eq(variables._RunAsPublic, True) }}: name: NetCorePublic-Pool queue: BuildPool.Windows.10.Amd64.VS2017.Open - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + ${{ if eq(variables._RunAsInternal, True) }}: name: NetCoreInternal-Pool queue: BuildPool.Windows.10.Amd64.VS2017 - variables: - - _Script: eng\common\cibuild.cmd - - _ValidateSdkArgs: '' - - _InternalBuildArgs: '' - - HelixApiAccessToken: '' - - # Only enable publishing in non-public, non PR scenarios. - - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - # DotNet-Blob-Feed provides: dotnetfeed-storage-access-key-1 - # Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT - # DotNet-HelixApi-Access provides: HelixApiAccessToken - - group: DotNet-Blob-Feed - - group: Publish-Build-Assets - - group: DotNet-HelixApi-Access - - _PublishBlobFeedUrl: https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json - - _InternalBuildArgs: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName) - /p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1) - /p:DotNetPublishBlobFeedUrl=$(_PublishBlobFeedUrl) - /p:DotNetPublishToBlobFeed=$(_DotNetPublishToBlobFeed) - /p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines) - /p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory) - /p:OfficialBuildId=$(BUILD.BUILDNUMBER) - strategy: matrix: Build_Release: _BuildConfig: Release - # PRs or external builds are not signed. - ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}: - _SignType: test - _DotNetPublishToBlobFeed : false - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - _SignType: real - _DotNetPublishToBlobFeed : true - _Script: eng\validate-sdk.cmd - _ValidateSdkArgs: -gitHubPat $(BotAccount-dotnet-maestro-bot-PAT) -barToken $(MaestroAccessToken) - ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}: + ${{ if eq(variables._RunAsPublic, True) }}: Build_Debug: _BuildConfig: Debug - _SignType: test - _DotNetPublishToBlobFeed : false steps: - - checkout: self - clean: true - # Use utility script to run script command dependent on agent OS. - - script: $(_Script) + - script: eng\common\cibuild.cmd -configuration $(_BuildConfig) -prepareMachine $(_InternalBuildArgs) - $(_ValidateSdkArgs) /p:Test=false displayName: Windows Build / Publish - - - powershell: eng\common\build.ps1 - -configuration $(_BuildConfig) - -prepareMachine - -ci - -test - -projects $(Build.SourcesDirectory)/tests/UnitTests.proj - /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/Helix.binlog - displayName: Run Helix Tests - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - HelixAccessToken: $(HelixApiAccessToken) - - - powershell: eng\common\build.ps1 - -configuration $(_BuildConfig) - -prepareMachine - -ci - -test - -projects $(Build.SourcesDirectory)/tests/UnitTests.proj - /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/Helix.binlog - /p:HelixBaseUri=https://helix.int-dot.net/ - displayName: Run Helix Tests (Int) - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - HelixAccessToken: $(HelixApiAccessToken) - enabled: false - - - ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(variables._RunAsPublic, True) }}: - job: Linux container: LinuxContainer pool: - ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}: - name: NetCorePublic-Pool - queue: BuildPool.Ubuntu.1604.Amd64.Open - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - name: NetCoreInternal-Pool - queue: BuildPool.Ubuntu.1604.Amd64 - variables: - - HelixApiAccessToken: '' - - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - group: DotNet-HelixApi-Access + name: NetCorePublic-Pool + queue: BuildPool.Ubuntu.1604.Amd64.Open strategy: matrix: Build_Debug: _BuildConfig: Debug - _PublishType: none - _SignType: none - _DotNetPublishToBlobFeed : false Build_Release: _BuildConfig: Release - _PublishType: none - _SignType: none - _DotNetPublishToBlobFeed : false - steps: + preSteps: - checkout: self clean: true + steps: - script: eng/common/cibuild.sh --configuration $(_BuildConfig) --prepareMachine /p:Test=false displayName: Unix Build / Publish + +- ${{ if eq(variables._RunAsPublic, True) }}: + - stage: Test + dependsOn: Build + jobs: + - template: /eng/common/templates/jobs/jobs.yml + parameters: + artifacts: + publish: + artifacts: + name: Artifacts_Test_$(Agent.OS)_$(_BuildConfig) + logs: + name: Logs_Test_$(Agent.OS)_$(_BuildConfig) + download: true + workspace: + clean: all + jobs: + - job: Windows_NT + timeoutInMinutes: 90 + pool: + vmimage: windows-latest + strategy: + matrix: + Build_Release: + _BuildConfig: Release + Build_Debug: + _BuildConfig: Debug + steps: + - powershell: eng\common\build.ps1 + -configuration $(_BuildConfig) + -prepareMachine + -ci + -restore + -test + -projects $(Build.SourcesDirectory)\tests\UnitTests.proj + /bl:$(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)\Helix.binlog + /p:RestoreUsingNuGetTargets=false + displayName: Run Helix Tests + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + HelixAccessToken: '' + - job: Linux + container: LinuxContainer + pool: + vmimage: ubuntu-latest + strategy: + matrix: + Build_Debug: + _BuildConfig: Debug + Build_Release: + _BuildConfig: Release + steps: - script: eng/common/build.sh --configuration $(_BuildConfig) --prepareMachine --ci + --restore --test --projects $(Build.SourcesDirectory)/tests/UnitTests.proj /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/Helix.binlog + /p:RestoreUsingNuGetTargets=false displayName: Run Helix Tests env: SYSTEM_ACCESSTOKEN: $(System.AccessToken) - HelixAccessToken: $(HelixApiAccessToken) + HelixAccessToken: '' + +- ${{ if eq(variables._RunAsInternal, True) }}: + - stage: ValidateSdk + displayName: Validate Arcade SDK + dependsOn: Build + jobs: + - template: /eng/validate-sdk.yml + parameters: + buildArgs: -configuration $(_BuildConfig) + -prepareMachine + $(_InternalBuildArgs) + /p:Test=false -- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - template: eng\common\templates\post-build\post-build.yml parameters: # Symbol validation isn't being very reliable lately. This should be enabled back # once this issue is resolved: https://github.com/dotnet/arcade/issues/2871 enableSymbolValidation: false - # Sourcelink validation isn't passing for Arcade due to some regressions. This should be # enabled back once this issue is resolved: https://github.com/dotnet/arcade/issues/2912 enableSourceLinkValidation: false - + publishDependsOn: + - Validate + - ValidateSdk # This is to enable SDL runs part of Post-Build Validation Stage SDLValidationParameters: enable: true diff --git a/eng/common-variables.yml b/eng/common-variables.yml new file mode 100644 index 00000000000..8ea8debe786 --- /dev/null +++ b/eng/common-variables.yml @@ -0,0 +1,38 @@ +variables: + # Cannot use key:value syntax in root defined variables + - name: _TeamName + value: DotNetCore + - name: _DotNetArtifactsCategory + value: .NETCore + - name: _DotNetValidationArtifactsCategory + value: .NETCoreValidation + - name: HelixApiAccessToken + value: '' + - name: _RunAsPublic + value: True + - name: _RunAsInternal + value: False + - name: _InternalBuildArgs + value: '' + + - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - name: _RunAsPublic + value: False + - name: _RunAsInternal + value: True + - name: _SignType + value: real + # DotNet-Blob-Feed provides: dotnetfeed-storage-access-key-1 + # Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT + # DotNet-HelixApi-Access provides: HelixApiAccessToken + - group: DotNet-Blob-Feed + - group: Publish-Build-Assets + - group: DotNet-HelixApi-Access + - name: _InternalBuildArgs + value: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName) + /p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1) + /p:DotNetPublishBlobFeedUrl=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json + /p:DotNetPublishToBlobFeed=true + /p:DotNetPublishUsingPipelines=true + /p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory) + /p:OfficialBuildId=$(BUILD.BUILDNUMBER) diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index ffda80a197b..8e973c0f082 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -1,67 +1,35 @@ +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + parameters: # Job schema parameters - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job cancelTimeoutInMinutes: '' - condition: '' - - continueOnError: false - container: '' - + continueOnError: false dependsOn: '' - displayName: '' - - steps: [] - pool: '' - + steps: [] strategy: '' - timeoutInMinutes: '' - variables: [] - workspace: '' - # Job base template specific parameters - # Optional: Enable installing Microbuild plugin - # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix - # _TeamName - the name of your team - # _SignType - 'test' or 'real' +# Job base template specific parameters + # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md + artifacts: '' enableMicrobuild: false - - # Optional: Include PublishBuildArtifacts task enablePublishBuildArtifacts: false - - # Optional: Enable publishing to the build asset registry enablePublishBuildAssets: false - - # Optional: Prevent gather/push manifest from executing when using publishing pipelines - enablePublishUsingPipelines: false - - # Optional: Include PublishTestResults task enablePublishTestResults: false - - # Optional: enable sending telemetry - enableTelemetry: false - - # Optional: define the helix repo for telemetry (example: 'dotnet/arcade') - helixRepo: '' - - # Optional: define the helix type for telemetry (example: 'build/product/') - helixType: '' - - # Required: name of the job + enablePublishUsingPipelines: false name: '' - - # Optional: should run as a public build even in the internal project - # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + preSteps: + - checkout: self + clean: true runAsPublic: false -# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, -# and some (Microbuild) should only be applied to non-PR cases for internal builds. - jobs: - job: ${{ parameters.name }} @@ -93,7 +61,7 @@ jobs: timeoutInMinutes: ${{ parameters.timeoutInMinutes }} variables: - - ${{ if eq(parameters.enableTelemetry, 'true') }}: + - ${{ if ne(parameters.enableTelemetry, 'false') }}: - name: DOTNET_CLI_TELEMETRY_PROFILE value: '$(Build.Repository.Uri)' - ${{ each variable in parameters.variables }}: @@ -125,21 +93,12 @@ jobs: workspace: ${{ parameters.workspace }} steps: - - ${{ if eq(parameters.enableTelemetry, 'true') }}: - # Telemetry tasks are built from https://github.com/dotnet/arcade-extensions - - task: sendStartTelemetry@0 - displayName: 'Send Helix Start Telemetry' - inputs: - helixRepo: ${{ parameters.helixRepo }} - ${{ if ne(parameters.helixType, '') }}: - helixType: ${{ parameters.helixType }} - buildConfig: $(_BuildConfig) - runAsPublic: ${{ parameters.runAsPublic }} - continueOnError: ${{ parameters.continueOnError }} - condition: always() + - ${{ if ne(parameters.preSteps, '') }}: + - ${{ each preStep in parameters.preSteps }}: + - ${{ preStep }} - - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - task: MicroBuildSigningPlugin@2 displayName: Install MicroBuild plugin inputs: @@ -151,9 +110,16 @@ jobs: continueOnError: ${{ parameters.continueOnError }} condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: NuGetAuthenticate@0 + - ${{ if or(eq(parameters.artifacts.download, 'true'), ne(parameters.artifacts.download, '')) }}: + - task: DownloadPipelineArtifact@2 + inputs: + buildType: current + artifactName: ${{ coalesce(parameters.artifacts.download.name, 'Artifacts_$(Agent.OS)_$(_BuildConfig)') }} + targetPath: ${{ coalesce(parameters.artifacts.download.path, 'artifacts') }} + itemPattern: ${{ coalesce(parameters.artifacts.download.pattern, '**') }} + - ${{ each step in parameters.steps }}: - ${{ step }} @@ -166,20 +132,60 @@ jobs: env: TeamName: $(_TeamName) - - ${{ if eq(parameters.enableTelemetry, 'true') }}: - # Telemetry tasks are built from https://github.com/dotnet/arcade-extensions - - task: sendEndTelemetry@0 - displayName: 'Send Helix End Telemetry' - continueOnError: ${{ parameters.continueOnError }} - condition: always() - - - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if or(eq(parameters.artifacts.publish.artifacts, 'true'), ne(parameters.artifacts.publish.artifacts, '')) }}: + - task: CopyFiles@2 + displayName: Gather binaries for publish to artifacts + inputs: + SourceFolder: 'artifacts/bin' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/bin' + - task: CopyFiles@2 + displayName: Gather packages for publish to artifacts + inputs: + SourceFolder: 'artifacts/packages' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/packages' + - task: PublishBuildArtifacts@1 + displayName: Publish pipeline artifacts + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts' + PublishLocation: Container + ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} + continueOnError: true + condition: always() + - ${{ if or(eq(parameters.artifacts.publish.logs, 'true'), ne(parameters.artifacts.publish.logs, '')) }}: + - publish: artifacts/log + artifact: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} + displayName: Publish logs + continueOnError: true + condition: always() + - ${{ if or(eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: + - ${{ if and(ne(parameters.enablePublishUsingPipelines, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: CopyFiles@2 + displayName: Gather Asset Manifests + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' + TargetFolder: '$(Build.ArtifactStagingDirectory)/AssetManifests' + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + + - task: PublishBuildArtifacts@1 + displayName: Push Asset Manifests + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)/AssetManifests' + PublishLocation: Container + ArtifactName: AssetManifests + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + + - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: - task: PublishBuildArtifacts@1 displayName: Publish Logs inputs: PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' PublishLocation: Container - ArtifactName: $(Agent.Os)_$(Agent.JobName) + ArtifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} continueOnError: true condition: always() diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index 6a2f98c036f..c08225a9a97 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -1,19 +1,10 @@ parameters: - # Optional: 'true' if failures in job.yml job should not fail the job + # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md continueOnError: false - # Optional: Enable installing Microbuild plugin - # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix - # _TeamName - the name of your team - # _SignType - 'test' or 'real' - enableMicrobuild: false - # Optional: Include PublishBuildArtifacts task enablePublishBuildArtifacts: false - # Optional: Enable publishing to the build asset registry - enablePublishBuildAssets: false - # Optional: Enable publishing using release pipelines enablePublishUsingPipelines: false @@ -23,19 +14,9 @@ parameters: # Optional: Include toolset dependencies in the generated graph files includeToolset: false - # Optional: Include PublishTestResults task - enablePublishTestResults: false - - # Optional: enable sending telemetry - # if enabled then the 'helixRepo' parameter should also be specified - enableTelemetry: false - # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job jobs: [] - # Optional: define the helix repo for telemetry (example: 'dotnet/arcade') - helixRepo: '' - # Optional: Override automatically derived dependsOn value for "publish build assets" job publishBuildAssetsDependsOn: '' @@ -62,29 +43,30 @@ jobs: name: ${{ job.job }} -- ${{ if and(eq(parameters.enablePublishBuildAssets, true), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - template: ../job/publish-build-assets.yml - parameters: - continueOnError: ${{ parameters.continueOnError }} - dependsOn: - - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: - - ${{ each job in parameters.publishBuildAssetsDependsOn }}: - - ${{ job.job }} - - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: - - ${{ each job in parameters.jobs }}: - - ${{ job.job }} - pool: - vmImage: vs2017-win2016 - runAsPublic: ${{ parameters.runAsPublic }} - publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} - enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} - -- ${{ if and(eq(parameters.graphFileGeneration.enabled, true), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - template: ../job/generate-graph-files.yml - parameters: - continueOnError: ${{ parameters.continueOnError }} - includeToolset: ${{ parameters.graphFileGeneration.includeToolset }} - dependsOn: - - Asset_Registry_Publish - pool: - vmImage: vs2017-win2016 +- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if or(eq(parameters.enablePublishBuildAssets, true), eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: + - template: ../job/publish-build-assets.yml + parameters: + continueOnError: ${{ parameters.continueOnError }} + dependsOn: + - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.publishBuildAssetsDependsOn }}: + - ${{ job.job }} + - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.jobs }}: + - ${{ job.job }} + pool: + vmImage: vs2017-win2016 + runAsPublic: ${{ parameters.runAsPublic }} + publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} + enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} + + - ${{ if eq(parameters.graphFileGeneration.enabled, true) }}: + - template: ../job/generate-graph-files.yml + parameters: + continueOnError: ${{ parameters.continueOnError }} + includeToolset: ${{ parameters.graphFileGeneration.includeToolset }} + dependsOn: + - Asset_Registry_Publish + pool: + vmImage: vs2017-win2016 diff --git a/eng/common/templates/post-build/channels/netcore-dev-31.yml b/eng/common/templates/post-build/channels/netcore-dev-31.yml index db21254187d..af64724f797 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-31.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-31.yml @@ -1,11 +1,13 @@ parameters: - symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate publishInstallersAndChecksums: false + symbolPublishingAdditionalParameters: '' stages: - stage: NetCore_Dev31_Publish - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Core 3.1 Dev Publishing diff --git a/eng/common/templates/post-build/channels/netcore-dev-5.yml b/eng/common/templates/post-build/channels/netcore-dev-5.yml index c4f5a16acb6..6c8dff54245 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-5.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-5.yml @@ -1,11 +1,13 @@ parameters: - symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate publishInstallersAndChecksums: false + symbolPublishingAdditionalParameters: '' stages: - stage: NetCore_Dev5_Publish - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Core 5 Dev Publishing diff --git a/eng/common/templates/post-build/channels/netcore-internal-30.yml b/eng/common/templates/post-build/channels/netcore-internal-30.yml index 177b38df357..1a2d0d01fa6 100644 --- a/eng/common/templates/post-build/channels/netcore-internal-30.yml +++ b/eng/common/templates/post-build/channels/netcore-internal-30.yml @@ -1,10 +1,12 @@ parameters: - symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate + symbolPublishingAdditionalParameters: '' stages: - stage: NetCore_30_Internal_Servicing_Publishing - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Core 3.0 Internal Servicing Publishing diff --git a/eng/common/templates/post-build/channels/netcore-release-30.yml b/eng/common/templates/post-build/channels/netcore-release-30.yml index 16ade0db29d..206dd43e3a8 100644 --- a/eng/common/templates/post-build/channels/netcore-release-30.yml +++ b/eng/common/templates/post-build/channels/netcore-release-30.yml @@ -1,11 +1,13 @@ parameters: - symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate publishInstallersAndChecksums: false + symbolPublishingAdditionalParameters: '' stages: - stage: NetCore_Release30_Publish - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Core 3.0 Release Publishing diff --git a/eng/common/templates/post-build/channels/netcore-release-31.yml b/eng/common/templates/post-build/channels/netcore-release-31.yml index 01d56410c7d..6270c828359 100644 --- a/eng/common/templates/post-build/channels/netcore-release-31.yml +++ b/eng/common/templates/post-build/channels/netcore-release-31.yml @@ -1,11 +1,13 @@ parameters: - symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate publishInstallersAndChecksums: false + symbolPublishingAdditionalParameters: '' stages: - stage: NetCore_Release31_Publish - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Core 3.1 Release Publishing diff --git a/eng/common/templates/post-build/channels/netcore-tools-latest.yml b/eng/common/templates/post-build/channels/netcore-tools-latest.yml index 157d2d4b977..9bf9626ca34 100644 --- a/eng/common/templates/post-build/channels/netcore-tools-latest.yml +++ b/eng/common/templates/post-build/channels/netcore-tools-latest.yml @@ -1,11 +1,13 @@ parameters: - symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate publishInstallersAndChecksums: false + symbolPublishingAdditionalParameters: '' stages: - stage: NetCore_Tools_Latest_Publish - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Tools - Latest Publishing diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index 7f872e33a76..5c8e91cce13 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -1,10 +1,12 @@ parameters: artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate publishInstallersAndChecksums: false stages: - stage: PVR_Publish - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Tools - Validation Publishing diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 3ff662aeb35..b33e6e3aa1c 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -16,11 +16,14 @@ parameters: signingValidationAdditionalParameters: '' # Which stages should finish execution before post-build stages start - dependsOn: [build] + validateDependsOn: + - Build + publishDependsOn: + - Validate stages: -- stage: validate - dependsOn: ${{ parameters.dependsOn }} +- stage: Validate + dependsOn: ${{ parameters.validateDependsOn }} displayName: Validate jobs: - ${{ if eq(parameters.enableNugetValidation, 'true') }}: @@ -97,40 +100,47 @@ stages: - template: \eng\common\templates\post-build\channels\netcore-dev-5.yml parameters: - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\netcore-dev-31.yml parameters: - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\netcore-tools-latest.yml parameters: - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\public-validation-release.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - template: \eng\common\templates\post-build\channels\netcore-release-30.yml parameters: - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\netcore-release-31.yml parameters: - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\netcore-internal-30.yml parameters: - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} diff --git a/eng/validate-sdk.cmd b/eng/update-packagesource.cmd similarity index 68% rename from eng/validate-sdk.cmd rename to eng/update-packagesource.cmd index 089f267f9e6..c12187983fb 100644 --- a/eng/validate-sdk.cmd +++ b/eng/update-packagesource.cmd @@ -1,2 +1,2 @@ @echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0validate-sdk.ps1""" %*" +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0update-packagesource.ps1""" %*" diff --git a/eng/update-packagesource.ps1 b/eng/update-packagesource.ps1 new file mode 100644 index 00000000000..c76c36ee2d3 --- /dev/null +++ b/eng/update-packagesource.ps1 @@ -0,0 +1,82 @@ +Param( + [string] $barToken, + [string] $gitHubPat, + [string] $packagesSource +) + +$ErrorActionPreference = "Stop" +. $PSScriptRoot\common\tools.ps1 + +# Batch and executable files exit and define $LASTEXITCODE. Powershell commands exit and define $? +function CheckExitCode ([string]$stage, [bool]$commandExitCode = $True) +{ + $exitCode = 0 + if($commandExitCode -eq -$False) { + $exitCode = 1 + } + else { + if ( Test-Path "LASTEXITCODE" -ErrorAction SilentlyContinue) + { + $exitCode = $LASTEXITCODE + } + } + + if ($exitCode -ne 0) { + Write-PipelineTelemetryError -Category "UpdatePackageSource" -Message "Something failed in stage: '$stage'. Check for errors above. Exiting now with exit code $exitCode..." + ExitWithExitCode $exitCode + } +} + +function StopDotnetIfRunning +{ + $dotnet = Get-Process "dotnet" -ErrorAction SilentlyContinue + if ($dotnet) { + stop-process $dotnet + } +} + +function AddSourceToNugetConfig([string]$nugetConfigPath, [string]$source) +{ + Write-Host "Adding '$source' to '$nugetConfigPath'..." + $nugetConfig = New-Object XML + $nugetConfig.PreserveWhitespace = $true + $nugetConfig.Load($nugetConfigPath) + $packageSources = $nugetConfig.SelectSingleNode("//packageSources") + $keyAttribute = $nugetConfig.CreateAttribute("key") + $keyAttribute.Value = "arcade-local" + $valueAttribute = $nugetConfig.CreateAttribute("value") + $valueAttribute.Value = $source + $newSource = $nugetConfig.CreateElement("add") + $newSource.Attributes.Append($keyAttribute) | Out-Null + $newSource.Attributes.Append($valueAttribute) | Out-Null + $packageSources.AppendChild($newSource) | Out-Null + $nugetConfig.Save($nugetConfigPath) +} + +try { + Push-Location $PSScriptRoot + $nugetConfigPath = Join-Path $RepoRoot "NuGet.config" + + Write-Host "Adding local source to NuGet.config" + AddSourceToNugetConfig $nugetConfigPath $packagesSource + CheckExitCode "Adding source to NuGet.config" $? + + Write-Host "Updating dependencies using Darc..." + . .\common\darc-init.ps1 + CheckExitCode "Running darc-init" + $DarcExe = "$env:USERPROFILE\.dotnet\tools" + $DarcExe = Resolve-Path $DarcExe + & $DarcExe\darc.exe update-dependencies --packages-folder $packagesSource --password $barToken --github-pat $gitHubPat --channel ".NET Tools - Latest" + CheckExitCode "Updating dependencies" +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category "UpdatePackageSource" -Message $_ + ExitWithExitCode 1 +} +finally { + Write-Host "Cleaning up workspace..." + StopDotnetIfRunning + Pop-Location +} +ExitWithExitCode 0 \ No newline at end of file diff --git a/eng/validate-sdk.ps1 b/eng/validate-sdk.ps1 deleted file mode 100644 index ba27c5bd994..00000000000 --- a/eng/validate-sdk.ps1 +++ /dev/null @@ -1,144 +0,0 @@ -Param( - [string] $barToken, - [string] $gitHubPat, - [string] $configuration = "Debug" -) - -$ErrorActionPreference = "Stop" -. $PSScriptRoot\common\tools.ps1 -$LocalNugetConfigSourceName = "arcade-local" - -# Batch and executable files exit and define $LASTEXITCODE. Powershell commands exit and define $? -function CheckExitCode ([string]$stage, [bool]$commandExitCode = $True) -{ - if($commandExitCode -eq -$False) { - $exitCode = 1 - } - else { - $exitCode = $LASTEXITCODE - } - - if ($exitCode -ne 0) { - Write-Host "Something failed in stage: '$stage'. Check for errors above. Exiting now with exit code $exitCode..." - ExitWithExitCode $exitCode - } -} - -function StopDotnetIfRunning -{ - $dotnet = Get-Process "dotnet" -ErrorAction SilentlyContinue - if ($dotnet) { - stop-process $dotnet - } -} - -function AddSourceToNugetConfig([string]$nugetConfigPath, [string]$source) -{ - Write-Host "Adding '$source' to '$nugetConfigPath'..." - - $nugetConfig = New-Object XML - $nugetConfig.PreserveWhitespace = $true - $nugetConfig.Load($nugetConfigPath) - $packageSources = $nugetConfig.SelectSingleNode("//packageSources") - $keyAttribute = $nugetConfig.CreateAttribute("key") - $keyAttribute.Value = $LocalNugetConfigSourceName - $valueAttribute = $nugetConfig.CreateAttribute("value") - $valueAttribute.Value = $source - $newSource = $nugetConfig.CreateElement("add") - $newSource.Attributes.Append($keyAttribute) | Out-Null - $newSource.Attributes.Append($valueAttribute) | Out-Null - $packageSources.AppendChild($newSource) | Out-Null - $nugetConfig.Save($nugetConfigPath) -} - -function MoveFolderToSubFolder([string]$sourceDirectory, [string]$subFolderName) -{ - $parentDirectory = Split-Path -Path $sourceDirectory -Parent - Rename-Item -Path $sourceDirectory -NewName $subFolderName -Force -Verbose - if ($? -ne $True) { - return $False - } - - Create-Directory $sourceDirectory - Move-Item -Path (Join-Path $parentDirectory $subFolderName) -Destination $sourceDirectory -Force -Verbose - if ($? -ne $True) { - return $False - } - return $True -} - -try { - Write-Host "Stage 1: Build and create local packages" - - Push-Location $PSScriptRoot - - $stage1ArtifactsFolderName = "artifacts_stage_1" - $stage1SdkDir = Join-Path $RepoRoot $stage1ArtifactsFolderName - $packagesSource = Join-Path (Join-Path (Join-Path $stage1SdkDir "packages") $configuration) "NonShipping" - $nugetConfigPath = Join-Path $RepoRoot "NuGet.config" - - & .\common\cibuild.cmd -configuration $configuration @Args - CheckExitCode "Local build" - - # This is a temporary solution. When https://github.com/dotnet/arcade/issues/1293 is closed - # we'll be able to pass a container name to build.ps1 which will put the outputs in the - # artifacts- folder. - Rename-Item -Path $ArtifactsDir -NewName $stage1ArtifactsFolderName -Verbose - CheckExitCode "Preserve artifacts for stage 1 build" $? - Write-Host "Stage 2: Build using the local packages" - - AddSourceToNugetConfig $nugetConfigPath $packagesSource - CheckExitCode "Adding source to NuGet.config" - - Write-Host "Updating Dependencies using Darc..." - - . .\common\darc-init.ps1 - CheckExitCode "Running darc-init" - - $DarcExe = "$env:USERPROFILE\.dotnet\tools" - $DarcExe = Resolve-Path $DarcExe - - & $DarcExe\darc.exe update-dependencies --packages-folder $packagesSource --password $barToken --github-pat $gitHubPat --channel ".NET Tools - Latest" - CheckExitCode "Updating dependencies" - StopDotnetIfRunning - - Write-Host "Building with updated dependencies" - - $ArtifactsLogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration - & .\common\cibuild.cmd -configuration $configuration @Args /p:DotNetPublishBlobFeedUrl=https://dotnetfeed.blob.core.windows.net/dotnet-core-test/index.json - CheckExitCode "Official build" - - StopDotnetIfRunning - - # Preserve build artifacts from stage 1 and stage 2 - # move logs to stage 2 - $exitCode = MoveFolderToSubFolder $ArtifactsLogDir "stage2" - CheckExitCode "Move stage2 logs" $exitCode - - # copy logs from stage 1 - $stage1SourceLogDir = Join-Path (Join-Path $stage1SdkDir "log") $configuration - $stage1TargetLogDir = Join-Path $ArtifactsLogDir "stage1" - $stage1SourceAssetManifestDir = Join-Path $stage1SourceLogDir "AssetManifest" - Create-Directory $stage1TargetLogDir - Copy-Item -Path "$stage1SourceLogDir\*" -Destination $stage1TargetLogDir -Recurse -Force -Verbose - CheckExitCode "Copy logs from stage 1" $? - - # copy manifest from stage 1 - $ArtifactsManifestDir = Join-Path $artifactsLogDir "AssetManifest" - Create-Directory $ArtifactsManifestDir - Copy-Item -Path "$stage1SourceAssetManifestDir\*" -Destination $ArtifactsManifestDir -Recurse -Force -Verbose - CheckExitCode "Copy asset manifests from stage 1" $? - - Write-Host "Finished building Arcade SDK with validation enabled!" -} -catch { - Write-Host $_ - Write-Host $_.Exception - Write-Host $_.ScriptStackTrace - ExitWithExitCode 1 -} -finally { - Write-Host "Cleaning up workspace..." - StopDotnetIfRunning - Pop-Location -} diff --git a/eng/validate-sdk.yml b/eng/validate-sdk.yml new file mode 100644 index 00000000000..175a247316e --- /dev/null +++ b/eng/validate-sdk.yml @@ -0,0 +1,39 @@ +parameters: + buildArgs: '' + validateBlobFeedUrl: https://dotnetfeed.blob.core.windows.net/dotnet-core-test/index.json + buildConfig: Release + +jobs: +- template: /eng/common/templates/job/job.yml + parameters: + name: ValidateArcadeSDK + displayName: Validate Arcade SDK + enableMicrobuild: true + artifacts: + download: + path: build_stage_artifacts + publish: + artifacts: + name: Artifacts_ValidateSdk_Windows_NT_Release + logs: + name: Logs_ValidateSdk_Windows_NT_Release + timeoutInMinutes: 90 + pool: + name: NetCoreInternal-Pool + queue: BuildPool.Windows.10.Amd64.VS2017 + variables: + - group: DotNet-Blob-Feed + - group: Publish-Build-Assets + - _BuildConfig: ${{ parameters.buildConfig }} + - _BuildArgs: ${{ parameters.buildArgs }} + - _ValidateBlobFeedUrl: ${{ parameters.validateBlobFeedUrl }} + steps: + - script: eng\update-packagesource.cmd + -gitHubPat $(BotAccount-dotnet-maestro-bot-PAT) + -barToken $(MaestroAccessToken) + -packagesSource $(Build.SourcesDirectory)/build_stage_artifacts + displayName: Update package source + - script: eng\common\cibuild.cmd + $(_BuildArgs) + /p:DotNetPublishBlobFeedUrl=$(_ValidateBlobFeedUrl) + displayName: Build / Validate diff --git a/tests/UnitTests.proj b/tests/UnitTests.proj index 6348cc58700..aca9cf8eabe 100644 --- a/tests/UnitTests.proj +++ b/tests/UnitTests.proj @@ -53,8 +53,8 @@ - $(MSBuildThisFileDirectory)../artifacts/bin/Microsoft.DotNet.Helix.Sdk/$(_BuildConfig)/netcoreapp2.1/publish/Microsoft.DotNet.Helix.Sdk.dll - $(MSBuildThisFileDirectory)../artifacts/bin/Microsoft.DotNet.Helix.Sdk/$(_BuildConfig)/net472/publish/Microsoft.DotNet.Helix.Sdk.dll + $(MSBuildThisFileDirectory)../artifacts/bin/Microsoft.DotNet.Helix.Sdk/$(Configuration)/netcoreapp2.1/publish/Microsoft.DotNet.Helix.Sdk.dll + $(MSBuildThisFileDirectory)../artifacts/bin/Microsoft.DotNet.Helix.Sdk/$(Configuration)/net472/publish/Microsoft.DotNet.Helix.Sdk.dll