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][202106] Use correct branch when downloading artifact. #2346

Merged
merged 3 commits into from
Jun 30, 2022
Merged
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
31 changes: 18 additions & 13 deletions .azure-pipelines/build-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,43 +36,47 @@ 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'
allowFailedBuilds: true
runBranch: 'refs/heads/$(BUILD_BRANCH)'
path: $(Build.ArtifactStagingDirectory)/download
displayName: "Download sonic swss common deb packages"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 12
pipeline: Azure.sonic-sairedis
artifact: ${{ parameters.sairedis_artifact_name }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/202106'
allowFailedBuilds: true
runBranch: 'refs/heads/$(BUILD_BRANCH)'
path: $(Build.ArtifactStagingDirectory)/download
displayName: "Download sonic sairedis deb packages"
- task: DownloadPipelineArtifact@2
inputs:
artifact: ${{ parameters.swss_artifact_name }}
displayName: "Download sonic swss artifact"
path: $(Build.ArtifactStagingDirectory)/download
displayName: "Download pre-stage built ${{ parameters.swss_artifact_name }}"
- 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 @@ -81,7 +85,8 @@ jobs:
popd

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

rm -rf $(Build.ArtifactStagingDirectory)/download
displayName: "Build docker-sonic-vs"
- publish: $(Build.ArtifactStagingDirectory)/
artifact: ${{ parameters.artifact_name }}
displayName: "Archive sonic docker vs image"
70 changes: 49 additions & 21 deletions .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ parameters:
type: boolean
default: false

- name: common_lib_artifact_name
type: string

jobs:
- job:
displayName: ${{ parameters.arch }}
Expand All @@ -44,7 +47,7 @@ jobs:
pool:
${{ if ne(parameters.pool, 'default') }}:
name: ${{ parameters.pool }}
${{ if eq(parameters.pool, 'default') }}:
${{ else }}:
vmImage: 'ubuntu-20.04'

container:
Expand Down Expand Up @@ -75,38 +78,63 @@ 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'
allowFailedBuilds: true
runBranch: 'refs/heads/$(BUILD_BRANCH)'
path: $(Build.ArtifactStagingDirectory)/download
patterns: |
libswsscommon_1.0.0_${{ parameters.arch }}.deb
libswsscommon-dev_1.0.0_${{ parameters.arch }}.deb
displayName: "Download sonic swss common deb packages"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 12
pipeline: Azure.sonic-sairedis
artifact: ${{ parameters.sairedis_artifact_name }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/202106'
allowFailedBuilds: true
runBranch: 'refs/heads/$(BUILD_BRANCH)'
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 sonic sairedis deb packages"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: Azure.sonic-buildimage.common_libs
artifact: ${{ parameters.common_lib_artifact_name }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/$(BUILD_BRANCH)'
path: $(Build.ArtifactStagingDirectory)/download
patterns: |
target/debs/buster/libnl-3-200_*.deb
target/debs/buster/libnl-3-dev_*.deb
target/debs/buster/libnl-genl-3-200_*.deb
target/debs/buster/libnl-genl-3-dev_*.deb
target/debs/buster/libnl-route-3-200_*.deb
target/debs/buster/libnl-route-3-dev_*.deb
target/debs/buster/libnl-nf-3-200_*.deb
target/debs/buster/libnl-nf-3-dev_*.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: self
submodules: true
set -ex
cd download
sudo dpkg -i $(find target/debs/buster -type f)
sudo dpkg -i $(ls *.deb)
cd ..
rm -rf download
workingDirectory: $(Build.ArtifactStagingDirectory)
displayName: "Install libnl3, sonic swss common and sairedis"
- script: |
set -x
set -ex
tar czf pytest.tgz tests
cp -r pytest.tgz $(Build.ArtifactStagingDirectory)/
./autogen.sh
Expand Down
22 changes: 12 additions & 10 deletions .azure-pipelines/test-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ jobs:
- 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
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/202106'
allowFailedBuilds: true
runBranch: 'refs/heads/$(BUILD_BRANCH)'
path: $(Build.ArtifactStagingDirectory)/download
displayName: "Download sonic swss common deb packages"

- script: |
set -x
set -ex
sudo .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 @@ -45,15 +45,17 @@ 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
uname -a
sudo /sbin/ip link add Vrf1 type vrf table 1001 || { echo 'vrf command failed' ; exit 1; }
sudo /sbin/ip link del Vrf1 type vrf table 1001
pushd 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
31 changes: 30 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,36 @@
# Add steps that publish test results, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/c-cpp/gcc

pr:
- master
- 202???
- 201???

trigger:
batch: true
branches:
include:
- "*"
- master
- 202???
- 201???

# this part need to be set in UI
schedules:
- cron: "0 0 * * 6"
displayName: Weekly build
branches:
include:
- master
- 202???
- 201???
always: true

variables:
- name: BUILD_BRANCH
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
value: $(System.PullRequest.TargetBranch)
${{ else }}:
value: $(Build.SourceBranchName)

stages:
- stage: Build
Expand All @@ -16,6 +42,7 @@ stages:
parameters:
arch: amd64
sonic_slave: sonic-slave-buster
common_lib_artifact_name: common-lib
swss_common_artifact_name: sonic-swss-common
sairedis_artifact_name: sonic-sairedis
artifact_name: sonic-swss
Expand All @@ -31,6 +58,7 @@ stages:
timeout: 240
pool: sonicbld-armhf
sonic_slave: sonic-slave-buster-armhf
common_lib_artifact_name: common-lib.armhf
swss_common_artifact_name: sonic-swss-common.armhf
sairedis_artifact_name: sonic-sairedis.armhf
artifact_name: sonic-swss.armhf
Expand All @@ -41,6 +69,7 @@ stages:
timeout: 240
pool: sonicbld-arm64
sonic_slave: sonic-slave-buster-arm64
common_lib_artifact_name: common-lib.arm64
swss_common_artifact_name: sonic-swss-common.arm64
sairedis_artifact_name: sonic-sairedis.arm64
artifact_name: sonic-swss.arm64
Expand Down