forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build scripts for sonic-mgmt-common (sonic-net#126)
1) Added jenkinsfile, build and test scripts for sanity checking of sonic-mgmt-common PRs. Test stage runs cvl and translib go test cases. Also added periodic sanity for latest sonic-mgmt-common code. 2) Modified sonic-mgmt-framework PR & sceduled sanities to download and build latest sonic-mgmt-common fist. Cleaned up build script to include only sonic-mgmt-framework related stuffs. Translib, cvl specific steps are moved to sonic-mgmt-common's build script. 3) Introduced a test stage for sonic-mgmt-framework sanity. It runs REST server go test cases. 4) Modified sonic-telemetry build script to clone and build sonic-mgmt-common first. Removed dependency on sonic-mgmt-framework. Signed-off-by: Sachin Holla <sachin.holla@broadcom.com>
- Loading branch information
1 parent
0dd7cf0
commit 5ee7cfa
Showing
9 changed files
with
206 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
pipeline { | ||
agent { node { label 'sonic-slave-buster' } } | ||
|
||
stages { | ||
stage('Prepare') { | ||
steps { | ||
dir('sonic-mgmt-common') { | ||
checkout([$class: 'GitSCM', | ||
branches: [[name: '${sha1}']], | ||
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-mgmt-common', | ||
refspec: '+refs/pull/*:refs/remotes/origin/pr/*']]]) | ||
} | ||
copyArtifacts(projectName: 'vs/buildimage-vs-all', filter: '**/*.deb', target: 'buildimage', flatten: false) | ||
} | ||
} | ||
|
||
stage('Build') { | ||
steps { | ||
sh './scripts/common/sonic-mgmt-common-build/build.sh' | ||
} | ||
} | ||
|
||
stage('Test') { | ||
steps { | ||
sh './scripts/common/sonic-mgmt-common-build/test.sh' | ||
} | ||
} | ||
} | ||
post { | ||
success { | ||
archiveArtifacts(artifacts: 'target/*.deb') | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
pipeline { | ||
agent { node { label 'sonic-slave-buster' } } | ||
|
||
options { | ||
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10')) | ||
} | ||
|
||
environment { | ||
SONIC_TEAM_WEBHOOK = credentials('public-jenkins-builder') | ||
} | ||
|
||
triggers { | ||
pollSCM('H/10 * * * *') | ||
} | ||
|
||
stages { | ||
stage('Prepare') { | ||
steps { | ||
dir('sonic-mgmt-common') { | ||
checkout([$class: 'GitSCM', | ||
branches: [[name: 'refs/heads/master']], | ||
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-mgmt-common']]]) | ||
} | ||
copyArtifacts(projectName: '../vs/buildimage-vs-image', filter: '**/*.deb', target: 'buildimage', flatten: false) | ||
} | ||
} | ||
|
||
stage('Build') { | ||
steps { | ||
sh './scripts/common/sonic-mgmt-common-build/build.sh' | ||
} | ||
} | ||
|
||
stage('Test') { | ||
steps { | ||
sh './scripts/common/sonic-mgmt-common-build/test.sh' | ||
} | ||
} | ||
} | ||
post { | ||
success { | ||
archiveArtifacts(artifacts: 'target/*.deb') | ||
} | ||
fixed { | ||
slackSend(color:'#00FF00', message: "Build job back to normal: ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)") | ||
office365ConnectorSend(webhookUrl: "${env.SONIC_TEAM_WEBHOOK}") | ||
} | ||
regression { | ||
slackSend(color:'#FF0000', message: "Build job Regression: ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)") | ||
office365ConnectorSend(webhookUrl: "${env.SONIC_TEAM_WEBHOOK}") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash -ex | ||
|
||
# Build script for sonic-mgmt-common. | ||
# Installs all dependencies required for compiling and testing | ||
# CVL and translib. | ||
|
||
[[ ! -z ${DISTRO} ]] || DISTRO=buster | ||
|
||
# REDIS | ||
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 | ||
|
||
# LIBYANG | ||
sudo dpkg -i buildimage/target/debs/${DISTRO}/libyang*.deb | ||
|
||
|
||
pushd sonic-mgmt-common | ||
|
||
dpkg-buildpackage -rfakeroot -b -us -uc | ||
|
||
popd | ||
|
||
mkdir -p target | ||
cp sonic-mgmt-common*.deb target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash -ex | ||
|
||
# Run sanity tests for sonic-mgmt-common. | ||
# Assumes sonic-mgmt-common is already compiled and all dependencies | ||
# are installed. | ||
|
||
|
||
STATUS=0 | ||
DEBDIR=$(realpath sonic-mgmt-common/debian/sonic-mgmt-common) | ||
|
||
# Run CVL tests | ||
|
||
pushd sonic-mgmt-common/build/tests/cvl | ||
|
||
CVL_SCHEMA_PATH=testdata/schema \ | ||
./cvl.test -test.v -logtostderr || STATUS=1 | ||
|
||
popd | ||
|
||
# Run translib tests | ||
|
||
pushd sonic-mgmt-common/build/tests/translib | ||
|
||
export CVL_SCHEMA_PATH=${DEBDIR}/usr/sbin/schema | ||
export YANG_MODELS_PATH=${DEBDIR}/usr/models/yang | ||
|
||
./db.test -test.v -logtostderr || STATUS=1 | ||
|
||
./translib.test -test.v -logtostderr || STATUS=1 | ||
|
||
popd | ||
|
||
exit ${STATUS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash -ex | ||
|
||
# Run sanity tests for sonic-mgmt-framework. | ||
# Assumes both sonic-mgmt-common and sonic-mgmt-framework repos | ||
# are already compiled. | ||
|
||
STATUS=0 | ||
DEBDIR=$(realpath sonic-mgmt-common/debian/sonic-mgmt-common) | ||
|
||
pushd sonic-mgmt-framework/build/tests/rest | ||
|
||
export CVL_SCHEMA_PATH=${DEBDIR}/usr/sbin/schema | ||
|
||
./server.test -test.v -logtostderr || STATUS=1 | ||
|
||
popd | ||
|
||
exit ${STATUS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters