diff --git a/.azure-pipelines/azure-pipelines-UpgrateVersion.yml b/.azure-pipelines/azure-pipelines-UpgrateVersion.yml index 3cec0871ed..b0b84cf3b1 100644 --- a/.azure-pipelines/azure-pipelines-UpgrateVersion.yml +++ b/.azure-pipelines/azure-pipelines-UpgrateVersion.yml @@ -18,10 +18,25 @@ pool: sonicbld stages: - stage: Build + variables: + CACHE_MODE: none + VERSION_CONTROL_OPTIONS: 'SONIC_VERSION_CONTROL_COMPONENTS=' jobs: - template: azure-pipelines-build.yml parameters: - buildSlave: y + buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y' + preSteps: + - script: | + containers=$(docker container ls | grep "sonic-slave" | awk '{ print $1 }') + if [ ! -z "$containers" ]; then + docker container kill $containers || true + sleep 5 + fi + images=$(docker images 'sonic-slave-*' -a -q) + if [ ! -z "$images" ]; then + docker rmi -f $images + fi + displayName: 'Cleanup sonic slave' - stage: UpgradeVersions jobs: - job: UpgradeVersions @@ -48,11 +63,14 @@ stages: cp -r $(Pipeline.Workspace)/sonic-buildimage.${default_platform}/versions target/ make freeze FREEZE_VERSION_OPTIONS=-r find files/build/versions - for artifact in $artifacts + ordered_artifacts=$(echo "$artifacts" | grep -v -E "arm64|armhf" && echo "$artifacts" | grep -E "arm64|armhf") + for artifact in $ordered_artifacts do rm -rf target/versions cp -r $artifact/versions target/ - make freeze FREEZE_VERSION_OPTIONS="-a -d" + OPTIONS="-a -d" + [[ "$artifact" == *arm64* || "$artifact" == *armhf* ]] && OPTIONS="-d" + make freeze FREEZE_VERSION_OPTIONS="$OPTIONS" done git diff files/build/versions displayName: 'Freeze Versions'