Skip to content
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
5 changes: 5 additions & 0 deletions .artifactignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
**/*
!*.deb
# Also publish build-env/ so downstream consumers (sonic-swss) can cascade this
# repo's dependency declarations via buildenv_setup (reads build-env/ out of the
# downloaded artifact). Both the dir entry and its contents must be un-ignored.
!build-env
!build-env/**
13 changes: 10 additions & 3 deletions .azure-pipelines/build-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ jobs:
artifact: ${{ parameters.swss_common_artifact_name }}
path: $(Build.ArtifactStagingDirectory)/download
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/$(BUILD_BRANCH)'
# TEMPORARY (PoC): resolve the swss-common cascade artifact from lawlee/ci-unify.
# BUILD_BRANCH = Build.SourceBranchName = "ci-unify" (last ref segment only), which
# can't find the lawlee/ci-unify run. Restore refs/heads/$(BUILD_BRANCH) before merge.
runBranch: 'refs/heads/lawlee/ci-unify'
allowPartiallySucceededBuilds: true
displayName: "Download sonic swss common deb packages"
- task: DownloadPipelineArtifact@2
Expand All @@ -66,7 +69,9 @@ jobs:
pipeline: Azure.sonic-buildimage.common_libs
artifact: common-lib
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/$(BUILD_BRANCH)'
# TEMPORARY (PoC): pin to refs/heads/master; the common_libs pipeline has no
# lawlee/ci-unify branch. Restore refs/heads/$(BUILD_BRANCH) before merge.
runBranch: 'refs/heads/master'
path: $(Build.ArtifactStagingDirectory)/download
patterns: '**/target/debs/*/libnexthopgroup_*.deb'
displayName: "Download sonic-buildimage libnexthopgroup package"
Expand Down Expand Up @@ -95,7 +100,9 @@ jobs:
${{ else }}:
artifact: sonic-dash-api.${{ parameters.arch }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/$(BUILD_BRANCH)'
# TEMPORARY (PoC): pin to refs/heads/master; sonic-dash-api has no
# lawlee/ci-unify branch. Restore refs/heads/$(BUILD_BRANCH) before merge.
runBranch: 'refs/heads/master'
path: $(Build.ArtifactStagingDirectory)/download
patterns: |
libdashapi*.deb
Expand Down
23 changes: 18 additions & 5 deletions .azure-pipelines/build-swss-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,21 @@ jobs:
vmImage: 'ubuntu-22.04'

container:
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-${{ parameters.debian_version }}:$(BUILD_BRANCH)-${{ parameters.arch }}
# TEMPORARY (PoC): pin the sonic-slave image tag to `master` instead of
# $(BUILD_BRANCH). Only master-tagged slave images are published; the
# lawlee/ci-unify feature branch has no image. Restore $(BUILD_BRANCH) before merge.
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-${{ parameters.debian_version }}:master-${{ parameters.arch }}

steps:
- checkout: sonic-swss
submodules: true
clean: true
- script: |
set -ex
git checkout $(BUILD_BRANCH)
# TEMPORARY (PoC): check out `master` instead of $(BUILD_BRANCH). sonic-swss
# has no lawlee/ci-unify branch on the sonic-net remote. Restore $(BUILD_BRANCH)
# before merge.
git checkout master
git submodule update
git status
displayName: Set up sonic-swss branch
Expand All @@ -63,7 +69,9 @@ jobs:
project: build
pipeline: Azure.sonic-buildimage.common_libs
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/$(BUILD_BRANCH)'
# TEMPORARY (PoC): pin to refs/heads/master; the common_libs pipeline has no
# lawlee/ci-unify branch. Restore refs/heads/$(BUILD_BRANCH) before merge.
runBranch: 'refs/heads/master'
path: $(Build.ArtifactStagingDirectory)/download
artifact: common-lib
patterns: |
Expand Down Expand Up @@ -109,7 +117,10 @@ jobs:
pipeline: Azure.sonic-swss-common
artifact: ${{ parameters.swss_common_artifact_name }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/$(BUILD_BRANCH)'
# TEMPORARY (PoC): resolve the swss-common cascade artifact from lawlee/ci-unify.
# BUILD_BRANCH = Build.SourceBranchName = "ci-unify" (last ref segment only), which
# can't find the lawlee/ci-unify run. Restore refs/heads/$(BUILD_BRANCH) before merge.
runBranch: 'refs/heads/lawlee/ci-unify'
allowPartiallySucceededBuilds: true
path: $(Build.ArtifactStagingDirectory)/download
patterns: |
Expand Down Expand Up @@ -139,7 +150,9 @@ jobs:
${{ else }}:
artifact: sonic-dash-api.${{ parameters.arch }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/$(BUILD_BRANCH)'
# TEMPORARY (PoC): pin to refs/heads/master; sonic-dash-api has no
# lawlee/ci-unify branch. Restore refs/heads/$(BUILD_BRANCH) before merge.
runBranch: 'refs/heads/master'
path: $(Build.ArtifactStagingDirectory)/download
patterns: |
libdashapi*.deb
Expand Down
234 changes: 59 additions & 175 deletions .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
parameters:
- name: repo
type: string
default: self
- name: arch
type: string
values:
Expand Down Expand Up @@ -40,6 +43,13 @@ parameters:
type: boolean
default: false

- name: staged_upstreams
# List of { artifact: <AZP artifact name>, name: <upstream name in upstream-artifacts.yaml> }
# to stage from the CURRENT run so the cascade uses them instead of the latest completed
# external run. Empty (a repo's own pipeline) => normal download.
type: object
default: []

- name: debian_version
type: string

Expand All @@ -59,189 +69,63 @@ jobs:
vmImage: 'ubuntu-22.04'

container:
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-${{ parameters.debian_version }}:$(BUILD_BRANCH)-${{ parameters.arch }}
# TEMPORARY (PoC): pin the sonic-slave image tag to `master` instead of
# $(BUILD_BRANCH). Only master-tagged slave images are published; the
# lawlee/ci-unify feature branch has no image. Restore $(BUILD_BRANCH) before merge.
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-${{ parameters.debian_version }}:master-${{ parameters.arch }}
options: "--privileged"

steps:
- checkout: self
# `repo` lets a consumer pipeline (e.g. sonic-swss-common) reuse this template to
# build sonic-sairedis. Default `self` preserves sairedis's own pipeline. When
# overridden with the sonic-sairedis repository resource, check out to `s` so
# $(Build.SourcesDirectory) still points at the sairedis checkout as usual.
- checkout: ${{ parameters.repo }}
clean: true
submodules: true
- task: DownloadPipelineArtifact@2
condition: eq('${{ parameters.arch }}', 'amd64')
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 libnl from common_libs"
- script: |
set -ex
sudo dpkg -i $(find ./download -name libnl-*_${{ parameters.arch }}.deb)
condition: eq('${{ parameters.arch }}', 'amd64')
workingDirectory: $(Build.ArtifactStagingDirectory)
displayName: "Install sonic libnl"
- script: |
set -ex
sudo apt-get update
sudo apt-get install -qq -y \
libdbus-glib-1-dev \
libpcsclite-dev \
docbook-to-man \
docbook-utils \
aspell-en \
libhiredis-dev \
swig \
libzmq3-dev \
autoconf-archive

sudo apt-get install -y redis-server
sudo sed -ri 's/^# unixsocket/unixsocket/' /etc/redis/redis.conf
sudo sed -ri 's/^unixsocketperm .../unixsocketperm 777/' /etc/redis/redis.conf
sudo sed -ri 's/redis-server.sock/redis.sock/' /etc/redis/redis.conf
sudo service redis-server start
sudo mkdir -m 755 /var/run/sswsyncd

sudo apt-get install -y rsyslog
sudo rsyslogd

cat /etc/apt/sources.list
dpkg --list | grep libnl

displayName: "Install dependencies"
${{ if ne(parameters.repo, 'self') }}:
path: s
# Branch selection for a reused resource repo comes from its `ref` (resolved at compile
# time), not a runtime git checkout — see the build-template reuse mechanics in the design.
- ${{ each up in parameters.staged_upstreams }}:
- task: DownloadPipelineArtifact@2
inputs:
artifact: ${{ up.artifact }}
path: $(Pipeline.Workspace)/staged/${{ up.name }}
displayName: "Stage current-run ${{ up.name }} for the cascade"
- script: |
set -ex
# Bootstrap the tool's own runtime deps (buildenv_setup needs PyYAML + requests).
sudo apt-get update
sudo apt-get install -qq -y \
libnl-3-dev \
libnl-genl-3-dev \
libnl-route-3-dev \
libnl-nf-3-dev \
libnl-cli-3-dev

condition: ne('${{ parameters.arch }}', 'amd64')
displayName: "Install libnl for arm dependencies"
- task: DownloadPipelineArtifact@2
# amd64 artifact name does not has arch suffix
condition: and(ne('${{ parameters.debian_version }}', 'trixie'), eq('${{ parameters.arch }}', 'amd64'))
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 }}/libyang3_*.deb
displayName: "Download libyang from amd64 common lib"
- task: DownloadPipelineArtifact@2
condition: and(ne('${{ parameters.debian_version }}', 'trixie'), ne('${{ parameters.arch }}', 'amd64'))
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.${{ parameters.arch }}
patterns: |
target/debs/${{ parameters.debian_version }}/libyang3_*.deb
- task: DownloadPipelineArtifact@2
condition: and(eq('${{ parameters.debian_version }}', 'trixie'), eq('${{ parameters.arch }}', 'amd64'))
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 }}/libyang3_*.deb
target/debs/${{ parameters.debian_version }}/libpcre3_*.deb
displayName: "Download libyang from amd64 common lib"
- task: DownloadPipelineArtifact@2
condition: and(eq('${{ parameters.debian_version }}', 'trixie'), ne('${{ parameters.arch }}', 'amd64'))
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.${{ parameters.arch }}
patterns: |
target/debs/${{ parameters.debian_version }}/libyang3_*.deb
target/debs/${{ parameters.debian_version }}/libpcre3_*.deb
displayName: "Download libyang from common lib"
- script: |
set -ex
sudo dpkg -i $(find ./download -name *.deb)
workingDirectory: $(Build.ArtifactStagingDirectory)
displayName: "Install libyang from common lib"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: sonic-net.sonic-platform-vpp
artifact: vpp-${{ parameters.debian_version }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
allowPartiallySucceededBuilds: true
path: $(Build.ArtifactStagingDirectory)/download
displayName: "Download sonic platform-vpp deb packages"
condition: eq('${{ parameters.arch }}', 'amd64')
- script: |
set -ex
sudo dpkg -i download/libvppinfra-dev_*_${{ parameters.arch }}.deb
sudo dpkg -i download/libvppinfra_*_${{ parameters.arch }}.deb
sudo dpkg -i download/vpp_*_${{ parameters.arch }}.deb
sudo dpkg -i download/vpp-crypto-engines_*_${{ parameters.arch }}.deb
sudo dpkg -i download/vpp-dbg_*_${{ parameters.arch }}.deb
sudo dpkg -i download/vpp-dev_*_${{ parameters.arch }}.deb
sudo dpkg -i download/vpp-plugin-core_*_${{ parameters.arch }}.deb
sudo dpkg -i download/vpp-plugin-devtools_*_${{ parameters.arch }}.deb
sudo dpkg -i download/vpp-plugin-dpdk_*_${{ parameters.arch }}.deb
sudo dpkg -i download/python3-vpp-api_*_${{ parameters.arch }}.deb
workingDirectory: $(Build.ArtifactStagingDirectory)
displayName: "Install sonic platform-vpp packages"
condition: eq('${{ parameters.arch }}', 'amd64')
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: Azure.sonic-swss-common
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: |
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"
- script: |
set -ex
rm ../*.deb || true
./autogen.sh
extraflags='--enable-code-coverage'
if [ '${{ parameters.asan }}' == True ]; then
extraflags='--enable-asan'
fi
DEB_BUILD_OPTIONS=nocheck DEB_CONFIGURE_EXTRA_FLAGS=$extraflags dpkg-buildpackage -us -uc -b -Psyncd,vs,nopython2 -j$(nproc)
mv ../*.deb .
sudo apt-get install -qq -y python3-yaml python3-requests git
# buildenv_setup lives in sonic-swss-common/ci/; sonic-sairedis is a consumer,
# so clone sonic-swss-common to obtain the tool.
# TEMPORARY (PoC): pin to lawlee/ci-unify (the tool isn't on swss-common master
# yet). Once merged, clone $(BUILD_BRANCH) with a default-branch fallback.
git clone --depth 1 --branch lawlee/ci-unify \
https://github.com/sonic-net/sonic-swss-common /tmp/sw-common
# Sets up apt/pip deps + downloads/installs libswsscommon, libnl, libyang3 and
# vpp DEBs (see build-env/upstream-artifacts.yaml), and runs the redis /
# sswsyncd / rsyslog post-install hooks.
# --upstream-staged-dir lets a consumer supply current-run upstream bundles at
# <dir>/<name>/ (staged by the loop above from parameters.staged_upstreams), so the
# cascade uses THIS run's artifacts instead of the latest completed external run.
# When a bundle is absent (e.g. sairedis's own pipeline) buildenv_setup downloads it;
# --required-staged-upstream (built from the same list) makes a MISSING expected
# bundle fail loudly instead of silently regressing to a download.
REQ_ARGS=$(python3 -c "import os,json; print(' '.join('--required-staged-upstream '+u['name'] for u in json.loads(os.environ.get('STAGED_UPSTREAMS_JSON','[]'))))")
PYTHONPATH=/tmp/sw-common/ci python3 -m buildenv_setup \
--repo-dir $(Build.SourcesDirectory) \
--scope build \
--arch ${{ parameters.arch }} \
--debian-version ${{ parameters.debian_version }} \
--branch $(BUILD_BRANCH) \
--upstream-staged-dir $(Pipeline.Workspace)/staged $REQ_ARGS
displayName: "Set up build environment (buildenv_setup)"
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
STAGED_UPSTREAMS_JSON: ${{ convertToJson(parameters.staged_upstreams) }}
- script: ASAN=${{ parameters.asan }} ./build-env/build.sh
displayName: "Compile sonic sairedis with coverage enabled"
- script: |
set -ex
Expand Down
Loading
Loading