Skip to content

Commit

Permalink
[ci]: Download artifact instead of using nfs storage (#6570)
Browse files Browse the repository at this point in the history
I notice that I rerun a failed job (not the stages), the nfs store is already cleaned by previous failed jobs.
  • Loading branch information
qiluo-msft authored Jan 28, 2021
1 parent f7346cc commit 69c5832
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ stages:
ENABLE_DOCKER_BASE_PULL=y make configure PLATFORM=vs
trap "sudo rm -rf fsroot" EXIT
make USERNAME=admin SONIC_BUILD_JOBS=$(nproc) $CACHE_OPTIONS \
target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz && \
sudo cp target/sonic-vs.img.gz /nfs/azpl/kvmimage/sonic-vs.$(Build.BuildNumber).img.gz && \
sudo cp target/docker-sonic-vs.gz /nfs/azpl/kvmimage/docker-sonic-vs.$(Build.BuildNumber).gz
target/docker-sonic-vs.gz target/sonic-vs.img.gz target/docker-ptf.gz
displayName: 'Build sonic image'
- publish: $(System.DefaultWorkingDirectory)/
artifact: sonic-buildimage.kvm
Expand Down Expand Up @@ -122,22 +120,26 @@ stages:
runBranch: 'refs/heads/master'
displayName: "Download sonic swss common deb packages"

- task: DownloadPipelineArtifact@2
inputs:
artifact: sonic-buildimage.kvm
displayName: "Download sonic-buildimage.kvm artifact"

- script: |
set -x
sudo dpkg -i --force-confask,confnew ../sonic-swss-common.amd64.ubuntu20_04/libswsscommon_1.0.0_amd64.deb
sudo dpkg -i ../sonic-swss-common.amd64.ubuntu20_04/python3-swsscommon_1.0.0_amd64.deb
sudo docker load -i /nfs/azpl/kvmimage/docker-sonic-vs.$(Build.BuildNumber).gz
sudo docker load -i ../target/docker-sonic-vs.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} .; \
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
sudo py.test -v --junitxml=tr.xml --imgname=docker-sonic-vs:$(Build.BuildNumber)
displayName: "Run vs tests"
- task: PublishTestResults@2
Expand All @@ -149,9 +151,15 @@ stages:
displayName: "kvmtest"
timeoutInMinutes: 240
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifact: sonic-buildimage.kvm
displayName: "Download sonic-buildimage.kvm artifact"

- script: |
set -x
sudo mkdir -p /data/sonic-vm/images
sudo cp -v /nfs/azpl/kvmimage/sonic-vs.$(Build.BuildNumber).img.gz /data/sonic-vm/images/sonic-vs.img.gz
sudo cp -v ../target/sonic-vs.img.gz /data/sonic-vm/images/sonic-vs.img.gz
sudo gzip -fd /data/sonic-vm/images/sonic-vs.img.gz
username=$(id -un)
sudo chown -R $username.$username /data/sonic-vm
Expand Down Expand Up @@ -193,8 +201,6 @@ stages:
exit 2
else
sudo rm /nfs/azpl/kvmimage/sonic-vs.$(Build.BuildNumber).img.gz
cp -r /data/sonic-mgmt/tests/logs $(Build.ArtifactStagingDirectory)/
fi
displayName: "Run T0 tests"
Expand Down

0 comments on commit 69c5832

Please sign in to comment.