dotnet-installer/src/SourceBuild/Arcade/eng/common/templates/job/source-build-run-tarball-build.yml
2022-03-02 15:58:55 -06:00

174 lines
6.4 KiB
YAML

# Builds a source-build tarball
parameters:
# Custom condition to apply to the job
condition: true
# Dependent jobs that must be completed before this job will run
dependsOn:
# Resource id of the installer build to retrieve source/product tarball's from
installerBuildResourceId: current
# The following parameters aren't expected to be passed in rather they are used for encapsulation
# -----------------------------------------------------------------------------------------------
buildJobTimeout: 300
centOS7Container: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-source-build-20210714125450-5d87b80
centOS8Container: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-source-build-20211118190102-9355e7b
centOSStream9Container: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9-20220107135047-4cd394c
debian9Container: mcr.microsoft.com/dotnet-buildtools/prereqs:debian-stretch-20211001171226-047508b
fedora33Container: mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-33-20210222183538-031e7d2
ubuntu1804Container: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-20210924170306-047508b
poolInternal:
name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64
poolPublic:
name: NetCore1ESPool-Svc-Public
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open
tarballDir: $(Build.StagingDirectory)/tarball
jobs:
- job: Build_Tarball
condition: ${{ parameters.condition }}
displayName: Build Tarball
dependsOn: ${{ parameters.dependsOn }}
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
${{ parameters.poolPublic }}
${{ if eq(variables['System.TeamProject'], 'internal') }}:
${{ parameters.poolInternal }}
strategy:
matrix:
CentOS7-Online:
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.centOS7Container }}
_ExcludeOmniSharpTests: true
_Platform: linux
_RunOnline: true
CentOS7-Offline:
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.centOS7Container }}
_ExcludeOmniSharpTests: true
_Platform: linux
_RunOnline: false
${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
CentOS8-Offline:
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.centOS8Container }}
_ExcludeOmniSharpTests: false
_Platform: linux
_RunOnline: false
CentOSStream9-Offline:
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.centOSStream9Container }}
_ExcludeOmniSharpTests: false
_Platform: linux
_RunOnline: false
Fedora33-Offline:
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.fedora33Container }}
_ExcludeOmniSharpTests: false
_Platform: linux
_RunOnline: false
Ubuntu1804-Offline:
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.ubuntu1804Container }}
_ExcludeOmniSharpTests: false
_Platform: linux
_RunOnline: false
timeoutInMinutes: ${{ parameters.buildJobTimeout }}
variables:
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- group: AzureDevOps-Artifact-Feeds-Pats
workspace:
clean: all
steps:
- checkout: self
clean: true
- template: /src/SourceBuild/Arcade/eng/common/templates/steps/source-build-build-tarball.yml
parameters:
buildArch: $(_BuildArch)
container: $(_Container)
excludeOmniSharpTests: $(_ExcludeOmniSharpTests)
installerBuildResourceId: ${{ parameters.installerBuildResourceId }}
platform: $(_Platform)
prepScript: |
set -x
customPrepArgs=
if [ '$(_BootstrapPrep)' = 'true' ]; then
customPrepArgs='--bootstrap'
fi
docker run --rm -v ${{ parameters.tarballDir }}:/tarball -w /tarball $(_Container) ./prep.sh ${customPrepArgs}
runOnline: $(_RunOnline)
tarballDir: ${{ parameters.tarballDir }}
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
- job: Rebuild_Tarball
displayName: Rebuild Tarball With Previous
dependsOn: Build_Tarball
# Always attempt to run the bootstrap leg (e.g. even when stage 1 tests fail) in order to get a complete accessment of the build status.
# The bootstrap build will shortcut if the stage 1 build failed.
condition: succeededOrFailed()
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
${{ parameters.poolPublic }}
${{ if eq(variables['System.TeamProject'], 'internal') }}:
${{ parameters.poolInternal }}
strategy:
matrix:
Fedora33-Offline:
_PreviousSourceBuildArtifact: Build Tarball Fedora33-Offline_Artifacts
_BuildArch: x64
_Container: ${{ parameters.fedora33Container }}
_Platform: linux
_RunOnline: false
timeoutInMinutes: ${{ parameters.buildJobTimeout }}
variables:
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- group: AzureDevOps-Artifact-Feeds-Pats
workspace:
clean: all
steps:
- checkout: self
clean: true
- download: current
artifact: $(_PreviousSourceBuildArtifact)
patterns: '*.tar.gz'
displayName: Download Previous Source Build Artifacts
- task: CopyFiles@2
displayName: Copy Previous Source Build Artifacts
inputs:
SourceFolder: $(PIPELINE.WORKSPACE)/$(_PreviousSourceBuildArtifact)
Contents: '*.tar.gz'
TargetFolder: ${{ parameters.tarballDir }}/packages/archive/
- template: /src/SourceBuild/Arcade/eng/common/templates/steps/source-build-build-tarball.yml
parameters:
additionalBuildArgs: --with-sdk /tarball/.dotnet
buildArch: $(_BuildArch)
container: $(_Container)
installerBuildResourceId: ${{ parameters.installerBuildResourceId }}
isBootstrapped: true
platform: $(_Platform)
prepScript: |
set -x
mkdir ${{ parameters.tarballDir }}/.dotnet
tarballFilePath="${{ parameters.tarballDir }}/packages/archive/dotnet-sdk-*.tar.gz"
eval tar -ozxf "$tarballFilePath" -C "${{ parameters.tarballDir }}/.dotnet"
eval rm -f "$tarballFilePath"
runOnline: $(_RunOnline)
tarballDir: ${{ parameters.tarballDir }}