Skip to content
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
26 changes: 25 additions & 1 deletion .azure-pipelines/build-sairedis-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ parameters:
- name: sonic_slave
type: string

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All azure pipeline change is from another PR: #681
That PR need merge first.

- name: debian_version
type: string
default: buster

- name: swss_common_artifact_name
type: string

Expand Down Expand Up @@ -82,12 +86,31 @@ jobs:
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 sed -ri 's/^databases .*/databases 17/' /etc/redis/redis.conf
sudo service redis-server start

sudo apt-get install -y rsyslog
sudo service rsyslog start

displayName: "Install dependencies"
- 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 }}/libyang-*.deb
target/debs/${{ parameters.debian_version }}/libyang_*.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:
artifact: ${{ parameters.swss_common_artifact_name }}
Expand Down Expand Up @@ -136,6 +159,7 @@ jobs:
contents: 'syslog-all.tgz'
targetFolder: $(Build.ArtifactStagingDirectory)
- publish: $(Build.ArtifactStagingDirectory)/
artifact: ${{ parameters.syslog_artifact_name }}
# publish artifact with retry count, otherwise "artifact already exist" error will block job re-run.
artifact: ${{ parameters.syslog_artifact_name }}_$(System.JobAttempt)
displayName: "Publish syslog artifacts"
condition: always()
4 changes: 3 additions & 1 deletion .azure-pipelines/build-swss-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,16 @@ jobs:
target/debs/${{ parameters.debian_version }}/libnl-genl*.deb
target/debs/${{ parameters.debian_version }}/libnl-route*.deb
target/debs/${{ parameters.debian_version }}/libnl-nf*.deb
target/debs/${{ parameters.debian_version }}/libyang-*.deb
target/debs/${{ parameters.debian_version }}/libyang_*.deb
displayName: "Download common libs"

- script: |
set -ex
sudo dpkg -i $(find ./download -name *.deb)
rm -rf download || true
workingDirectory: $(Build.ArtifactStagingDirectory)
displayName: "Install libnl3, sonic swss common, and sairedis"
displayName: "Install libnl3, libyang, sonic swss common, and sairedis"
- script: |
set -ex
rm ../*.deb || true
Expand Down
44 changes: 44 additions & 0 deletions .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,47 @@ jobs:
libnl-nf-3-dev \
swig
displayName: "Install dependencies"
- task: DownloadPipelineArtifact@2
# amd64 artifact name does not has arch suffix
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 }}/libyang-*.deb
target/debs/${{ parameters.debian_version }}/libyang_*.deb
displayName: "Download libyang from amd64 common lib"
- task: DownloadPipelineArtifact@2
condition: 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 }}/libyang-*.deb
target/debs/${{ parameters.debian_version }}/libyang_*.deb
displayName: "Download libyang from common lib"
- script: |
set -ex
sudo dpkg -i $(find ./download -name *.deb)
workingDirectory: $(Build.ArtifactStagingDirectory)
condition: ne('${{ parameters.debian_version }}', 'bullseye')
displayName: "Install libyang from common lib"
# Azure.sonic-buildimage.common_libs does not build libs for bullseye, so install libyang-dev by apt-get
- script: |
sudo apt-get install -qq -y \
libyang-dev
condition: eq('${{ parameters.debian_version }}', 'bullseye')
displayName: "Install libyang for bullseye"
- script: |
set -ex
rm ../*.deb || true
Expand Down Expand Up @@ -94,6 +135,7 @@ jobs:
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 restart
sudo mkdir /usr/local/yang-models

sudo dpkg -i libswsscommon_*.deb
sudo dpkg -i python-swsscommon_*.deb
Expand All @@ -103,6 +145,8 @@ jobs:
pytest --cov=. --cov-report=xml
mv coverage.xml tests/coverage.xml
gcovr -r ./ -e ".*/swsscommon_wrap.cpp" --exclude-unreachable-branches --exclude-throw-branches -x --xml-pretty -o coverage.xml

rm -rf $(Build.ArtifactStagingDirectory)/download
displayName: "Run swss common unit tests"
- publish: $(System.DefaultWorkingDirectory)/
artifact: ${{ parameters.artifact_name }}
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/test-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
ls -l
sudo sonic-swss-common/.azure-pipelines/build_and_install_module.sh

sudo apt-get install -y libhiredis0.14
sudo apt-get install -y libhiredis0.14 libyang0.16
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

Expand Down
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cc_library(
includes = [
"common",
],
linkopts = ["-lpthread -lhiredis -lnl-genl-3 -lnl-nf-3 -lnl-route-3 -lnl-3 -lzmq -lboost_serialization -luuid"],
linkopts = ["-lpthread -lhiredis -lnl-genl-3 -lnl-nf-3 -lnl-route-3 -lnl-3 -lzmq -lboost_serialization -luuid -lyang"],
visibility = ["//visibility:public"],
)

Expand Down
6 changes: 5 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ stages:
sudo apt-get install -y python3-pip
sudo pip3 install pytest
sudo apt-get install -y python
sudo apt-get install cmake libgtest-dev libgmock-dev
sudo apt-get install cmake libgtest-dev libgmock-dev libyang-dev
cd /usr/src/gtest && sudo cmake . && sudo make
ARCH=$(dpkg --print-architecture)
set -x
Expand All @@ -95,6 +95,7 @@ stages:
artifact_name: sonic-swss-common
run_unit_test: true
archive_gcov: true
debian_version: ${{ parameters.debian_version }}

- stage: BuildArm
dependsOn: Build
Expand All @@ -107,6 +108,7 @@ stages:
pool: sonicbld-armhf
sonic_slave: sonic-slave-${{ parameters.debian_version }}-armhf
artifact_name: sonic-swss-common.armhf
debian_version: ${{ parameters.debian_version }}

- template: .azure-pipelines/build-template.yml
parameters:
Expand All @@ -115,6 +117,7 @@ stages:
pool: sonicbld-arm64
sonic_slave: sonic-slave-${{ parameters.debian_version }}-arm64
artifact_name: sonic-swss-common.arm64
debian_version: ${{ parameters.debian_version }}

- stage: BuildBullseye
dependsOn: Build
Expand All @@ -139,6 +142,7 @@ stages:
swss_common_artifact_name: sonic-swss-common
artifact_name: sonic-sairedis
syslog_artifact_name: sonic-sairedis.syslog
debian_version: ${{ parameters.debian_version }}

- stage: BuildSwss
dependsOn: BuildSairedis
Expand Down
3 changes: 2 additions & 1 deletion common/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ libswsscommon_la_SOURCES = \
configdb.cpp \
dbconnector.cpp \
dbinterface.cpp \
defaultvalueprovider.cpp \
sonicv2connector.cpp \
table.cpp \
json.cpp \
Expand Down Expand Up @@ -74,7 +75,7 @@ libswsscommon_la_SOURCES = \

libswsscommon_la_CXXFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(LIBNL_CFLAGS) $(CODE_COVERAGE_CXXFLAGS)
libswsscommon_la_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(LIBNL_CPPFLAGS) $(CODE_COVERAGE_CPPFLAGS)
libswsscommon_la_LIBADD = -lpthread $(LIBNL_LIBS) $(CODE_COVERAGE_LIBS) -lzmq -lboost_serialization -luuid
libswsscommon_la_LIBADD = -lpthread $(LIBNL_LIBS) $(CODE_COVERAGE_LIBS) -lzmq -lboost_serialization -luuid -lyang

swssloglevel_SOURCES = loglevel.cpp

Expand Down
Loading