Skip to content

Commit

Permalink
Merge branch 'master' into vxlan-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
prsunny authored Dec 17, 2024
2 parents 6a9f067 + 664a56c commit 66e36ea
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 0 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ CFLAGS_COMMON+=" -Wvariadic-macros"
CFLAGS_COMMON+=" -Wno-switch-default"
CFLAGS_COMMON+=" -Wno-long-long"
CFLAGS_COMMON+=" -Wno-redundant-decls"
CFLAGS_COMMON+=" -Wno-error=missing-field-initializers"

# Code testing coverage with gcov
AC_MSG_CHECKING(whether to build with gcov testing)
Expand Down
92 changes: 92 additions & 0 deletions dev/Dockerfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
ARG DEBIAN_VERSION="bookworm"
FROM sonicdev-microsoft.azurecr.io:443/sonic-slave-${DEBIAN_VERSION}:latest

ARG UID=1000
ARG GID=1000

RUN groupadd -g ${GID} sonicdev && \
useradd -u ${UID} -g ${GID} -ms /bin/bash sonicdev

RUN mkdir -p /workspace && \
mkdir -p /workspace/debs && \
mkdir -p /workspace/tools && \
chown -R sonicdev:sonicdev /workspace

ENV PATH="${PATH}:/workspace/tools"

RUN apt-get update && \
sudo apt-get install -y \
libhiredis-dev \
libzmq3-dev \
swig4.0 \
libdbus-1-dev \
libteam-dev \
protobuf-compiler \
libprotobuf-dev && \
sudo pip3 install lcov_cobertura

COPY dev/download_artifact.sh /workspace/tools/download_artifact.sh

WORKDIR /workspace/debs

ARG BRANCH_NAME="master"
ARG PLATFORM="amd64"
ARG DEBIAN_VERSION

# SWSS COMMON

ARG SWSS_COMMON_PROJECT_NAME="Azure.sonic-swss-common"
ARG SWSS_COMMON_ARTIFACT_NAME="sonic-swss-common"
ARG SWSS_COMMON_FILE_PATHS="/libswsscommon_1.0.0_${PLATFORM}.deb /libswsscommon-dev_1.0.0_${PLATFORM}.deb"

RUN download_artifact.sh "${SWSS_COMMON_PROJECT_NAME}" "${BRANCH_NAME}" "${SWSS_COMMON_ARTIFACT_NAME}" "${SWSS_COMMON_FILE_PATHS}"

# SAIREDIS

ARG SAIREDIS_PROJECT_NAME="Azure.sonic-sairedis"
ARG SAIREDIS_ARTIFACT_NAME="sonic-sairedis"
ARG SAIREDIS_FILE_PATHS="\
/libsaivs_1.0.0_${PLATFORM}.deb \
/libsaivs-dev_1.0.0_${PLATFORM}.deb \
/libsairedis_1.0.0_${PLATFORM}.deb \
/libsairedis-dev_1.0.0_${PLATFORM}.deb \
/libsaimetadata_1.0.0_${PLATFORM}.deb \
/libsaimetadata-dev_1.0.0_${PLATFORM}.deb \
/syncd-vs_1.0.0_${PLATFORM}.deb \
"
RUN download_artifact.sh "${SAIREDIS_PROJECT_NAME}" "${BRANCH_NAME}" "${SAIREDIS_ARTIFACT_NAME}" "${SAIREDIS_FILE_PATHS}"

# COMMON LIB

