Skip to content
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

Break Arcade Build, Test, Validate SDK into stages #3530

Merged
merged 22 commits into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
210cf13
Stagify Arcade
chcosta Aug 14, 2019
b5378b2
Fix slashes for consistency when specifying RestoreUsingNugetTargets …
chcosta Aug 14, 2019
9b5328f
pr feedback: formatting, prestep default
chcosta Aug 19, 2019
7d23a07
Merge branch 'master' of https://github.com/dotnet/arcade into test-s…
chcosta Aug 19, 2019
e7bbb0e
Try direct assignment
chcosta Aug 19, 2019
b919880
Fix formatting
chcosta Aug 19, 2019
69f2d2e
Fix formatting
chcosta Aug 19, 2019
c2f4960
script cleanup
chcosta Aug 19, 2019
f17ac2b
Merge branch 'master' of https://github.com/dotnet/arcade into test-s…
chcosta Aug 20, 2019
28999ae
update arcade sdk version
chcosta Aug 20, 2019
a273d92
Merge branch 'master' of https://github.com/dotnet/arcade into test-s…
chcosta Aug 21, 2019
5d4b445
fix casing
chcosta Aug 26, 2019
5e6e847
fix casing
chcosta Aug 26, 2019
ce0e870
fix casing
chcosta Aug 26, 2019
655019e
Merge branch 'master' of https://github.com/dotnet/arcade into test-s…
chcosta Aug 26, 2019
43362d4
Merge branch 'master' of https://github.com/dotnet/arcade into test-s…
chcosta Sep 4, 2019
d1d0846
Merge branch 'master' of https://github.com/dotnet/arcade into test-s…
chcosta Sep 4, 2019
6498377
Merge branch 'master' of https://github.com/dotnet/arcade into test-s…
chcosta Sep 9, 2019
d7b1b20
Fix bad merge
chcosta Sep 9, 2019
6b73ee6
Fix dependencies casing
chcosta Sep 9, 2019
3e121f8
Merge branch 'master' of https://github.com/dotnet/arcade into test-s…
chcosta Sep 17, 2019
20a99c9
Merge branch 'master' of https://github.com/dotnet/arcade into test-s…
chcosta Sep 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions Documentation/AzureDevOps/TemplateSchema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# 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 }
enableMicrobuild: boolean # 'true' if Microbuild plugin should be installed for internal builds.
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
```
197 changes: 89 additions & 108 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,184 +14,165 @@ 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:
- container: LinuxContainer
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
Expand Down
Loading