Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Paralize azure pipeline #1046

Draft
wants to merge 1 commit into
base: 202106
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions .azure-pipelines/build-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,42 +32,48 @@ jobs:
vmImage: 'ubuntu-20.04'

steps:
- checkout: self
clean: true
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 9
pipeline: Azure.sonic-swss-common
artifact: ${{ parameters.swss_common_artifact_name }}
path: $(Build.ArtifactStagingDirectory)/download
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/202106'
allowPartiallySucceededBuilds: true
allowFailedBuilds: true
runBranch: 'refs/heads/$(BUILD_BRANCH)'
displayName: "Download sonic swss common deb packages"
- task: DownloadPipelineArtifact@2
inputs:
artifact: ${{ parameters.sairedis_artifact_name }}
path: $(Build.ArtifactStagingDirectory)/download
displayName: "Download sonic sairedis deb packages"
- task: DownloadPipelineArtifact@2
inputs:
artifact: ${{ parameters.swss_artifact_name }}
path: $(Build.ArtifactStagingDirectory)/download
displayName: "Download sonic swss artifact"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 142
pipeline: Azure.sonic-buildimage.official.vs
artifact: sonic-buildimage.vs
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/202106'
displayName: "Download sonic buildimage"
runBranch: 'refs/heads/$(BUILD_BRANCH)'
path: $(Build.ArtifactStagingDirectory)/download
patterns: '**/target/docker-sonic-vs.gz'
displayName: "Download sonic-buildimage docker-sonic-vs"
- script: |
set -ex
echo $(Build.DefinitionName).$(Build.BuildNumber)

docker load < ../target/docker-sonic-vs.gz
docker load < $(Build.ArtifactStagingDirectory)/download/target/docker-sonic-vs.gz

mkdir -p .azure-pipelines/docker-sonic-vs/debs

