From 191256a9890c00cca1341b1746659162e0fe7f26 Mon Sep 17 00:00:00 2001 From: Liu Shilong Date: Tue, 14 Mar 2023 13:56:03 +0800 Subject: [PATCH] [ci] Fix apt-get install unable locate package issue. (#1212) (#1220) * [ci] Fix apt-get install unable locate package issue. (#1212) * [ci] Continue on error when running test. * [ci] Allow partially succeeded builds when downaloading swss-common * Switch to using stock gcovr 5.2 (#1174) * Purge package sonic-db-cli which depends on libswsscommon (#1057) --- .azure-pipelines/build-docker-sonic-vs-template.yml | 1 + .azure-pipelines/build-swss-template.yml | 3 +++ .azure-pipelines/build-template.yml | 9 ++++++--- .azure-pipelines/build_and_install_module.sh | 1 + .azure-pipelines/docker-sonic-vs/Dockerfile | 9 +-------- .azure-pipelines/test-docker-sonic-vs-template.yml | 4 ++++ 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.azure-pipelines/build-docker-sonic-vs-template.yml b/.azure-pipelines/build-docker-sonic-vs-template.yml index 163230a66..16042c74f 100644 --- a/.azure-pipelines/build-docker-sonic-vs-template.yml +++ b/.azure-pipelines/build-docker-sonic-vs-template.yml @@ -43,6 +43,7 @@ jobs: path: $(Build.ArtifactStagingDirectory)/download runVersion: 'latestFromBranch' runBranch: 'refs/heads/$(BUILD_BRANCH)' + allowPartiallySucceededBuilds: true displayName: "Download sonic swss common deb packages" - task: DownloadPipelineArtifact@2 inputs: diff --git a/.azure-pipelines/build-swss-template.yml b/.azure-pipelines/build-swss-template.yml index 96c4c9fe3..a6ebb68cc 100644 --- a/.azure-pipelines/build-swss-template.yml +++ b/.azure-pipelines/build-swss-template.yml @@ -58,6 +58,8 @@ jobs: git status displayName: Set up sonic-swss branch - script: | + set -ex + sudo apt-get update sudo apt-get install -y libhiredis0.14 libhiredis-dev sudo apt-get install -y libzmq5 libzmq3-dev sudo apt-get install -qq -y \ @@ -76,6 +78,7 @@ jobs: artifact: ${{ parameters.swss_common_artifact_name }} runVersion: 'latestFromBranch' runBranch: 'refs/heads/$(BUILD_BRANCH)' + allowPartiallySucceededBuilds: true path: $(Build.ArtifactStagingDirectory)/download patterns: | libswsscommon_1.0.0_*.deb diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index c6b6fbaa9..8a7eb9b04 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -62,6 +62,8 @@ jobs: clean: true submodules: true - script: | + set -ex + sudo apt-get update sudo apt-get install -qq -y \ qtbase5-dev \ libdbus-glib-1-2 \ @@ -101,6 +103,7 @@ jobs: artifact: ${{ parameters.swss_common_artifact_name }} runVersion: 'latestFromBranch' runBranch: 'refs/heads/$(BUILD_BRANCH)' + allowPartiallySucceededBuilds: true path: $(Build.ArtifactStagingDirectory)/download displayName: "Download sonic swss common deb packages" - script: | @@ -124,14 +127,14 @@ jobs: - ${{ if eq(parameters.run_unit_test, true) }}: - script: | set -ex - git clone https://github.com/Spacetown/gcovr.git + git clone https://github.com/gcovr/gcovr.git cd gcovr/ - git checkout origin/recursive_search_file + git checkout 5.2 sudo pip3 install setuptools sudo python3 setup.py install cd .. sudo rm -rf gcovr - displayName: "Install gcovr 5.0 with recursive fix" + displayName: "Install gcovr 5.2 (for --exclude-throw-branches support)" - script: | set -ex make check diff --git a/.azure-pipelines/build_and_install_module.sh b/.azure-pipelines/build_and_install_module.sh index 493a2f04e..35c519634 100755 --- a/.azure-pipelines/build_and_install_module.sh +++ b/.azure-pipelines/build_and_install_module.sh @@ -26,6 +26,7 @@ function build_and_install_kmodule() SUBLEVEL=$(echo $KERNEL_MAINVERSION | cut -d. -f3) # Install the required debian packages to build the kernel modules + apt-get update apt-get install -y build-essential linux-headers-${KERNEL_RELEASE} autoconf pkg-config fakeroot apt-get install -y flex bison libssl-dev libelf-dev apt-get install -y libnl-route-3-200 libnl-route-3-dev libnl-cli-3-200 libnl-cli-3-dev libnl-3-dev diff --git a/.azure-pipelines/docker-sonic-vs/Dockerfile b/.azure-pipelines/docker-sonic-vs/Dockerfile index 174fc9285..de02bdefc 100644 --- a/.azure-pipelines/docker-sonic-vs/Dockerfile +++ b/.azure-pipelines/docker-sonic-vs/Dockerfile @@ -4,14 +4,7 @@ ARG docker_container_name ADD ["debs", "/debs"] -RUN dpkg --purge python-swsscommon -RUN dpkg --purge python3-swsscommon -RUN dpkg --purge swss -RUN dpkg --purge libsairedis -RUN dpkg --purge libswsscommon -RUN dpkg --purge libsaimetadata -RUN dpkg --purge libsaivs -RUN dpkg --purge syncd-vs +RUN dpkg --purge python-swsscommon python3-swsscommon swss libsairedis sonic-db-cli libswsscommon libsaimetadata libsaivs syncd-vs RUN dpkg -i /debs/libswsscommon_1.0.0_amd64.deb RUN dpkg -i /debs/python-swsscommon_1.0.0_amd64.deb diff --git a/.azure-pipelines/test-docker-sonic-vs-template.yml b/.azure-pipelines/test-docker-sonic-vs-template.yml index 1447c34e5..8e426374f 100644 --- a/.azure-pipelines/test-docker-sonic-vs-template.yml +++ b/.azure-pipelines/test-docker-sonic-vs-template.yml @@ -42,12 +42,14 @@ jobs: path: $(Build.ArtifactStagingDirectory)/download runVersion: 'latestFromBranch' runBranch: 'refs/heads/$(BUILD_BRANCH)' + allowPartiallySucceededBuilds: true displayName: "Download sonic swss common deb packages" - script: | set -ex sudo sonic-sairedis/.azure-pipelines/build_and_install_module.sh + sudo apt-get update sudo apt-get install -y libhiredis0.14 sudo dpkg -i --force-confask,confnew $(Build.ArtifactStagingDirectory)/download/libswsscommon_1.0.0_amd64.deb || apt-get install -f sudo dpkg -i $(Build.ArtifactStagingDirectory)/download/python3-swsscommon_1.0.0_amd64.deb @@ -67,6 +69,8 @@ jobs: sudo py.test -v --force-flaky --junitxml=tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber) rm -rf $(Build.ArtifactStagingDirectory)/download displayName: "Run vs tests" + ${{ if ne(variables['Build.Reason'], 'PullRequest') }}: + continueOnError: true - task: PublishTestResults@2 inputs: