From 8928b72143de1428f1516e68b3584acfecb4846c Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 10 Feb 2021 04:15:40 -0800 Subject: [PATCH 1/8] [ci]: use build template Signed-off-by: Guohan Lu --- .azure-pipelines/build-template.yml | 101 +++++++++++++ azure-pipelines.yml | 223 ++++------------------------ 2 files changed, 132 insertions(+), 192 deletions(-) create mode 100644 .azure-pipelines/build-template.yml diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml new file mode 100644 index 0000000000..8ecbba2951 --- /dev/null +++ b/.azure-pipelines/build-template.yml @@ -0,0 +1,101 @@ +parameters: +- name: arch + type: string + values: + - amd64 + - armhf + - arm64 + +- name: pool + type: string + values: + - sonicbld + default: '' + +- name: timeout + type: number + default: 60 + +- name: sonic_slave + type: string + +- name: sairedis_artifact_name + type: string + +- name: swss_common_artifact_name + type: string + +- name: artifact_name + type: string + +jobs: +- job: + displayName: ${{ parameters.arch }} + timeoutInMinutes: ${{ parameters.timeout }} + + - ${{ if eq(parameters.pool, '') }}: + pool: + vmImage: 'ubuntu-20.04' + + - ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + + container: + image: sonicdev-microsoft.azurecr.io:443/${{ parameters.sonic_slave }}:latest + + steps: + - script: | + sudo apt-get install -y libhiredis0.14 libhiredis-dev + sudo apt-get install -y libzmq5 libzmq3-dev + sudo apt-get install -qq -y \ + libhiredis-dev \ + libnl-3-dev \ + libnl-genl-3-dev \ + libnl-route-3-dev \ + libnl-nf-3-dev \ + swig3.0 + sudo apt-get install -y libdbus-1-3 + sudo apt-get install -y libteam-dev \ + libteam5 \ + libteamdctl0 + displayName: "Install dependencies" + - task: DownloadPipelineArtifact@2 + inputs: + source: specific + project: build + pipeline: 9 + artifacts: sonic-swss-common + artifacts: ${{ parameters.swss_common_artifact_name }} + runVersion: 'latestFromBranch' + runBranch: 'refs/heads/master' + displayName: "Download sonic swss common deb packages" + - task: DownloadPipelineArtifact@2 + inputs: + source: specific + project: build + pipeline: 12 + artifacts: ${{ parameters.sairedis_artifact_name }} + runVersion: 'latestFromBranch' + runBranch: 'refs/heads/master' + displayName: "Download sonic sairedis deb packages" + - script: | + sudo dpkg -i ${{ parameters.swss_common_artifact_name }}/libswsscommon_1.0.0_${{ parameters.arch }}.deb + sudo dukg -i ${{ parameters.swss_common_artifact_name }}/libswsscommon-dev_1.0.0_${{ parameters.arch }].deb + sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsaivs_*.deb + sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsaivs-dev_*.deb + sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsairedis_*.deb + sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsairedis-dev_*.deb + sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsaimetadata_*.deb + sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsaimetadata-dev_*.deb + sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/syncd-vs_*.deb + workingDirectory: $(Pipeline.Workspace) + displayName: "Install sonic swss common and sairedis" + - checkout: self + submodules: true + - script: | + ./autogen.sh + dpkg-buildpackage -us -uc -b -j$(nproc) && cp ../*.deb . + displayName: "Compile sonic swss" + - publish: $(System.DefaultWorkingDirectory)/ + artifact: ${{ parameters.artifact_name }} + displayName: "Archive swss debian packages" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 852253aa49..af3222caec 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,195 +8,34 @@ trigger: include: - "*" -jobs: -- job: - displayName: "amd64" - pool: - vmImage: 'ubuntu-20.04' - - container: - image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster:latest - - steps: - - script: | - sudo apt-get install -y libhiredis0.14 libhiredis-dev - sudo apt-get install -y libzmq5 libzmq3-dev - sudo apt-get install -qq -y \ - libhiredis-dev \ - libnl-3-dev \ - libnl-genl-3-dev \ - libnl-route-3-dev \ - libnl-nf-3-dev \ - swig3.0 - sudo apt-get install -y libdbus-1-3 - sudo apt-get install -y libteam-dev \ - libteam5 \ - libteamdctl0 - displayName: "Install dependencies" - - task: DownloadPipelineArtifact@2 - inputs: - source: specific - project: build - pipeline: 9 - artifacts: sonic-swss-common - runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' - displayName: "Download sonic swss common deb packages" - - task: DownloadPipelineArtifact@2 - inputs: - source: specific - project: build - pipeline: 12 - artifacts: sonic-sairedis - runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' - displayName: "Download sonic sairedis deb packages" - - script: | - sudo dpkg -i sonic-swss-common/libswsscommon_1.0.0_amd64.deb - sudo dpkg -i sonic-swss-common/libswsscommon-dev_1.0.0_amd64.deb - sudo dpkg -i sonic-sairedis/libsaivs_*.deb - sudo dpkg -i sonic-sairedis/libsaivs-dev_*.deb - sudo dpkg -i sonic-sairedis/libsairedis_*.deb - sudo dpkg -i sonic-sairedis/libsairedis-dev_*.deb - sudo dpkg -i sonic-sairedis/libsaimetadata_*.deb - sudo dpkg -i sonic-sairedis/libsaimetadata-dev_*.deb - sudo dpkg -i sonic-sairedis/syncd-vs_*.deb - workingDirectory: $(Pipeline.Workspace) - displayName: "Install sonic swss common and sairedis" - - checkout: self - submodules: true - - script: | - ./autogen.sh - dpkg-buildpackage -us -uc -b -j$(nproc) && cp ../*.deb . - displayName: "Compile sonic swss" - - publish: $(System.DefaultWorkingDirectory)/ - artifact: sonic-swss - displayName: "Archive swss debian packages" - -- job: - displayName: "arm64" - timeoutInMinutes: 180 - pool: sonicbld - - container: - image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster-arm64:latest - - steps: - - script: | - sudo apt-get install -y libhiredis0.14 libhiredis-dev - sudo apt-get install -y libzmq5 libzmq3-dev - sudo apt-get install -qq -y \ - libhiredis-dev \ - libnl-3-dev \ - libnl-genl-3-dev \ - libnl-route-3-dev \ - libnl-nf-3-dev \ - swig3.0 - sudo apt-get install -y libdbus-1-3 - sudo apt-get install -y libteam-dev \ - libteam5 \ - libteamdctl0 - displayName: "Install dependencies" - - task: DownloadPipelineArtifact@2 - inputs: - source: specific - project: build - pipeline: 9 - artifacts: sonic-swss-common.arm64 - runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' - displayName: "Download sonic swss common deb packages" - - task: DownloadPipelineArtifact@2 - inputs: - source: specific - project: build - pipeline: 12 - artifacts: sonic-sairedis.arm64 - runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' - displayName: "Download sonic sairedis deb packages" - - script: | - sudo dpkg -i sonic-swss-common.arm64/libswsscommon_1.0.0_arm64.deb - sudo dpkg -i sonic-swss-common.arm64/libswsscommon-dev_1.0.0_arm64.deb - sudo dpkg -i sonic-sairedis.arm64/libsaivs_*.deb - sudo dpkg -i sonic-sairedis.arm64/libsaivs-dev_*.deb - sudo dpkg -i sonic-sairedis.arm64/libsairedis_*.deb - sudo dpkg -i sonic-sairedis.arm64/libsairedis-dev_*.deb - sudo dpkg -i sonic-sairedis.arm64/libsaimetadata_*.deb - sudo dpkg -i sonic-sairedis.arm64/libsaimetadata-dev_*.deb - sudo dpkg -i sonic-sairedis.arm64/syncd-vs_*.deb - workingDirectory: $(Pipeline.Workspace) - displayName: "Install sonic swss common and sairedis" - - checkout: self - submodules: true - - script: | - ./autogen.sh - dpkg-buildpackage -us -uc -b -j$(nproc) && cp ../*.deb . - displayName: "Compile sonic swss" - - publish: $(System.DefaultWorkingDirectory)/ - artifact: sonic-swss.arm64 - displayName: "Archive swss debian packages" - -- job: - displayName: "armhf" - timeoutInMinutes: 180 - pool: sonicbld - - container: - image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster-armhf:latest - - steps: - - script: | - sudo apt-get install -y libhiredis0.14 libhiredis-dev - sudo apt-get install -y libzmq5 libzmq3-dev - sudo apt-get install -qq -y \ - libhiredis-dev \ - libnl-3-dev \ - libnl-genl-3-dev \ - libnl-route-3-dev \ - libnl-nf-3-dev \ - swig3.0 - sudo apt-get install -y libdbus-1-3 - sudo apt-get install -y libteam-dev \ - libteam5 \ - libteamdctl0 - displayName: "Install dependencies" - - task: DownloadPipelineArtifact@2 - inputs: - source: specific - project: build - pipeline: 9 - artifacts: sonic-swss-common.armhf - runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' - displayName: "Download sonic swss common deb packages" - - task: DownloadPipelineArtifact@2 - inputs: - source: specific - project: build - pipeline: 12 - artifacts: sonic-sairedis.armhf - runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' - displayName: "Download sonic sairedis deb packages" - - script: | - sudo dpkg -i sonic-swss-common.armhf/libswsscommon_1.0.0_armhf.deb - sudo dpkg -i sonic-swss-common.armhf/libswsscommon-dev_1.0.0_armhf.deb - sudo dpkg -i sonic-sairedis.armhf/libsaivs_*.deb - sudo dpkg -i sonic-sairedis.armhf/libsaivs-dev_*.deb - sudo dpkg -i sonic-sairedis.armhf/libsairedis_*.deb - sudo dpkg -i sonic-sairedis.armhf/libsairedis-dev_*.deb - sudo dpkg -i sonic-sairedis.armhf/libsaimetadata_*.deb - sudo dpkg -i sonic-sairedis.armhf/libsaimetadata-dev_*.deb - sudo dpkg -i sonic-sairedis.armhf/syncd-vs_*.deb - workingDirectory: $(Pipeline.Workspace) - displayName: "Install sonic swss common and sairedis" - - checkout: self - submodules: true - - script: | - ./autogen.sh - dpkg-buildpackage -us -uc -b -j$(nproc) && cp ../*.deb . - displayName: "Compile sonic swss" - - publish: $(System.DefaultWorkingDirectory)/ - artifact: sonic-swss.armhf - displayName: "Archive swss debian packages" +stages: +- stage: Build + + jobs: + - template: .azure-pipelines/build-template.yml + parameters: + arch: amd64 + sonic_slave: sonic-slave-buster + swss_common_artifact_name: sonic-swss-common + sairedis_artifact_name: sonic-sairedis + artifact_name: sonic-swss + + - template: .azure-pipelines/build-template.yml + parameters: + arch: armhf + timeout: 240 + pool: sonicbld + sonic_slave: sonic-slave-buster-armhf + swss_common_artifact_name: sonic-swss-common.armhf + sairedis_artifact_name: sonic-sairedis.armhf + artifact_name: sonic-swss.armhf + + - template: .azure-pipelines/build-template.yml + parameters: + arch: arm64 + timeout: 240 + pool: sonicbld + sonic_slave: sonic-slave-buster-arm64 + swss_common_artifact_name: sonic-swss-common.arm64 + sairedis_artifact_name: sonic-sairedis.arm64 + artifact_name: sonic-swss.arm64 From 947e4f29325101753fff8e7fa346b729e8f8e455 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 10 Feb 2021 04:18:07 -0800 Subject: [PATCH 2/8] fix syntax error Signed-off-by: Guohan Lu --- .azure-pipelines/build-template.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index 8ecbba2951..1b9246a4b2 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -34,11 +34,11 @@ jobs: timeoutInMinutes: ${{ parameters.timeout }} - ${{ if eq(parameters.pool, '') }}: - pool: - vmImage: 'ubuntu-20.04' + - pool: + vmImage: 'ubuntu-20.04' - ${{ if ne(parameters.pool, '') }}: - pool: ${{ parameters.pool }} + - pool: ${{ parameters.pool }} container: image: sonicdev-microsoft.azurecr.io:443/${{ parameters.sonic_slave }}:latest From 82def51e34d77ec2d8bd63d5df23331a4ad809a2 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 10 Feb 2021 04:28:04 -0800 Subject: [PATCH 3/8] fix syntax Signed-off-by: Guohan Lu --- .azure-pipelines/build-template.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index 1b9246a4b2..b8bba52b99 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -33,12 +33,11 @@ jobs: displayName: ${{ parameters.arch }} timeoutInMinutes: ${{ parameters.timeout }} - - ${{ if eq(parameters.pool, '') }}: - - pool: - vmImage: 'ubuntu-20.04' - - - ${{ if ne(parameters.pool, '') }}: - - pool: ${{ parameters.pool }} + pool: + ${{ if ne(paramters.pool, '') }}: + name: ${{ parameters.pool }} + ${{ if eq(paramters.pool, '') }}: + vmImage: 'ubuntu-20.04' container: image: sonicdev-microsoft.azurecr.io:443/${{ parameters.sonic_slave }}:latest From 381deae034d63224c672fc530847450d00e54cbb Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 10 Feb 2021 04:29:28 -0800 Subject: [PATCH 4/8] fix typos Signed-off-by: Guohan Lu --- .azure-pipelines/build-template.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index b8bba52b99..fc10347322 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -63,7 +63,6 @@ jobs: source: specific project: build pipeline: 9 - artifacts: sonic-swss-common artifacts: ${{ parameters.swss_common_artifact_name }} runVersion: 'latestFromBranch' runBranch: 'refs/heads/master' @@ -79,7 +78,7 @@ jobs: displayName: "Download sonic sairedis deb packages" - script: | sudo dpkg -i ${{ parameters.swss_common_artifact_name }}/libswsscommon_1.0.0_${{ parameters.arch }}.deb - sudo dukg -i ${{ parameters.swss_common_artifact_name }}/libswsscommon-dev_1.0.0_${{ parameters.arch }].deb + sudo dukg -i ${{ parameters.swss_common_artifact_name }}/libswsscommon-dev_1.0.0_${{ parameters.arch }}.deb sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsaivs_*.deb sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsaivs-dev_*.deb sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsairedis_*.deb From 7974ea46ba8b97eea0d98bc478377228cb63caff Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 10 Feb 2021 04:30:32 -0800 Subject: [PATCH 5/8] fix typo Signed-off-by: Guohan Lu --- .azure-pipelines/build-template.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index fc10347322..6979979498 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -10,7 +10,6 @@ parameters: type: string values: - sonicbld - default: '' - name: timeout type: number From ab65de71f031c663aa4c7fb7e6499e6082481da7 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 10 Feb 2021 04:33:44 -0800 Subject: [PATCH 6/8] set default value for pool parameters Signed-off-by: Guohan Lu --- .azure-pipelines/build-template.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index 6979979498..73d5a763f1 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -10,6 +10,8 @@ parameters: type: string values: - sonicbld + - default + default: default - name: timeout type: number @@ -33,9 +35,9 @@ jobs: timeoutInMinutes: ${{ parameters.timeout }} pool: - ${{ if ne(paramters.pool, '') }}: + ${{ if ne(paramters.pool, 'default') }}: name: ${{ parameters.pool }} - ${{ if eq(paramters.pool, '') }}: + ${{ if eq(paramters.pool, 'default') }}: vmImage: 'ubuntu-20.04' container: From 9da1aeb5d15a50cf9b3f7fc32a47833eb31d0ce8 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 10 Feb 2021 04:34:34 -0800 Subject: [PATCH 7/8] fix typos Signed-off-by: Guohan Lu --- .azure-pipelines/build-template.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index 73d5a763f1..a3fbd49f39 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -35,9 +35,9 @@ jobs: timeoutInMinutes: ${{ parameters.timeout }} pool: - ${{ if ne(paramters.pool, 'default') }}: + ${{ if ne(parameters.pool, 'default') }}: name: ${{ parameters.pool }} - ${{ if eq(paramters.pool, 'default') }}: + ${{ if eq(parameters.pool, 'default') }}: vmImage: 'ubuntu-20.04' container: From e187ba15be0797545e78174ae335296ca846d902 Mon Sep 17 00:00:00 2001 From: Guohan Lu Date: Wed, 10 Feb 2021 04:51:32 -0800 Subject: [PATCH 8/8] fix typo Signed-off-by: Guohan Lu --- .azure-pipelines/build-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index a3fbd49f39..7d8e12c3ab 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -79,7 +79,7 @@ jobs: displayName: "Download sonic sairedis deb packages" - script: | sudo dpkg -i ${{ parameters.swss_common_artifact_name }}/libswsscommon_1.0.0_${{ parameters.arch }}.deb - sudo dukg -i ${{ parameters.swss_common_artifact_name }}/libswsscommon-dev_1.0.0_${{ parameters.arch }}.deb + sudo dpkg -i ${{ parameters.swss_common_artifact_name }}/libswsscommon-dev_1.0.0_${{ parameters.arch }}.deb sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsaivs_*.deb sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsaivs-dev_*.deb sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsairedis_*.deb