@@ -63,6 +63,18 @@ parameters:
63
63
type : boolean
64
64
default : false
65
65
66
+ # Name of previous job(s) (from the same template as this) whose output will be used to build this job
67
+ # The SDK from its artifacts is copied to $(sourcesPath)/.dotnet
68
+ - name : reuseBuildArtifactsFrom
69
+ type : object
70
+ default : ' '
71
+
72
+ # Names of jobs that this job depends on. This only provides a job dependency and does not automatically
73
+ # download artifacts from the other job. Use reuseBuildArtifactsFrom for that.
74
+ - name : dependsOn
75
+ type : object
76
+ default : ' '
77
+
66
78
# ### SOURCE-ONLY parameters ####
67
79
68
80
# Instead of building the VMR directly, exports the sources into a tarball and builds from that
@@ -83,12 +95,6 @@ parameters:
83
95
type : boolean
84
96
default : false
85
97
86
- # Name of previous job(s) (from the same template as this) whose output will be used to build this job
87
- # The SDK from its artifacts is copied to $(sourcesPath)/.dotnet
88
- - name : reuseBuildArtifactsFrom
89
- type : object
90
- default : ' '
91
-
92
98
# Allow downloading artifacts from the internet during the build
93
99
- name : runOnline
94
100
type : boolean
@@ -108,6 +114,16 @@ parameters:
108
114
type : boolean
109
115
default : false
110
116
117
+ # Skip the build step (this would be used when wanting to run tests only)
118
+ - name : skipBuild
119
+ type : boolean
120
+ default : false
121
+
122
+ # Custom steps to run before running tests
123
+ - name : testInitSteps
124
+ type : stepList
125
+ default : []
126
+
111
127
# ### sdk parameters ####
112
128
113
129
- name : isBuiltFromVmr
@@ -138,7 +154,7 @@ jobs:
138
154
image : ${{ parameters.container.image }}
139
155
options : $(defaultContainerOptions)
140
156
141
- ${{ if ne(parameters.reuseBuildArtifactsFrom, '') }} :
157
+ ${{ if or( ne(parameters.reuseBuildArtifactsFrom, ''), ne(parameters.dependsOn, '') ) }} :
142
158
${{ if eq(parameters.buildPass, '') }} :
143
159
# For PR builds, skip the stage 2 build if the stage 1 build fails.
144
160
# Otherwise, run the stage 2 build even if the stage 1 build fails so that we can get a complete assessment of the build status.
@@ -149,7 +165,11 @@ jobs:
149
165
condition : succeededOrFailed()
150
166
${{ else }} :
151
167
condition : succeeded()
152
- dependsOn : ${{ parameters.reuseBuildArtifactsFrom }}
168
+ dependsOn :
169
+ - ${{ if ne(parameters.reuseBuildArtifactsFrom, '') }} :
170
+ - ${{ parameters.reuseBuildArtifactsFrom }}
171
+ - ${{ if ne(parameters.dependsOn, '') }} :
172
+ - ${{ parameters.dependsOn }}
153
173
variables :
154
174
- ${{ if eq(variables['System.TeamProject'], 'internal') }} :
155
175
- group : AzureDevOps-Artifact-Feeds-Pats
@@ -344,20 +364,15 @@ jobs:
344
364
- ${{ if ne(parameters.reuseBuildArtifactsFrom,'') }} :
345
365
- ${{ each reuseBuildArtifacts in parameters.reuseBuildArtifactsFrom }} :
346
366
- ${{ if eq(parameters.buildSourceOnly, true) }} :
347
- - download : current
348
- artifact : ${{ reuseBuildArtifacts }}_Artifacts
349
- patterns : |
350
- **/Private.SourceBuilt.Artifacts.*.tar.gz
351
- **/dotnet-sdk-*.tar.gz
352
- **/*.nupkg
353
- displayName : Download Previous Build (${{ reuseBuildArtifacts }})
354
-
355
- - task : CopyFiles@2
356
- displayName : Copy Previous Build (${{ reuseBuildArtifacts }} - Source Build artifacts)
357
- inputs :
358
- SourceFolder : $(Pipeline.Workspace)/${{ reuseBuildArtifacts }}_Artifacts/assets/Release
359
- Contents : ' *.tar.gz'
360
- TargetFolder : $(sourcesPath)/prereqs/packages/archive/
367
+ - template : ../steps/download-artifacts.yml@self
368
+ parameters :
369
+ artifactDescription : Previous Build (${{ reuseBuildArtifacts }} - Source Build artifacts)
370
+ artifactName : ${{ reuseBuildArtifacts }}_Artifacts
371
+ downloadFilePatterns : |
372
+ **/Private.SourceBuilt.Artifacts.*.tar.gz
373
+ **/dotnet-sdk-*.tar.gz
374
+ copyDestination : $(sourcesPath)/prereqs/packages/archive/
375
+ flattenDirs : true
361
376
362
377
- ${{ else }} :
363
378
- task : DownloadPipelineArtifact@2
@@ -501,61 +516,62 @@ jobs:
501
516
displayName: Prep the Build
502
517
workingDirectory: $(sourcesPath)
503
518
504
- - script : |
505
- set -ex
506
- df -h
519
+ - ${{ if ne(parameters.skipBuild, 'true') }} :
507
520
508
- customEnvVars=""
509
- customPreBuildArgs=""
510
- customBuildArgs="$(baseArguments) $(signArguments) $(_SignDiagnosticFilesArgs)"
511
- extraBuildProperties="$(baseProperties) $(targetProperties) $(signProperties) $(buildPassProperties) ${{ parameters.extraProperties }}"
521
+ - script : |
522
+ set -ex
523
+ df -h
512
524
513
- if [[ '${{ parameters.runOnline }}' == 'True' ]]; then
514
- customBuildArgs="$customBuildArgs --online"
515
- else
516
- customPreBuildArgs="$customPreBuildArgs sudo unshare -n"
517
- fi
525
+ customEnvVars=""
526
+ customPreBuildArgs=""
527
+ customBuildArgs="$(baseArguments) $(signArguments) $(_SignDiagnosticFilesArgs)"
528
+ extraBuildProperties="$(baseProperties) $(targetProperties) $(signProperties) $(buildPassProperties) ${{ parameters.extraProperties }}"
518
529
519
- if [[ '${{ parameters.enablePoison }}' == 'True' ]]; then
520
- customBuildArgs="$customBuildArgs --poison"
521
- fi
530
+ if [[ '${{ parameters.runOnline }}' == 'True' ]]; then
531
+ customBuildArgs="$customBuildArgs --online"
532
+ else
533
+ customPreBuildArgs="$customPreBuildArgs sudo unshare -n"
534
+ fi
522
535
523
- if [[ '${{ parameters.buildFromArchive }}' == 'True' ]]; then
524
- customBuildArgs="$customBuildArgs --source-repository https://github.com/dotnet/dotnet"
525
- customBuildArgs="$customBuildArgs --source-version $(git -C "$(vmrPath)" rev-parse HEAD)"
526
- fi
536
+ if [[ '${{ parameters.enablePoison }}' == 'True' ]]; then
537
+ customBuildArgs="$customBuildArgs --poison"
538
+ fi
527
539
528
- if [[ '${{ parameters.buildSourceOnly }}' == 'True' ]]; then
529
- customBuildArgs="$customBuildArgs --source-only "
530
- extraBuildProperties ="$extraBuildProperties /p:ReportSbrpUsage=true "
531
- fi
540
+ if [[ '${{ parameters.buildFromArchive }}' == 'True' ]]; then
541
+ customBuildArgs="$customBuildArgs --source-repository https://github.com/dotnet/dotnet "
542
+ customBuildArgs ="$customBuildArgs --source-version $(git -C "$(vmrPath)" rev-parse HEAD) "
543
+ fi
532
544
533
- if [[ '${{ parameters.useMonoRuntime }}' == 'True' ]]; then
534
- customBuildArgs="$customBuildArgs --use-mono-runtime"
535
- fi
545
+ if [[ '${{ parameters.buildSourceOnly }}' == 'True' ]]; then
546
+ customBuildArgs="$customBuildArgs --source-only"
547
+ extraBuildProperties="$extraBuildProperties /p:ReportSbrpUsage=true"
548
+ fi
536
549
537
- if [[ -n " ${{ parameters.targetRid }}" ]]; then
538
- customBuildArgs="$customBuildArgs --target-rid ${{ parameters.targetRid }} "
539
- fi
550
+ if [[ ' ${{ parameters.useMonoRuntime }}' == 'True' ]]; then
551
+ customBuildArgs="$customBuildArgs --use-mono-runtime "
552
+ fi
540
553
541
- if [[ -n "${{ parameters.crossRootFs }}" ]]; then
542
- customEnvVars="$customEnvVars ROOTFS_DIR=${{ parameters.crossRootFs}}"
543
- if [[ '${{ parameters.targetArchitecture }}' != 'wasm' ]]; then
544
- extraBuildProperties="$extraBuildProperties /p:CrossBuild=true"
554
+ if [[ -n "${{ parameters.targetRid }}" ]]; then
555
+ customBuildArgs="$customBuildArgs --target-rid ${{ parameters.targetRid }}"
556
+ fi
557
+
558
+ if [[ -n "${{ parameters.crossRootFs }}" ]]; then
559
+ customEnvVars="$customEnvVars ROOTFS_DIR=${{ parameters.crossRootFs}}"
560
+ if [[ '${{ parameters.targetArchitecture }}' != 'wasm' ]]; then
561
+ extraBuildProperties="$extraBuildProperties /p:CrossBuild=true"
562
+ fi
545
563
fi
546
- fi
547
564
548
- buildArgs="$(additionalBuildArgs) $customBuildArgs $extraBuildProperties"
549
- buildArgs=$(echo $buildArgs | xargs) # Remove extra spaces
565
+ buildArgs="$(additionalBuildArgs) $customBuildArgs $extraBuildProperties"
550
566
551
- for envVar in $customEnvVars; do
552
- customEnvVarsWithBashSyntax="$customEnvVarsWithBashSyntax export $envVar;"
553
- done
567
+ for envVar in $customEnvVars; do
568
+ customEnvVarsWithBashSyntax="$customEnvVarsWithBashSyntax export $envVar;"
569
+ done
554
570
555
- eval $customEnvVarsWithBashSyntax
556
- $customPreBuildArgs ./build.sh $buildArgs
557
- displayName: Build
558
- workingDirectory: $(sourcesPath)
571
+ eval $customEnvVarsWithBashSyntax
572
+ $customPreBuildArgs ./build.sh $buildArgs
573
+ displayName: Build
574
+ workingDirectory: $(sourcesPath)
559
575
560
576
- ${{ if ne(parameters.runOnline, 'True' )}} :
561
577
- script : |
@@ -566,6 +582,8 @@ jobs:
566
582
567
583
# Only run tests if enabled
568
584
- ${{ if eq(parameters.runTests, 'True') }} :
585
+ - ${{ parameters.testInitSteps }}
586
+
569
587
# Setup the NuGet sources used by the tests to use private feeds. This is necessary when testing internal-only product
570
588
# builds where the packages are only available in the private feeds. This allows the tests to restore from those feeds.
571
589
- ${{ if eq(variables['System.TeamProject'], 'internal') }} :
0 commit comments