summaryrefslogtreecommitdiff
path: root/Jenkinsfile
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-12-27 14:50:50 +0100
committerChristian Poessinger <christian@poessinger.com>2019-12-27 14:50:50 +0100
commit88e8b421688cfb5f6580cc2d9985dd45769db947 (patch)
tree90bb30fa1b21f7e9115d5a97f452358098a2eedd /Jenkinsfile
parenta278f502fd8a036c81de3e58c9fe744b285d6d6f (diff)
downloadvyos-1x-88e8b421688cfb5f6580cc2d9985dd45769db947.tar.gz
vyos-1x-88e8b421688cfb5f6580cc2d9985dd45769db947.zip
Jenkins: make pipeline branch independent
Diffstat (limited to 'Jenkinsfile')
-rw-r--r--Jenkinsfile31
1 files changed, 22 insertions, 9 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index 515f5070e..1d3a23064 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -69,11 +69,20 @@ def projectProperties = [
properties(projectProperties)
setDescription()
+node('Docker') {
+ stage('Define Agent') {
+ script {
+ // create container name on demand
+ env.DOCKER_IMAGE = "vyos/vyos-build:" + getGitBranchName()
+ }
+ }
+}
+
pipeline {
agent {
docker {
- args '--sysctl net.ipv6.conf.lo.disable_ipv6=0 -e GOSU_UID=1006 -e GOSU_GID=1006'
- image 'vyos/vyos-build:crux'
+ args "--sysctl net.ipv6.conf.lo.disable_ipv6=0 -e GOSU_UID=1006 -e GOSU_GID=1006"
+ image "${env.DOCKER_IMAGE}"
alwaysPull true
}
}
@@ -88,7 +97,8 @@ pipeline {
steps {
script {
dir('build') {
- git branch: getGitBranchName(), url: getGitRepoURL()
+ git branch: getGitBranchName(),
+ url: getGitRepoURL()
}
}
}
@@ -97,7 +107,10 @@ pipeline {
steps {
script {
dir('build') {
- sh "dpkg-buildpackage -b -us -uc -tc"
+ def commitId = sh(returnStdout: true, script: 'git rev-parse --short=11 HEAD').trim()
+ currentBuild.description = sprintf('Git SHA1: %s', commitId[-11..-1])
+
+ sh 'dpkg-buildpackage -b -us -uc -tc'
}
}
}
@@ -117,11 +130,12 @@ pipeline {
sshagent(['SSH-dev.packages.vyos.net']) {
// build up some fancy groovy variables so we do not need to write/copy
// every option over and over again!
+ def RELEASE = getGitBranchName()
+ if (getGitBranchName() == "master") {
+ RELEASE = 'current'
+ }
- def VYOS_REPO_PATH = '/home/sentrium/web/dev.packages.vyos.net/public_html/repositories/' + getGitBranchName() + '/'
- if (getGitBranchName() != "equuleus")
- VYOS_REPO_PATH += 'vyos/'
-
+ def VYOS_REPO_PATH = '/home/sentrium/web/dev.packages.vyos.net/public_html/repositories/' + RELEASE + '/'
def SSH_OPTS = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR'
def SSH_REMOTE = 'khagen@10.217.48.113'
@@ -129,7 +143,6 @@ pipeline {
files = findFiles(glob: '*.deb')
files.each { PACKAGE ->
- def RELEASE = getGitBranchName()
def ARCH = sh(returnStdout: true, script: "dpkg-deb -f ${PACKAGE} Architecture").trim()
def SUBSTRING = sh(returnStdout: true, script: "dpkg-deb -f ${PACKAGE} Package").trim()
def SSH_DIR = '~/VyOS/' + RELEASE + '/' + ARCH