[ci] Fix remove sonic-slave-* docker image issue when building sonic-slave* (#10296) (#10381)

This commit is contained in:
Shilong Liu 2022-03-30 16:08:52 +08:00 committed by GitHub
parent ca85c6be5e
commit ab91b607f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,14 @@
trigger: none trigger: none
pr: none pr: none
resources:
repositories:
- repository: buildimage
type: github
name: Azure/sonic-buildimage
ref: master
endpoint: build
schedules: schedules:
- cron: "0 0 * * *" - cron: "0 0 * * *"
displayName: Daily Build displayName: Daily Build
@ -41,17 +49,7 @@ stages:
jobFilters: ${{ parameters.jobFilters }} jobFilters: ${{ parameters.jobFilters }}
buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y' buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y'
preSteps: preSteps:
- script: | - template: .azure-pipelines/template-clean-sonic-slave.yml@buildimage
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 - stage: UpgradeVersions
jobs: jobs:
- job: UpgradeVersions - job: UpgradeVersions