[ci]: reset the owner for all files under working directory (#6557)

reset the owner for all files under working directory. some files were owned by root after build, which cause
next build to fail since directory cannot be cleanned.

Signed-off-by: Guohan Lu <lguohan@gmail.com>
This commit is contained in:
lguohan 2021-01-25 19:05:01 -08:00 committed by GitHub
parent 84985e103d
commit 6957e376be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,11 +125,13 @@ stages:
sudo docker load -i /nfs/azpl/kvmimage/docker-sonic-vs.$(Build.BuildNumber).gz
docker tag docker-sonic-vs:latest docker-sonic-vs:$(Build.BuildNumber)
username=$(id -un)
set -x
trap "docker ps; docker images; ip netns list; \
docker rmi docker-sonic-vs:$(Build.BuildNumber); \
ip netns list | grep -E [-]srv[0-9]+ | awk '{print $1}' | xargs -I {} sudo ip netns delete {}; \
sudo chown -R ${username}.${username} ." EXIT
sudo chown -R ${username}.${username} .; \
sudo chown -R ${username}.${username} $(System.DefaultWorkingDirectory)" EXIT
pushd platform/vs/tests
sudo py.test -v --junitxml=tr.xml --imgname=docker-sonic-vs:$(Build.BuildNumber) && \
sudo rm /nfs/azpl/kvmimage/docker-sonic-vs.$(Build.BuildNumber).gz