Enable bootstrap flow testing in CI (#15774)

This commit is contained in:
Matt Thalman 2023-03-14 11:17:21 -05:00 committed by GitHub
parent 797f74b245
commit d625015437
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 16 deletions

View file

@ -53,6 +53,7 @@ parameters:
type: boolean
default: false
# Use the previous version's SDK to build the current one
- name: withPreviousSDK
type: boolean
default: false
@ -160,22 +161,28 @@ jobs:
- script: |
set -x
if [[ -z '${{ parameters.reuseBuildArtifactsFrom }}' && '${{ parameters.withPreviousSDK }}' != 'True' ]]; then
docker run --rm -v "$(sourcesPath):/vmr" -w /vmr ${{ parameters.container }} ./prep.sh
else
customPrepArgs=""
prepSdk=true
if [[ '${{ parameters.withPreviousSDK }}' == 'True' ]]; then
# Source-built artifacts are from CentOS 8 Stream. We want to download them without
# downloading portable versions from the internet.
customPrepArgs="${customPrepArgs} --no-sdk --no-bootstrap"
prepSdk=false
elif [[ -n '${{ parameters.reuseBuildArtifactsFrom }}' ]]; then
customPrepArgs="${customPrepArgs} --no-sdk --no-artifacts"
prepSdk=false
fi
if [[ "$prepSdk" == "false" ]]; then
mkdir $(sourcesPath)/.dotnet
previousSdkPath="$(sourcesPath)/prereqs/packages/archive/dotnet-sdk-*.tar.gz"
eval tar -ozxf "$previousSdkPath" -C "$(sourcesPath)/.dotnet"
eval rm -f "$previousSdkPath"
if [[ '${{ parameters.withPreviousSDK }}' == 'True' ]]; then
# Source-built artifacts are from CentOS 8 Stream. We want to download them without
# downloading portable versions from the internet.
docker run --rm -v "$(sourcesPath):/vmr" -w /vmr ${{ parameters.container }} ./prep.sh --no-bootstrap
fi
echo "##vso[task.setvariable variable=additionalBuildArgs]--with-sdk /vmr/.dotnet"
fi
docker run --rm -v "$(sourcesPath):/vmr" -w /vmr ${{ parameters.container }} ./prep.sh ${customPrepArgs}
displayName: Prep the Build
- script: |

View file

@ -10,11 +10,17 @@ usage() {
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 "options:"
echo " --no-bootstrap Don't replace portable packages in the download source-built artifacts"
echo " --no-artifacts Exclude the download of the previously source-built artifacts archive."
echo " --no-bootstrap Don't replace portable packages in the download source-built artifacts"
echo " --no-prebuilts Exclude the download of the prebuilts archive."
echo " --no-sdk Exclude the download of the .NET SDK."
echo ""
}
buildBootstrap=true
downloadArtifacts=true
downloadPrebuilts=true
installDotnet=true
positional_args=()
while :; do
if [ $# -le 0 ]; then
@ -29,6 +35,15 @@ while :; do
--no-bootstrap)
buildBootstrap=false
;;
--no-artifacts)
downloadArtifacts=false
;;
--no-prebuilts)
downloadPrebuilts=false
;;
--no-sdk)
installDotnet=false
;;
*)
positional_args+=("$1")
;;
@ -37,9 +52,12 @@ while :; do
shift
done
downloadArtifacts=true
downloadPrebuilts=true
installDotnet=true
# Attempting to bootstrap without an SDK will fail. So either the --no-sdk flag must be passed
# or a pre-existing .dotnet SDK directory must exist.
if [[ "$buildBootstrap" == "true" && "$installDotnet" == "false" && ! -d $SCRIPT_ROOT/.dotnet ]]; then
echo " ERROR: --no-sdk requires --no-bootstrap or a pre-existing .dotnet SDK directory. Exiting..."
exit -1
fi
# Check to make sure curl exists to download the archive files
if ! command -v curl &> /dev/null
@ -51,20 +69,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