summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-21 17:59:31 +0100
committerChristian Poessinger <christian@poessinger.com>2020-03-21 17:59:31 +0100
commit34d3dee32a37da255c7d3c25020311245a6fe9e1 (patch)
tree6fc0453dcc2acdc8d69adf6e34b8f656687caf84
parent9cfa3b3fec5331b11480794432f051085690fb14 (diff)
downloadvyatta-op-vpn-34d3dee32a37da255c7d3c25020311245a6fe9e1.tar.gz
vyatta-op-vpn-34d3dee32a37da255c7d3c25020311245a6fe9e1.zip
Jenkins: T1870: support GitHub PullRequest builds
-rw-r--r--Jenkinsfile18
1 files changed, 13 insertions, 5 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index 225f4fc..7a79b0f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -36,7 +36,7 @@ def isCustomBuild() {
def gitURI = 'git@github.com:vyos/' + getGitRepoName()
def httpURI = 'https://github.com/vyos/' + getGitRepoName()
- return ! ((getGitRepoURL() == gitURI) || (getGitRepoURL() == httpURI))
+ return !((getGitRepoURL() == gitURI) || (getGitRepoURL() == httpURI)) || env.CHANGE_ID
}
def setDescription() {
@@ -73,7 +73,17 @@ node('Docker') {
stage('Define Agent') {
script {
// create container name on demand
- env.DOCKER_IMAGE = "vyos/vyos-build:" + getGitBranchName()
+ def branchName = getGitBranchName()
+ // Adjust PR target branch name so we can re-map it to the proper
+ // Docker image. CHANGE_ID is set only for pull requests, so it is
+ // safe to access the pullRequest global variable
+ if (env.CHANGE_ID) {
+ branchName = "${env.CHANGE_TARGET}".toLowerCase()
+ }
+ if (branchName.equals("master")) {
+ branchName = "current"
+ }
+ env.DOCKER_IMAGE = "vyos/vyos-build:" + branchName
}
}
}
@@ -88,7 +98,6 @@ pipeline {
}
options {
disableConcurrentBuilds()
- skipDefaultCheckout()
timeout(time: 30, unit: 'MINUTES')
timestamps()
}
@@ -97,8 +106,7 @@ pipeline {
steps {
script {
dir('build') {
- git branch: getGitBranchName(),
- url: getGitRepoURL()
+ checkout scm
}
}
}