cp -v ../*.deb .azure-pipelines/docker-sonic-vs/debs
cp -v $(Build.ArtifactStagingDirectory)/download/*.deb .azure-pipelines/docker-sonic-vs/debs

pushd .azure-pipelines

Expand All @@ -76,7 +82,8 @@ jobs:
popd

docker save docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber) | gzip -c > $(Build.ArtifactStagingDirectory)/docker-sonic-vs.gz
displayName: "Build sonic-docker-vs"
rm -rf $(Build.ArtifactStagingDirectory)/download
displayName: "Build docker-sonic-vs"

- publish: $(Build.ArtifactStagingDirectory)/
artifact: ${{ parameters.artifact_name }}
Expand Down
81 changes: 55 additions & 26 deletions .azure-pipelines/build-swss-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ parameters:
- name: sonic_slave
type: string

- name: debian_version
type: string

- name: sairedis_artifact_name
type: string

Expand All @@ -38,22 +41,27 @@ jobs:
pool:
${{ if ne(parameters.pool, 'default') }}:
name: ${{ parameters.pool }}
${{ if eq(parameters.pool, 'default') }}:
${{ else }}:
vmImage: 'ubuntu-20.04'

container:
image: sonicdev-microsoft.azurecr.io:443/${{ parameters.sonic_slave }}:latest

steps:
- checkout: sonic-swss
submodules: true
clean: true
- script: |
set -ex
git checkout $(BUILD_BRANCH)
git submodule update
git status
displayName: Set up sonic-swss branch
- 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 \
Expand All @@ -64,36 +72,57 @@ jobs:
inputs:
source: specific
project: build
pipeline: 9
pipeline: Azure.sonic-swss-common
artifact: ${{ parameters.swss_common_artifact_name }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/202106'
allowPartiallySucceededBuilds: true
allowFailedBuilds: true
runBranch: 'refs/heads/$(BUILD_BRANCH)'
path: $(Build.ArtifactStagingDirectory)/download
patterns: |
libswsscommon_1.0.0_*.deb
libswsscommon-dev_1.0.0*.deb
displayName: "Download sonic swss common deb packages"
- task: DownloadPipelineArtifact@2
inputs:
artifact: ${{ parameters.sairedis_artifact_name }}
displayName: "Download sonic sairedis deb packages"
path: $(Build.ArtifactStagingDirectory)/download
patterns: |
libsaivs_*.deb
libsaivs-dev_*.deb
libsairedis_*.deb
libsairedis-dev_*.deb
libsaimetadata_*.deb
libsaimetadata-dev_*.deb
syncd-vs_*.deb
displayName: "Download pre-stage built ${{ parameters.sairedis_artifact_name }}"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: Azure.sonic-buildimage.common_libs
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/$(BUILD_BRANCH)'
path: $(Build.ArtifactStagingDirectory)/download
artifact: common-lib
patterns: |
target/debs/${{ parameters.debian_version }}/libnl-3*.deb
target/debs/${{ parameters.debian_version }}/libnl-genl*.deb
target/debs/${{ parameters.debian_version }}/libnl-route*.deb
target/debs/${{ parameters.debian_version }}/libnl-nf*.deb
displayName: "Download common libs"

- script: |
sudo dpkg -i libswsscommon_1.0.0_${{ parameters.arch }}.deb
sudo dpkg -i libswsscommon-dev_1.0.0_${{ parameters.arch }}.deb
sudo dpkg -i libsaivs_*.deb
sudo dpkg -i libsaivs-dev_*.deb
sudo dpkg -i libsairedis_*.deb
sudo dpkg -i libsairedis-dev_*.deb
sudo dpkg -i libsaimetadata_*.deb
sudo dpkg -i libsaimetadata-dev_*.deb
sudo dpkg -i syncd-vs_*.deb
workingDirectory: $(Pipeline.Workspace)
displayName: "Install sonic swss common and sairedis"
- checkout: sonic-swss
path: s
submodules: true
set -ex
sudo dpkg -i $(find ./download -name *.deb)
rm -rf download || true
workingDirectory: $(Build.ArtifactStagingDirectory)
displayName: "Install libnl3, sonic swss common, and sairedis"
- script: |
set -ex
rm ../*.deb || true
./autogen.sh
dpkg-buildpackage -us -uc -b -j$(nproc) && cp ../*.deb .
dpkg-buildpackage -us -uc -b -j$(nproc)
mv ../*.deb $(Build.ArtifactStagingDirectory)
displayName: "Compile sonic swss"
- publish: $(System.DefaultWorkingDirectory)/
- publish: $(Build.ArtifactStagingDirectory)
artifact: ${{ parameters.artifact_name }}
displayName: "Archive swss debian packages"
29 changes: 18 additions & 11 deletions .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ parameters:
type: string
values:
- sonicbld
- sonicbld-arm64
- sonicbld-armhf
- default
default: default

Expand Down Expand Up @@ -41,13 +43,16 @@ jobs:
pool:
${{ if ne(parameters.pool, 'default') }}:
name: ${{ parameters.pool }}
${{ if eq(parameters.pool, 'default') }}:
${{ else }}:
vmImage: 'ubuntu-20.04'

container:
image: sonicdev-microsoft.azurecr.io:443/${{ parameters.sonic_slave }}:latest

steps:
- checkout: self
clean: true
submodules: true
- script: |
sudo apt-get install -qq -y \
qtbase5-dev \
Expand Down Expand Up @@ -82,23 +87,25 @@ jobs:
inputs:
source: specific
project: build
pipeline: 9
pipeline: Azure.sonic-swss-common
artifact: ${{ parameters.swss_common_artifact_name }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/202106'
allowPartiallySucceededBuilds: true
allowFailedBuilds: true
runBranch: 'refs/heads/$(BUILD_BRANCH)'
path: $(Build.ArtifactStagingDirectory)/download
displayName: "Download sonic swss common deb packages"
- script: |
sudo dpkg -i libswsscommon_1.0.0_${{ parameters.arch }}.deb
sudo dpkg -i libswsscommon-dev_1.0.0_${{ parameters.arch }}.deb
workingDirectory: $(Pipeline.Workspace)
set -ex
sudo dpkg -i download/libswsscommon_1.0.0_${{ parameters.arch }}.deb
sudo dpkg -i download/libswsscommon-dev_1.0.0_${{ parameters.arch }}.deb
rm -rf download
workingDirectory: $(Build.ArtifactStagingDirectory)
displayName: "Install sonic swss Common"
- checkout: self
submodules: true
- script: |
set -ex
rm ../*.deb || true
./autogen.sh
fakeroot dpkg-buildpackage -b -us -uc -Tbinary-syncd-vs -j$(nproc) && cp ../*.deb .
fakeroot dpkg-buildpackage -b -us -uc -Tbinary-syncd-vs -j$(nproc)
mv ../*.deb .
displayName: "Compile sonic sairedis"
- script: |
sudo cp azsyslog.conf /etc/rsyslog.conf
Expand Down
46 changes: 27 additions & 19 deletions .azure-pipelines/test-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
- name: timeout
type: number
default: 180
default: 360

- name: log_artifact_name
type: string
Expand All @@ -11,39 +11,46 @@ jobs:
displayName: vstest
timeoutInMinutes: ${{ parameters.timeout }}

pool:
vmImage: 'ubuntu-20.04'
pool: sonic-common

steps:
- script: |
ls -A1 | xargs -I{} sudo rm -rf {}
displayName: "Clean workspace"
- checkout: self
clean: true
displayName: "Checkout sonic-sairedis"
- checkout: sonic-swss
clean: true
displayName: "Checkout sonic-swss"
- script: |
set -ex
cd sonic-swss
git checkout $(BUILD_BRANCH)
displayName: Set up sonic-swss branch
- task: DownloadPipelineArtifact@2
inputs:
artifact: docker-sonic-vs
displayName: "Download docker sonic vs image"

path: $(Build.ArtifactStagingDirectory)/download
displayName: "Download pre-stage built docker-sonic-vs"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 9
pipeline: Azure.sonic-swss-common
artifact: sonic-swss-common.amd64.ubuntu20_04
path: $(Build.ArtifactStagingDirectory)/download
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/202106'
allowPartiallySucceededBuilds: true
allowFailedBuilds: true
runBranch: 'refs/heads/$(BUILD_BRANCH)'
displayName: "Download sonic swss common deb packages"

- checkout: self
displayName: "Checkout sonic-sairedis"
- checkout: sonic-swss
displayName: "Checkout sonic-swss"

- script: |
set -x
set -ex
sudo sonic-sairedis/.azure-pipelines/build_and_install_module.sh

sudo apt-get install -y libhiredis0.14
sudo dpkg -i --force-confask,confnew ../libswsscommon_1.0.0_amd64.deb || apt-get install -f
sudo dpkg -i ../python3-swsscommon_1.0.0_amd64.deb
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

# install packages for vs test
sudo apt-get install -y net-tools bridge-utils vlan
Expand All @@ -52,12 +59,13 @@ jobs:
displayName: "Install dependencies"

- script: |
set -x
sudo docker load -i ../docker-sonic-vs.gz
set -ex
sudo docker load -i $(Build.ArtifactStagingDirectory)/download/docker-sonic-vs.gz
docker ps
ip netns list
pushd sonic-swss/tests
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"

- task: PublishTestResults@2
Expand Down
Loading