summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-21 18:24:34 +0100
committerChristian Poessinger <christian@poessinger.com>2020-03-21 18:24:34 +0100
commit9f31d2668852aa97c1416f2a17da2a80e8d7cec8 (patch)
tree1b87cffdb27500404d3e45c16f2706799e62ae2b
parentaf845dc0624f42127961ed2237b37269c6b23ebc (diff)
downloadvyos-salt-minion-9f31d2668852aa97c1416f2a17da2a80e8d7cec8.tar.gz
vyos-salt-minion-9f31d2668852aa97c1416f2a17da2a80e8d7cec8.zip
Jenkins: T1870: support GitHub PullRequest builds
-rw-r--r--Jenkinsfile14
1 files changed, 9 insertions, 5 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index ed98477..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() {
@@ -74,7 +74,13 @@ node('Docker') {
script {
// create container name on demand
def branchName = getGitBranchName()
- if (branchName == "master") {
+ // 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
@@ -92,7 +98,6 @@ pipeline {
}
options {
disableConcurrentBuilds()
- skipDefaultCheckout()
timeout(time: 30, unit: 'MINUTES')
timestamps()
}
@@ -101,8 +106,7 @@ pipeline {
steps {
script {
dir('build') {
- git branch: getGitBranchName(),
- url: getGitRepoURL()
+ checkout scm
}
}
}