Skip to content

Commit aeeea83

Browse files
losha228qiluo-msft
authored andcommitted
Create a pipeline for python-asyncsnmp-build (sonic-net#64)
1 parent 305cd49 commit aeeea83

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
pipeline {
2+
agent { node { label 'sonic-slave' } }
3+
4+
options {
5+
timestamps()
6+
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10'))
7+
}
8+
9+
triggers {
10+
upstream 'python-swssdk-build'
11+
pollSCM 'H * * * *'
12+
}
13+
14+
15+
stages {
16+
stage('Prepare') {
17+
steps {
18+
dir('sonic-snmpagent') {
19+
checkout([$class: 'GitSCM',
20+
branches: [[name: 'refs/heads/master']],
21+
doGenerateSubmoduleConfigurations: false,
22+
extensions: [[$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: false, recursiveSubmodules: true, reference: '', trackingSubmodules: false]],
23+
submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/Azure/sonic-snmpagent']]])
24+
25+
copyArtifacts filter: 'target/python-wheels/*-py3-*.whl', fingerprintArtifacts: true, flatten: true, projectName: 'python-swssdk-build', target: 'target/python-wheels/'
26+
copyArtifacts filter: 'target/debs/stretch/*.deb', fingerprintArtifacts: true, flatten: true, projectName: 'dep-build', target: 'target/debs/'
27+
}
28+
}
29+
}
30+
31+
stage('Build') {
32+
steps {
33+
sh './scripts/common/python-asyncsnmp-build/build.sh'
34+
}
35+
}
36+
37+
stage('Test') {
38+
steps {
39+
sh './scripts/common/python-asyncsnmp-build/test.sh'
40+
}
41+
}
42+
}
43+
post {
44+
45+
success {
46+
dir('sonic-snmpagent') {
47+
archiveArtifacts 'target/python-wheels/*.whl,dist/*.whl'
48+
}
49+
}
50+
}
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash -xe
2+
## Install python3.6
3+
sudo apt-get -y purge python3-setuptools python3-wheel
4+
## go to the source code dir to build
5+
pushd sonic-snmpagent
6+
ls -l target/debs/
7+
## sudo dpkg -i target/debs/{libmpdec2_*_amd64.deb,libpython3.6-minimal_3.6.0-1_amd64.deb,libpython3.6-stdlib_3.6.0-1_amd64.deb,python3.6-minimal_3.6.0-1_amd64.deb,libpython3.6_3.6.0-1_amd64.deb,python3.6_3.6.0-1_amd64.deb,libpython3.6-dev_3.6.0-1_amd64.deb}
8+
sudo dpkg -i target/debs/libmpdec2_*_amd64.deb
9+
sudo dpkg -i target/debs/libpython3.6-minimal_3.6.0-1_amd64.deb
10+
sudo dpkg -i target/debs/libpython3.6-stdlib_3.6.0-1_amd64.deb
11+
sudo dpkg -i target/debs/python3.6-minimal_3.6.0-1_amd64.deb
12+
sudo dpkg -i target/debs/libpython3.6_3.6.0-1_amd64.deb
13+
sudo dpkg -i target/debs/python3.6_3.6.0-1_amd64.deb
14+
sudo dpkg -i target/debs/libpython3.6-dev_3.6.0-1_amd64.deb
15+
curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6
16+
## Build
17+
sudo python3.6 -m pip install target/python-wheels/swsssdk*-py3-*.whl
18+
python3.6 setup.py bdist_wheel
19+
popd
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash -xe
2+
## Run unit test
3+
## TODO: add pytest as test requirement, and remove below line
4+
sudo python3.6 -m pip install pytest>=3.0.5 mockredispy>=2.9.3 mock>=2.0.0
5+
## go to the source code dir to run test
6+
pushd sonic-snmpagent
7+
sudo python3.6 -m pip install dist/asyncsnmp-2.1.0-py3-none-any.whl
8+
##sudo python3.6 -m pip install -e ".[testing]"
9+
python3.6 -m pytest -s
10+
popd

0 commit comments

Comments
 (0)