Skip to content

Commit

Permalink
[ci]: cleanup fsroot reliably
Browse files Browse the repository at this point in the history
use trap to clean up fsroot reliably

Signed-off-by: Guohan Lu <[email protected]>
  • Loading branch information
lguohan committed Jan 12, 2021
1 parent d4f9fa5 commit e1dd7c5
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ stages:
sudo modprobe overlay
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=rcache SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/broadcom"
ENABLE_DOCKER_BASE_PULL=y make configure PLATFORM=broadcom
trap "sudo rm -rf fsroot" EXIT
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/sonic-broadcom.bin
displayName: 'Build sonic image'
- script: |
sudo rm -rf fsroot
displayName: 'Clean up build artifacts'
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-buildimage.broadcom
displayName: "Archive sonic image"
Expand All @@ -56,11 +54,9 @@ stages:
sudo modprobe overlay
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=rcache SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/mellanox"
ENABLE_DOCKER_BASE_PULL=y make configure PLATFORM=mellanox
trap "sudo rm -rf fsroot" EXIT
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/sonic-mellanox.bin
displayName: 'Build sonic image'
- script: |
sudo rm -rf fsroot
displayName: 'Clean up build artifacts'
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-buildimage.mellanox
displayName: "Archive sonic image"
Expand All @@ -78,12 +74,10 @@ stages:
sudo modprobe overlay
CACHE_OPTIONS="SONIC_DPKG_CACHE_METHOD=rcache SONIC_DPKG_CACHE_SOURCE=/nfs/dpkg_cache/vs"
ENABLE_DOCKER_BASE_PULL=y make configure PLATFORM=vs
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/sonic-vs.img.gz
sudo cp target/sonic-vs.img.gz /nfs/azpl/kvmimage/sonic-vs.$(Build.BuildNumber).img.gz
trap "sudo rm -rf fsroot" EXIT
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS target/sonic-vs.img.gz && \
sudo cp target/sonic-vs.img.gz /nfs/azpl/kvmimage/sonic-vs.$(Build.BuildNumber).img.gz
displayName: 'Build sonic image'
- script: |
sudo rm -rf fsroot
displayName: 'Clean up build artifacts'
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-buildimage.kvm
displayName: "Archive sonic image"
Expand Down

0 comments on commit e1dd7c5

Please sign in to comment.