From 69c583215335736c22a6af53b18869d9fd734132 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Wed, 27 Jan 2021 19:58:58 -0800 Subject: [PATCH] [ci]: Download artifact instead of using nfs storage (#6570) I notice that I rerun a failed job (not the stages), the nfs store is already cleaned by previous failed jobs. --- azure-pipelines.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3b5f81d24b..84f23a52a5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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 @@ -122,13 +120,18 @@ 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); \ @@ -136,8 +139,7 @@ stages: 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 @@ -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 @@ -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"