Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into dev/liuh/profile-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
liuh-80 committed Feb 15, 2023
2 parents c2a377e + 85f3776 commit 448a0c4
Show file tree
Hide file tree
Showing 64 changed files with 1,670 additions and 376 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/build-sairedis-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
vmImage: 'ubuntu-20.04'

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

steps:
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/build-swss-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
vmImage: 'ubuntu-20.04'

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

steps:
- checkout: sonic-swss
Expand Down
44 changes: 14 additions & 30 deletions .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
vmImage: 'ubuntu-20.04'

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

steps:
- checkout: self
Expand All @@ -68,46 +68,26 @@ jobs:
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
${{ if eq(parameters.arch, 'amd64') }}:
artifact: common-lib
${{ else }}:
artifact: common-lib.${{ parameters.arch }}
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"
displayName: "Download libyang from ${{ parameters.arch }} 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 All @@ -118,14 +98,14 @@ jobs:
- ${{ if eq(parameters.run_unit_test, true) }}:
- script: |
set -ex
git clone https://github.com/Spacetown/gcovr.git
git clone https://github.com/gcovr/gcovr.git
cd gcovr/
git checkout origin/recursive_search_file
git checkout 5.2
sudo pip3 install setuptools
sudo python3 setup.py install
cd ..
sudo rm -rf gcovr
displayName: "Install gcovr 5.0 with recursive fix"
displayName: "Install gcovr 5.2 (for --exclude-throw-branches support)"
- script: |
set -ex
sudo pip install Pympler==0.8
Expand All @@ -138,13 +118,17 @@ jobs:
sudo mkdir /usr/local/yang-models
sudo dpkg -i libswsscommon_*.deb
sudo dpkg -i libswsscommon-dev_*.deb
sudo dpkg -i python-swsscommon_*.deb
./tests/tests
redis-cli FLUSHALL
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
gcovr -r ./ -e ".*/swsscommon_wrap.cpp" --exclude-unreachable-branches --exclude-throw-branches --gcov-ignore-parse-errors -x --xml-pretty -o coverage.xml
make -C goext
redis-cli FLUSHALL
make -C goext check
rm -rf $(Build.ArtifactStagingDirectory)/download
displayName: "Run swss common unit tests"
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/build_and_install_module.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function build_and_install_kmodule()
apt-get install -y flex bison libssl-dev libelf-dev
apt-get install -y libnl-route-3-200 libnl-route-3-dev libnl-cli-3-200 libnl-cli-3-dev libnl-3-dev
# Install libs required by libswsscommon for build
apt-get install -y libzmq3-dev libzmq5 libboost-serialization1.71.0 uuid-dev
apt-get install -y libzmq3-dev libzmq5 libboost-serialization-dev uuid-dev

# Add the apt source mirrors and download the linux image source code
cp /etc/apt/sources.list /etc/apt/sources.list.bk
Expand Down
4 changes: 4 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: "CodeQL config"
queries:
- uses: security-and-quality
- uses: security-extended
83 changes: 83 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# For more infomation, please visit: https://github.com/github/codeql-action

name: "CodeQL"

on:
push:
branches:
- 'master'
- '202[0-9][0-9][0-9]'
pull_request_target:
branches:
- 'master'
- '202[0-9][0-9][0-9]'
workflow_dispatch:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-20.04
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'cpp','python' ]

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2.1.29
with:
config-file: ./.github/codeql/codeql-config.yml
languages: ${{ matrix.language }}

- if: matrix.language == 'cpp'
name: prepare
run: |
sudo apt-get update
sudo apt-get install -y libxml-simple-perl \
aspell \
aspell-en \
libhiredis-dev \
libnl-3-dev \
libnl-genl-3-dev \
libnl-route-3-dev \
libnl-nf-3-dev \
libyang-dev \
libzmq3-dev \
libzmq5 \
swig3.0 \
libpython2.7-dev \
libgtest-dev \
libgmock-dev \
libboost1.71-dev \
libboost-serialization1.71-dev \
dh-exec \
doxygen \
cdbs \
bison \
flex \
graphviz \
autoconf-archive \
uuid-dev \
libjansson-dev \
python
- if: matrix.language == 'cpp'
name: build-swss-common
run: |
set -x
./autogen.sh
fakeroot dpkg-buildpackage -us -uc -b
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2.1.29
with:
category: "/language:${{matrix.language}}"
3 changes: 2 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ exports_files(["LICENSE"])

