Skip to content

Commit d8773c2

Browse files
authored
Telemetry and mgmt-framework build fixes (#130)
1) Use buildimage-vs-image artifacts for sonic-mgmt-framework builds. It requires buster packages. 2) Changed telemetry build script to install redis directly through apt. 3) Changed mgmt-framework to make it similar to telemetry build script's layout -- install deps and compile sonic-mgmt-common by itself, without depending on sonic-mgmt-common's build script. Signed-off-by: Sachin Holla <[email protected]>
1 parent 489014a commit d8773c2

File tree

8 files changed

+53
-15
lines changed

8 files changed

+53
-15
lines changed

jenkins/common/sonic-mgmt-common-build-pr/Jenkinsfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pipeline {
1010
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-mgmt-common',
1111
refspec: '+refs/pull/*:refs/remotes/origin/pr/*']]])
1212
}
13-
copyArtifacts(projectName: 'vs/buildimage-vs-all', filter: '**/*.deb', target: 'buildimage', flatten: false)
13+
copyArtifacts(projectName: 'vs/buildimage-vs-image', filter: '**/*.deb', target: 'buildimage', flatten: false)
1414
}
1515
}
1616

jenkins/common/sonic-mgmt-framework-build-pr/Jenkinsfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ pipeline {
1515
branches: [[name: 'refs/heads/master']],
1616
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-mgmt-common']]])
1717
}
18-
copyArtifacts(projectName: 'vs/buildimage-vs-all', filter: '**/*.deb', target: 'buildimage', flatten: false)
18+
copyArtifacts(projectName: 'vs/buildimage-vs-image', filter: '**/*.deb', target: 'buildimage', flatten: false)
1919
}
2020
}
2121

2222
stage('Build') {
2323
steps {
24-
sh './scripts/common/sonic-mgmt-common-build/build.sh'
2524
sh './scripts/common/sonic-mgmt-framework-build/build.sh'
2625
}
2726
}

jenkins/common/sonic-mgmt-framework-build/Jenkinsfile

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ pipeline {
3232

3333
stage('Build') {
3434
steps {
35-
sh './scripts/common/sonic-mgmt-common-build/build.sh'
3635
sh './scripts/common/sonic-mgmt-framework-build/build.sh'
3736
}
3837
}

jenkins/common/sonic-telemetry-build-pr/Jenkinsfile

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ pipeline {
1010
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-telemetry',
1111
refspec: '+refs/pull/*:refs/remotes/origin/pr/*']]])
1212
}
13+
dir('sonic-mgmt-common') {
14+
checkout([$class: 'GitSCM',
15+
branches: [[name: 'refs/heads/master']],
16+
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-mgmt-common']]])
17+
}
1318
copyArtifacts(projectName: 'vs/buildimage-vs-all', filter: '**/*.deb', target: 'buildimage', flatten: false)
1419
}
1520
}

jenkins/common/sonic-telemetry-build/Jenkinsfile

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ pipeline {
2121
branches: [[name: 'refs/heads/master']],
2222
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-telemetry']]])
2323
}
24+
dir('sonic-mgmt-common') {
25+
checkout([$class: 'GitSCM',
26+
branches: [[name: 'refs/heads/master']],
27+
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-mgmt-common']]])
28+
}
2429
copyArtifacts(projectName: '../vs/buildimage-vs-all', filter: '**/*.deb', target: 'buildimage', flatten: false)
2530
}
2631
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,43 @@
11
#!/bin/bash -ex
22

33
# Build script for sonic-mgmt-framework.
4-
# Assumes sonic-mgmt-common is already cloned & built.
5-
# Dependencies of sonic-mgmt-common would have been installed already.
6-
# Only sonic-mgmt-framework dependencies will have to be installed here.
4+
5+
[[ ! -z ${DISTRO} ]] || DISTRO=buster
6+
7+
# REDIS
8+
sudo apt-get install -y redis-server
9+
sudo sed -ri 's/^# unixsocket/unixsocket/' /etc/redis/redis.conf
10+
sudo sed -ri 's/^unixsocketperm .../unixsocketperm 777/' /etc/redis/redis.conf
11+
sudo sed -ri 's/redis-server.sock/redis.sock/' /etc/redis/redis.conf
12+
sudo service redis-server start
13+
14+
# LIBYANG
15+
sudo dpkg -i buildimage/target/debs/${DISTRO}/libyang*.deb
16+
17+
# Install from "requirement" files in sonic-mgmt-framework/tools/test directory.
18+
pushd sonic-mgmt-framework/tools/test
19+
20+
[[ ! -f apt_requirements.txt ]] || \
21+
sed 's/#.*//' apt_requirements.txt | xargs -r sudo apt-get install -y
22+
23+
[[ ! -f python2_requirements.txt ]] || \
24+
sudo pip install --no-cache-dir -r python2_requirements.txt
25+
26+
[[ ! -f python3_requirements.txt ]] || \
27+
sudo pip3 install --no-cache-dir -r python3_requirements.txt
28+
29+
popd
30+
31+
32+
# Build sonic-mgmt-common
33+
34+
pushd sonic-mgmt-common
35+
36+
NO_TEST_BINS=1 dpkg-buildpackage -rfakeroot -b -us -uc
37+
38+
popd
39+
40+
# Build sonic-mgmt-framework
741

842
pushd sonic-mgmt-framework
943

@@ -12,4 +46,4 @@ dpkg-buildpackage -rfakeroot -b -us -uc
1246
popd
1347

1448
mkdir -p target
15-
cp sonic-mgmt-framework*.deb target/
49+
cp *.deb target/

scripts/common/sonic-mgmt-framework-build/test.sh

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ DEBDIR=$(realpath sonic-mgmt-common/debian/sonic-mgmt-common)
1010
pushd sonic-mgmt-framework/build/tests/rest
1111

1212
export CVL_SCHEMA_PATH=${DEBDIR}/usr/sbin/schema
13+
export YANG_MODELS_PATH=${DEBDIR}/usr/models/yang
1314

1415
./server.test -test.v -logtostderr || STATUS=1
1516

scripts/common/sonic-telemetry-build/build.sh

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
sudo dpkg -i buildimage/target/debs/stretch/libhiredis*.deb
55

66
# Install REDIS
7-
sudo apt-get install -y liblua5.1-0 lua-bitop lua-cjson
8-
sudo dpkg -i buildimage/target/debs/stretch/redis-tools_*.deb
9-
sudo dpkg -i buildimage/target/debs/stretch/redis-server_*.deb
7+
sudo apt-get install -y redis-server
108
sudo sed -ri 's/^# unixsocket/unixsocket/' /etc/redis/redis.conf
119
sudo sed -ri 's/^unixsocketperm .../unixsocketperm 777/' /etc/redis/redis.conf
1210
sudo sed -ri 's/redis-server.sock/redis.sock/' /etc/redis/redis.conf
@@ -15,14 +13,11 @@ sudo service redis-server start
1513
# Install libyang
1614
sudo dpkg -i buildimage/target/debs/stretch/libyang*.deb
1715

18-
# Clone sonic-mgmt-common repository
19-
git clone https://github.com/Azure/sonic-mgmt-common.git
20-
2116
# Build sonic-mgmt-common first
2217

2318
pushd sonic-mgmt-common
2419

25-
dpkg-buildpackage -rfakeroot -b -us -uc
20+
NO_TEST_BINS=1 dpkg-buildpackage -rfakeroot -b -us -uc
2621

2722
popd
2823

0 commit comments

Comments
 (0)