From 54801b24350f51a2e62845b1f5db36fffd976591 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Tue, 7 Mar 2023 19:21:37 -0600 Subject: [PATCH] Enable bootstrap flow testing in CI (#15728) Co-authored-by: Chris Rummel --- eng/pipelines/templates/jobs/vmr-build.yml | 20 ++++++++++-- eng/pipelines/templates/stages/vmr-build.yml | 14 +++++++++ src/SourceBuild/content/eng/Versions.props | 2 +- src/SourceBuild/content/prep.sh | 33 +++++++++++++------- 4 files changed, 54 insertions(+), 15 deletions(-) diff --git a/eng/pipelines/templates/jobs/vmr-build.yml b/eng/pipelines/templates/jobs/vmr-build.yml index 8681d2fafd03..0296dfbc2951 100644 --- a/eng/pipelines/templates/jobs/vmr-build.yml +++ b/eng/pipelines/templates/jobs/vmr-build.yml @@ -58,6 +58,14 @@ parameters: type: boolean default: false +- name: prepNoArtifacts + type: boolean + default: false + +- name: prepNoSdk + type: boolean + default: false + jobs: - job: ${{ parameters.buildName }}_${{ parameters.architecture }} timeoutInMinutes: 150 @@ -150,9 +158,15 @@ jobs: - script: | set -x - if [[ -z '${{ parameters.reuseBuildArtifactsFrom }}' ]]; then - docker run --rm -v "$(sourcesPath):/vmr" -w /vmr ${{ parameters.container }} ./prep.sh - else + customPrepArgs="" + if [[ '${{ parameters.prepNoArtifacts }}' == 'True' ]]; then + customPrepArgs="${customPrepArgs} --no-artifacts" + fi + if [[ '${{ parameters.prepNoSdk }}' == 'True' ]]; then + customPrepArgs="${customPrepArgs} --no-sdk" + fi + docker run --rm -v "$(sourcesPath):/vmr" -w /vmr ${{ parameters.container }} ./prep.sh ${customPrepArgs} + if [[ '${{ parameters.prepNoSdk }}' == 'True' || -n '${{ parameters.reuseBuildArtifactsFrom }}' ]]; then mkdir $(sourcesPath)/.dotnet previousSdkPath="$(sourcesPath)/prereqs/packages/archive/dotnet-sdk-*.tar.gz" eval tar -ozxf "$previousSdkPath" -C "$(sourcesPath)/.dotnet" diff --git a/eng/pipelines/templates/stages/vmr-build.yml b/eng/pipelines/templates/stages/vmr-build.yml index 515ab8dac0d6..1382deca8a4b 100644 --- a/eng/pipelines/templates/stages/vmr-build.yml +++ b/eng/pipelines/templates/stages/vmr-build.yml @@ -81,6 +81,8 @@ stages: excludeSdkContentTests: true # ✅ overrideDistroDisablingSha1: false # 🚫 runOnline: true # ✅ + prepNoArtifacts: false # 🚫 + prepNoSdk: false # 🚫 - ${{ if ne(variables['Build.Reason'], 'PullRequest') }}: - template: ../jobs/vmr-build.yml @@ -99,6 +101,8 @@ stages: excludeSdkContentTests: false # 🚫 overrideDistroDisablingSha1: false # 🚫 runOnline: false # 🚫 + prepNoArtifacts: false # 🚫 + prepNoSdk: false # 🚫 - template: ../jobs/vmr-build.yml parameters: @@ -116,6 +120,8 @@ stages: excludeSdkContentTests: false # 🚫 overrideDistroDisablingSha1: true # ✅ runOnline: false # 🚫 + prepNoArtifacts: false # 🚫 + prepNoSdk: false # 🚫 - template: ../jobs/vmr-build.yml parameters: @@ -133,6 +139,8 @@ stages: excludeSdkContentTests: false # 🚫 overrideDistroDisablingSha1: false # 🚫 runOnline: false # 🚫 + prepNoArtifacts: false # 🚫 + prepNoSdk: false # 🚫 - template: ../jobs/vmr-build.yml parameters: @@ -150,6 +158,8 @@ stages: excludeSdkContentTests: false # 🚫 overrideDistroDisablingSha1: false # 🚫 runOnline: false # 🚫 + prepNoArtifacts: false # 🚫 + prepNoSdk: false # 🚫 - template: ../jobs/vmr-build.yml parameters: @@ -165,6 +175,8 @@ stages: excludeSdkContentTests: false # 🚫 overrideDistroDisablingSha1: false # 🚫 runOnline: false # 🚫 + prepNoArtifacts: false # 🚫 + prepNoSdk: false # 🚫 - template: ../jobs/vmr-build.yml parameters: @@ -182,4 +194,6 @@ stages: excludeSdkContentTests: true # ✅ overrideDistroDisablingSha1: false # 🚫 runOnline: false # 🚫 + prepNoArtifacts: true # ✅ + prepNoSdk: true # ✅ reuseBuildArtifactsFrom: Fedora36_Offline diff --git a/src/SourceBuild/content/eng/Versions.props b/src/SourceBuild/content/eng/Versions.props index e466a9189b98..3e35a1fd9e72 100644 --- a/src/SourceBuild/content/eng/Versions.props +++ b/src/SourceBuild/content/eng/Versions.props @@ -25,6 +25,6 @@ necessary, and this property is removed from the file. --> 0.1.0-8.0.100-5.centos.8-x64 - 0.1.0-8.0.100-8.centos.8-x64 + 0.1.0-8.0.100-11.centos.8-x64 diff --git a/src/SourceBuild/content/prep.sh b/src/SourceBuild/content/prep.sh index 8c03cadc0d6b..0f743c47ac88 100755 --- a/src/SourceBuild/content/prep.sh +++ b/src/SourceBuild/content/prep.sh @@ -7,12 +7,18 @@ SCRIPT_ROOT="$(cd -P "$( dirname "$0" )" && pwd)" usage() { echo "usage: $0" echo "" - echo " Prepares the environment to be built by downloading Private.SourceBuilt.Artifacts.*.tar.gz and" - echo " installing the version of dotnet referenced in global.json" - echo "" + echo " Prepares the environment to be built by downloading the required archive files. This includes" + echo " the previously source-built artifacts archive, prebuilts archive, and .NET SDK." + echo "options:" + echo " --no-artifacts Exclude the download of the previously source-built artifacts archive." + echo " --no-prebuilts Exclude the download of the prebuilts archive." + echo " --no-sdk Exclude the download of the .NET SDK." } -buildBootstrap=false +downloadArtifacts=true +downloadPrebuilts=true +installDotnet=true + positional_args=() while :; do if [ $# -le 0 ]; then @@ -24,6 +30,15 @@ while :; do usage exit 0 ;; + --no-artifacts) + downloadArtifacts=false + ;; + --no-prebuilts) + downloadPrebuilts=false + ;; + --no-sdk) + installDotnet=false + ;; *) positional_args+=("$1") ;; @@ -32,10 +47,6 @@ while :; do shift done -downloadArtifacts=true -downloadPrebuilts=true -installDotnet=true - # Check to make sure curl exists to download the archive files if ! command -v curl &> /dev/null then @@ -46,20 +57,20 @@ fi # Check if Private.SourceBuilt artifacts archive exists artifactsBaseFileName="Private.SourceBuilt.Artifacts" packagesArchiveDir="$SCRIPT_ROOT/prereqs/packages/archive/" -if [ -f ${packagesArchiveDir}${artifactsBaseFileName}.*.tar.gz ]; then +if [[ "$downloadArtifacts" == "true" && -f ${packagesArchiveDir}${artifactsBaseFileName}.*.tar.gz ]]; then echo " Private.SourceBuilt.Artifacts.*.tar.gz exists...it will not be downloaded" downloadArtifacts=false fi # Check if Private.SourceBuilt prebuilts archive exists prebuiltsBaseFileName="Private.SourceBuilt.Prebuilts" -if [ -f ${packagesArchiveDir}${prebuiltsBaseFileName}.*.tar.gz ]; then +if [[ "$downloadPrebuilts" == "true" && -f ${packagesArchiveDir}${prebuiltsBaseFileName}.*.tar.gz ]]; then echo " Private.SourceBuilt.Prebuilts.*.tar.gz exists...it will not be downloaded" downloadPrebuilts=false fi # Check if dotnet is installed -if [ -d $SCRIPT_ROOT/.dotnet ]; then +if [[ "$installDotnet" == "true" && -d $SCRIPT_ROOT/.dotnet ]]; then echo " ./.dotnet SDK directory exists...it will not be installed" installDotnet=false; fi