Skip to content
This repository was archived by the owner on Mar 20, 2021. It is now read-only.

Commit 4a7aa4e

Browse files
authored
Reference Arcade templates locally (#17)
* Reference Arcade templates locally * Remove scripts, only port template changes
1 parent f088aef commit 4a7aa4e

File tree

10 files changed

+397
-10
lines changed

10 files changed

+397
-10
lines changed

.vsts-ci.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
trigger:
22
- master
33

4-
resources:
5-
repositories:
6-
# shared library repository
7-
- repository: arcade
8-
type: github
9-
endpoint: DotNet-Bot GitHub Connection
10-
name: dotnet/arcade
11-
ref: refs/heads/master
12-
134
variables:
145
teamName: Roslyn-Project-System
156
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:

eng/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ parameters:
44
variables: {}
55

66
phases:
7-
- template: /eng/common/templates/phases/base.yml@arcade
7+
- template: /eng/common/templates/phases/base.yml
88
parameters:
99
name: ${{ parameters.agentOs }}
1010
enableTelemetry: true

eng/common/templates/phases/base.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
parameters:
2+
# Optional: Clean sources before building
3+
clean: true
4+
5+
# Optional: Git fetch depth
6+
fetchDepth: ''
7+
8+
# Optional: name of the phase (not specifying phase name may cause name collisions)
9+
name: ''
10+
11+
# Required: A defined YAML queue
12+
queue: {}
13+
14+
# Required: build steps
15+
steps: []
16+
17+
# Optional: variables
18+
variables: {}
19+
20+
## Telemetry variables
21+
22+
# Optional: enable sending telemetry
23+
# if 'true', these "variables" must be specified in the variables object or as part of the queue matrix
24+
# _HelixBuildConfig - differentiate between Debug, Release, other
25+
# _HelixSource - Example: build/product
26+
# _HelixType - Example: official/dotnet/arcade/$(Build.SourceBranch)
27+
enableTelemetry: false
28+
29+
# Optional: Enable installing Microbuild plugin
30+
# if 'true', these "variables" must be specified in the variables object or as part of the queue matrix
31+
# _TeamName - the name of your team
32+
# _SignType - 'test' or 'real'
33+
enableMicrobuild: false
34+
35+
# Internal resources (telemetry, microbuild) can only be accessed from non-public projects,
36+
# and some (Microbuild) should only be applied to non-PR cases for internal builds.
37+
38+
phases:
39+
- phase: ${{ parameters.name }}
40+
41+
queue: ${{ parameters.queue }}
42+
43+
${{ if ne(parameters.variables, '') }}:
44+
variables: ${{ parameters.variables }}
45+
46+
steps:
47+
- checkout: self
48+
clean: ${{ parameters.clean }}
49+
${{ if ne(parameters.fetchDepth, '') }}:
50+
fetchDepth: ${{ parameters.fetchDepth }}
51+
52+
- ${{ if eq(parameters.enableTelemetry, 'true') }}:
53+
- template: /eng/common/templates/steps/telemetry-start.yml
54+
parameters:
55+
buildConfig: $(_HelixBuildConfig)
56+
helixSource: $(_HelixSource)
57+
helixType: $(_HelixType)
58+
59+
- ${{ if eq(parameters.enableMicrobuild, 'true') }}:
60+
# Internal only resource, and Microbuild signing shouldn't be applied to PRs.
61+
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
62+
- task: MicroBuildSigningPlugin@1
63+
displayName: Install MicroBuild plugin
64+
inputs:
65+
signType: $(_SignType)
66+
zipSources: false
67+
feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json
68+
69+
env:
70+
TeamName: $(_TeamName)
71+
continueOnError: false
72+
condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT'))
73+
74+
# Run provided build steps
75+
- ${{ parameters.steps }}
76+
77+
- ${{ if eq(parameters.enableMicrobuild, 'true') }}:
78+
# Internal only resources
79+
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
80+
- task: MicroBuildCleanup@1
81+
displayName: Execute Microbuild cleanup tasks
82+
condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT'))
83+
env:
84+
TeamName: $(_TeamName)
85+
86+
- ${{ if eq(parameters.enableTelemetry, 'true') }}:
87+
- template: /eng/common/templates/steps/telemetry-end.yml
88+
parameters:
89+
helixSource: $(_HelixSource)
90+
helixType: $(_HelixType)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
parameters:
2+
dependsOn: ''
3+
queue: {}
4+
phases:
5+
- phase: Push to B.A.R.
6+
dependsOn: ${{ parameters.dependsOn }}
7+
queue: ${{ parameters.queue }}
8+
steps:
9+
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
10+
- task: DownloadBuildArtifacts@0
11+
displayName: Download artifact
12+
inputs:
13+
artifactName: AssetManifests
14+
downloadPath: '$(Build.StagingDirectory)/Download'
15+
condition: succeeded()
16+
- task: AzureKeyVault@1
17+
inputs:
18+
azureSubscription: 'DotNet-Engineering-Services_KeyVault'
19+
KeyVaultName: EngKeyVault
20+
SecretsFilter: 'MaestroAccessToken'
21+
condition: succeeded()
22+
- script: eng\common\publishbuildassets.cmd
23+
/p:ManifestZipFilePath='$(Build.StagingDirectory)/Download/AssetManifests'
24+
/p:BuildAssetRegistryToken=$(MaestroAccessToken)
25+
/p:MaestroApiEndpoint=https://maestro-int.westus2.cloudapp.azure.com
26+
displayName: Push Build Assets
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# build-reason.yml
2+
# Description: runs steps if build.reason condition is valid. conditions is a string of valid build reasons
3+
# to include steps (',' separated).
4+
parameters:
5+
conditions: ''
6+
steps: []
7+
8+
steps:
9+
- ${{ if and( not(startsWith(parameters.conditions, 'not')), contains(parameters.conditions, variables['build.reason'])) }}:
10+
- ${{ parameters.steps }}
11+
- ${{ if and( startsWith(parameters.conditions, 'not'), not(contains(parameters.conditions, variables['build.reason']))) }}:
12+
- ${{ parameters.steps }}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parameters:
2+
agentOs: ''
3+
steps: []
4+
5+
steps:
6+
- ${{ if ne(parameters.agentOs, 'Windows_NT') }}:
7+
- ${{ parameters.steps }}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parameters:
2+
agentOs: ''
3+
steps: []
4+
5+
steps:
6+
- ${{ if eq(parameters.agentOs, 'Windows_NT') }}:
7+
- ${{ parameters.steps }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
parameters:
2+
# if parameter1 equals parameter 2, run 'ifScript' command, else run 'elsescript' command
3+
parameter1: ''
4+
parameter2: ''
5+
ifScript: ''
6+
elseScript: ''
7+
8+
# name of script step
9+
name: Script
10+
11+
# display name of script step
12+
displayName: If-Equal-Else Script
13+
14+
# environment
15+
env: {}
16+
17+
# conditional expression for step execution
18+
condition: ''
19+
20+
steps:
21+
- ${{ if and(ne(parameters.ifScript, ''), eq(parameters.parameter1, parameters.parameter2)) }}:
22+
- script: ${{ parameters.ifScript }}
23+
name: ${{ parameters.name }}
24+
displayName: ${{ parameters.displayName }}
25+
env: ${{ parameters.env }}
26+
condition: ${{ parameters.condition }}
27+
28+
- ${{ if and(ne(parameters.elseScript, ''), ne(parameters.parameter1, parameters.parameter2)) }}:
29+
- script: ${{ parameters.elseScript }}
30+
name: ${{ parameters.name }}
31+
displayName: ${{ parameters.displayName }}
32+
env: ${{ parameters.env }}
33+
condition: ${{ parameters.condition }}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
parameters:
2+
helixSource: 'undefined_defaulted_in_telemetry.yml'
3+
helixType: 'undefined_defaulted_in_telemetry.yml'
4+
5+
steps:
6+
- bash: |
7+
if [ "$AGENT_JOBSTATUS" = "Succeeded" ] || [ "$AGENT_JOBSTATUS" = "PartiallySucceeded" ]; then
8+
errorCount=0
9+
else
10+
errorCount=1
11+
fi
12+
warningCount=0
13+
14+
# create a temporary file for curl output
15+
res=`mktemp`
16+
17+
curlResult=`
18+
curl --verbose --output $res --write-out "%{http_code}"\
19+
-H 'Content-Type: application/json' \
20+
-H "X-Helix-Job-Token: $Helix_JobToken" \
21+
-H 'Content-Length: 0' \
22+
-X POST -G "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$Helix_WorkItemId/finish" \
23+
--data-urlencode "errorCount=$errorCount" \
24+
--data-urlencode "warningCount=$warningCount"`
25+
curlStatus=$?
26+
27+
if [ $curlStatus -eq 0 ]; then
28+
if [ $curlResult -gt 299 ] || [ $curlResult -lt 200 ]; then
29+
curlStatus=$curlResult
30+
fi
31+
fi
32+
33+
if [ $curlStatus -ne 0 ]; then
34+
echo "Failed to Send Build Finish information"
35+
vstsLogOutput="vso[task.logissue type=error;sourcepath=templates/steps/telemetry-end.yml;code=1;]Failed to Send Build Finish information: $curlStatus"
36+
echo "##$vstsLogOutput"
37+
exit 1
38+
fi
39+
displayName: Send Unix Build End Telemetry
40+
env:
41+
# defined via VSTS variables in start-job.sh
42+
Helix_JobToken: $(Helix_JobToken)
43+
Helix_WorkItemId: $(Helix_WorkItemId)
44+
condition: and(always(), ne(variables['Agent.Os'], 'Windows_NT'))
45+
- powershell: |
46+
if (($env:Agent_JobStatus -eq 'Succeeded') -or ($env:Agent_JobStatus -eq 'PartiallySucceeded')) {
47+
$ErrorCount = 0
48+
} else {
49+
$ErrorCount = 1
50+
}
51+
$WarningCount = 0
52+
53+
try {
54+
Invoke-RestMethod -Uri "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$env:Helix_WorkItemId/finish?errorCount=$ErrorCount&warningCount=$WarningCount" -Method Post -ContentType "application/json" -Body "" `
55+
-Headers @{ 'X-Helix-Job-Token'=$env:Helix_JobToken }
56+
}
57+
catch {
58+
Write-Error $_
59+
Write-Error $_.Exception
60+
exit 1
61+
}
62+
displayName: Send Windows Build End Telemetry
63+
env:
64+
# defined via VSTS variables in start-job.ps1
65+
Helix_JobToken: $(Helix_JobToken)
66+
Helix_WorkItemId: $(Helix_WorkItemId)
67+
condition: and(always(),eq(variables['Agent.Os'], 'Windows_NT'))

0 commit comments

Comments
 (0)