cc_library(
name = "common",
srcs = glob(["common/*.cpp"], exclude=["common/loglevel.cpp"]),
srcs = glob(["common/*.cpp"], exclude=["common/loglevel.cpp", "common/loglevel_util.cpp"]),
hdrs = glob([
"common/*.h",
"common/*.hpp",
]),
copts = [
"-std=c++14",
"-I/usr/include/libnl3", # Expected location in the SONiC build container"
],
includes = [
Expand Down
19 changes: 15 additions & 4 deletions MAINTAINERS
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# This file describes the maintainers for SWSS-common
# See the SONiC project governance document for more information

Name = "Shuotian Cheng"
Email = "shuche@microsoft.com"
Github = stcheng
Mailinglist = sonicproject@googlegroups.com
Name = "Qi Luo"
Email = "qiluo@microsoft.com"
GitHub = "qiluo-msft"
MailingList = "sonic-dev@lists.sonicfoundation.dev"


Name = "Shitanshu Shah"
Email = ""
GitHub = ""
MailingList= "sonic-dev@lists.sonicfoundation.dev"

Name = "Marian Pritzak"
Email = ""
GitHub = "marian-pritsak"
MailingList = "sonic-dev@lists.sonicfoundation.dev"
23 changes: 22 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
SUBDIRS = common pyext sonic-db-cli tests
lib_LTLIBRARIES =
bin_PROGRAMS =

if DEBUG
DBGFLAGS = -ggdb -DDEBUG
else
DBGFLAGS = -g -DNDEBUG
endif

SWIG_SOURCES = pyext/swsscommon.i
SWIG_FLAG = -Wall -c++ -python -keyword
if ARCH64
SWIG_FLAG += -DSWIGWORDSIZE64
endif

CLEANFILES =

include common/Makefile.am
include pyext/Makefile.am
include sonic-db-cli/Makefile.am
include tests/Makefile.am


ACLOCAL_AMFLAGS = -I m4
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
[![Total alerts](https://img.shields.io/lgtm/alerts/g/Azure/sonic-swss-common.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Azure/sonic-swss-common/alerts/)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/Azure/sonic-swss-common.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Azure/sonic-swss-common/context:python)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/Azure/sonic-swss-common.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Azure/sonic-swss-common/context:cpp)
*static analysis:*

[![Build Status](https://sonic-jenkins.westus2.cloudapp.azure.com/job/common/job/sonic-swss-common-build/badge/icon)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/common/job/sonic-swss-common-build/)
[![Build Status](https://dev.azure.com/sonicswitch/build/_apis/build/status/Azure.sonic-swss-common?branchName=master)](https://dev.azure.com/sonicswitch/build/_build/latest?definitionId=9&branchName=master)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/sonic-net/sonic-swss-common.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/sonic-net/sonic-swss-common/alerts/)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/sonic-net/sonic-swss-common.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/sonic-net/sonic-swss-common/context:python)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/sonic-net/sonic-swss-common.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/sonic-net/sonic-swss-common/context:cpp)

*sonic-swss-common builds:*

[![master build](https://dev.azure.com/mssonic/build/_apis/build/status/Azure.sonic-swss-common?branchName=master&label=master)](https://dev.azure.com/mssonic/build/_build/latest?definitionId=9&branchName=master)
[![202205 build](https://dev.azure.com/mssonic/build/_apis/build/status/Azure.sonic-swss-common?branchName=202205&label=202205)](https://dev.azure.com/mssonic/build/_build/latest?definitionId=9&branchName=202205)
[![202111 build](https://dev.azure.com/mssonic/build/_apis/build/status/Azure.sonic-swss-common?branchName=202111&label=202111)](https://dev.azure.com/mssonic/build/_build/latest?definitionId=9&branchName=202111)
[![202106 build](https://dev.azure.com/mssonic/build/_apis/build/status/Azure.sonic-swss-common?branchName=202106&label=202106)](https://dev.azure.com/mssonic/build/_build/latest?definitionId=9&branchName=202106)
[![202012 build](https://dev.azure.com/mssonic/build/_apis/build/status/Azure.sonic-swss-common?branchName=202012&label=202012)](https://dev.azure.com/mssonic/build/_build/latest?definitionId=9&branchName=202012)
[![201911 build](https://dev.azure.com/mssonic/build/_apis/build/status/Azure.sonic-swss-common?branchName=201911&label=201911)](https://dev.azure.com/mssonic/build/_build/latest?definitionId=9&branchName=201911)

# SONiC - SWitch State Service Common Library - SWSS-COMMON

Expand All @@ -16,7 +24,7 @@ The SWitch State Service (SWSS) common library provides libraries for database c

Checkout the source:

git clone --recursive https://github.com/Azure/sonic-swss-common
git clone --recursive https://github.com/sonic-net/sonic-swss-common


Install build dependencies:
Expand Down Expand Up @@ -65,13 +73,16 @@ tests/tests
## Need Help?

For general questions, setup help, or troubleshooting:
- [sonicproject on Google Groups](https://groups.google.com/d/forum/sonicproject)
- [sonicproject on Google Groups](https://groups.google.com/g/sonicproject)

For bug reports or feature requests, please open an Issue.

## Contribution guide

See the [contributors guide](https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md) for information about how to contribute.
Please read the [contributors guide](https://github.com/sonic-net/SONiC/blob/gh-pages/CONTRIBUTING.md) for information about how to contribute.

All contributors must sign an [Individual Contributor License Agreement (ICLA)](https://docs.linuxfoundation.org/lfx/easycla/v2-current/contributors/individual-contributor) before contributions can be accepted. This process is managed by the [Linux Foundation - EasyCLA](https://easycla.lfx.linuxfoundation.org/) and automated
via a GitHub bot. If the contributor has not yet signed a CLA, the bot will create a comment on the pull request containing a link to electronically sign the CLA.

### GitHub Workflow

Expand Down
14 changes: 7 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ stages:
sudo apt-get update
sudo apt-get install -y make libtool m4 autoconf dh-exec debhelper cmake pkg-config \
libhiredis-dev libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libnl-nf-3-dev swig3.0 \
libpython2.7-dev libboost-dev libboost1.71-dev libboost-serialization-dev uuid-dev libzmq5 libzmq3-dev
libpython2.7-dev libboost-dev libboost-serialization-dev uuid-dev libzmq5 libzmq3-dev
sudo apt-get install -y sudo
sudo apt-get install -y redis-server redis-tools
sudo apt-get install -y python3-pip
Expand Down Expand Up @@ -91,7 +91,7 @@ stages:
- template: .azure-pipelines/build-template.yml
parameters:
arch: amd64
sonic_slave: sonic-slave-${{ parameters.debian_version }}
sonic_slave: sonic-slave-${{ parameters.debian_version }}:$(BUILD_BRANCH)
artifact_name: sonic-swss-common
run_unit_test: true
archive_gcov: true
Expand All @@ -106,7 +106,7 @@ stages:
arch: armhf
timeout: 180
pool: sonicbld-armhf
sonic_slave: sonic-slave-${{ parameters.debian_version }}-armhf
sonic_slave: sonic-slave-${{ parameters.debian_version }}-armhf:$(BUILD_BRANCH)
artifact_name: sonic-swss-common.armhf
debian_version: ${{ parameters.debian_version }}

Expand All @@ -115,7 +115,7 @@ stages:
arch: arm64
timeout: 180
pool: sonicbld-arm64
sonic_slave: sonic-slave-${{ parameters.debian_version }}-arm64
sonic_slave: sonic-slave-${{ parameters.debian_version }}-arm64:$(BUILD_BRANCH)
artifact_name: sonic-swss-common.arm64
debian_version: ${{ parameters.debian_version }}

Expand All @@ -127,7 +127,7 @@ stages:
parameters:
arch: amd64
timeout: 180
sonic_slave: sonic-slave-bullseye
sonic_slave: sonic-slave-bullseye:$(BUILD_BRANCH)
artifact_name: sonic-swss-common.bullseye.amd64
debian_version: bullseye

Expand All @@ -138,7 +138,7 @@ stages:
- template: .azure-pipelines/build-sairedis-template.yml
parameters:
arch: amd64
sonic_slave: sonic-slave-${{ parameters.debian_version }}
sonic_slave: sonic-slave-${{ parameters.debian_version }}:$(BUILD_BRANCH)
swss_common_artifact_name: sonic-swss-common
artifact_name: sonic-sairedis
syslog_artifact_name: sonic-sairedis.syslog
Expand All @@ -151,7 +151,7 @@ stages:
- template: .azure-pipelines/build-swss-template.yml
parameters:
arch: amd64
sonic_slave: sonic-slave-${{ parameters.debian_version }}
sonic_slave: sonic-slave-${{ parameters.debian_version }}:$(BUILD_BRANCH)
swss_common_artifact_name: sonic-swss-common
sairedis_artifact_name: sonic-sairedis
artifact_name: sonic-swss
Expand Down
Loading

0 comments on commit 448a0c4

Please sign in to comment.