ARG COMMON_LIB_PROJECT_NAME="Azure.sonic-buildimage.common_libs"
ARG COMMON_LIB_ARTIFACT_NAME="common-lib"
ARG COMMON_LIB_FILE_PATHS="\
/target/debs/${DEBIAN_VERSION}/libnl-3-200_3.7.0-0.2%2Bb1sonic1_${PLATFORM}.deb \
/target/debs/${DEBIAN_VERSION}/libnl-3-dev_3.7.0-0.2%2Bb1sonic1_${PLATFORM}.deb \
/target/debs/${DEBIAN_VERSION}/libnl-genl-3-200_3.7.0-0.2%2Bb1sonic1_${PLATFORM}.deb \
/target/debs/${DEBIAN_VERSION}/libnl-genl-3-dev_3.7.0-0.2%2Bb1sonic1_${PLATFORM}.deb \
/target/debs/${DEBIAN_VERSION}/libnl-route-3-200_3.7.0-0.2%2Bb1sonic1_${PLATFORM}.deb \
/target/debs/${DEBIAN_VERSION}/libnl-route-3-dev_3.7.0-0.2%2Bb1sonic1_${PLATFORM}.deb \
/target/debs/${DEBIAN_VERSION}/libnl-nf-3-200_3.7.0-0.2%2Bb1sonic1_${PLATFORM}.deb \
/target/debs/${DEBIAN_VERSION}/libnl-nf-3-dev_3.7.0-0.2%2Bb1sonic1_${PLATFORM}.deb \
/target/debs/${DEBIAN_VERSION}/libyang_1.0.73_${PLATFORM}.deb \
"
RUN download_artifact.sh "${COMMON_LIB_PROJECT_NAME}" "${BRANCH_NAME}" "${COMMON_LIB_ARTIFACT_NAME}" "${COMMON_LIB_FILE_PATHS}"

# DASH API

ARG DASH_API_PROJECT_NAME="sonic-net.sonic-dash-api"
ARG DASH_API_ARTIFACT_NAME="sonic-dash-api"
ARG DASH_API_FILE_PATHS="/libdashapi_1.0.0_${PLATFORM}.deb"

RUN download_artifact.sh "${DASH_API_PROJECT_NAME}" "${BRANCH_NAME}" "${DASH_API_ARTIFACT_NAME}" "${DASH_API_FILE_PATHS}"

RUN dpkg -i *.deb

WORKDIR /workspace

USER sonicdev

ENTRYPOINT [ "bash" ]
18 changes: 18 additions & 0 deletions dev/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
services:
sonicdev:
container_name: sonicdev
build:
context: ..
dockerfile: dev/Dockerfile.yml
args:
- DEBIAN_VERSION
- UID
- GID
- BRANCH_NAME
- PLATFORM
volumes:
- ..:/workspace/sonic-swss
init: true
privileged: true
working_dir: /workspace/sonic-swss

46 changes: 46 additions & 0 deletions dev/download_artifact.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

# download_artifact.sh <pipelineName> <branchName> <artifactName> <targetPaths>
#
# targetPaths: space separated list of target paths to download from the artifact
# e.g.
# ./download_artifact.sh "Azure.sonic-swss-common" "master" "sonic-swss-common" "/libswsscommon-dev_1.0.0_amd64.deb /libswsscommon_1.0.0_amd64.deb"

set -x -e

pipelineName=${1}
branchName=${2}
artifactName=${3}
targetPaths=${4}

queryPipelinesUrl="https://dev.azure.com/mssonic/build/_apis/pipelines"

definitions=$(curl -s "${queryPipelinesUrl}" | jq -r ".value[] | select (.name == \"${pipelineName}\").id")

queryBuildsUrl="https://dev.azure.com/mssonic/build/_apis/build/builds?definitions=${definitions}&branchName=refs/heads/${branchName}&resultFilter=succeeded&statusFilter=completed&api-version=6.0"

buildId=$(curl -s ${queryBuildsUrl} | jq -r '.value[0].id')

queryArtifactUrl="https://dev.azure.com/mssonic/build/_apis/build/builds/${buildId}/artifacts?artifactName=${artifactName}&api-version=6.0"

function download_artifact {

target_path=${1}
output_file=$(sed 's/.*\///' <<< ${target_path})

download_artifact_url=$(curl -s ${queryArtifactUrl} | jq -r '.resource.downloadUrl')
download_artifact_url=$(sed 's/zip$/file/' <<< ${download_artifact_url})
download_artifact_url="$download_artifact_url&subPath=${target_path}"

wget -O ${output_file} ${download_artifact_url}
}

function download_artifacts {
target_paths_array=(${targetPaths})
for target_path in "${target_paths_array[@]}"
do
download_artifact ${target_path}
done
}

download_artifacts

0 comments on commit 66e36ea

Please sign in to comment.