Skip to content

Commit

Permalink
[jenkins]: Add sonic-stp build job (sonic-net#98)
Browse files Browse the repository at this point in the history
* [jenkins]: Add sonic-stp build job

* [Jenkins] Updated stp build file permissions.
  • Loading branch information
rupesh-k authored May 19, 2020
1 parent ac29ab0 commit 7f7f73b
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
28 changes: 28 additions & 0 deletions jenkins/common/sonic-stp-build-pr/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
pipeline {
agent { node { label 'sonic-slave' } }

stages {
stage('Prepare') {
steps {
dir('sonic-stp') {
checkout([$class: 'GitSCM',
branches: [[name: '${sha1}']],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-stp',
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-stp-build/build.sh'
}
}
}
post {
success {
archiveArtifacts(artifacts: 'target/*.deb')
}
}
}
42 changes: 42 additions & 0 deletions jenkins/common/sonic-stp-build/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
pipeline {
agent { node { label 'sonic-slave' } }

options {
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10'))

}

triggers {
pollSCM('H/10 * * * *')
}

stages {
stage('Prepare') {
steps {
dir('sonic-stp') {
checkout([$class: 'GitSCM',
branches: [[name: 'refs/heads/master']],
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-stp']]])
}
copyArtifacts(projectName: '../vs/buildimage-vs-all', filter: '**/*.deb', target: 'buildimage', flatten: false)
}
}

stage('Build') {
steps {
sh './scripts/common/sonic-stp-build/build.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>)")
}
regression {
slackSend(color:'#FF0000', message: "Build job Regression: ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)")
}
}
}
21 changes: 21 additions & 0 deletions scripts/common/sonic-stp-build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash -xe

#install libevent_2
sudo apt-get -y purge libevent-dev
sudo dpkg -i target/debs/stretch/libevent_2.*.deb

#install HIREDIS
sudo dpkg -i target/debs/stretch/libhiredis*.deb

#install libswsscommon
sudo dpkg -i target/debs/stretch/libswsscommon_*.deb
sudo dpkg -i target/debs/stretch/libswsscommon-dev_*.deb

pushd sonic-stp

./autogen.sh
dpkg-buildpackage -rfakeroot -b -us -uc

popd
mkdir -p target
cp *.deb target/

0 comments on commit 7f7f73b

Please sign in to comment.