diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-18 22:13:04 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-03-18 22:13:04 +0100 |
commit | 8b7940111a0ed42d19be30bac7f951b385eb3e85 (patch) | |
tree | 76ede54d880703553c4412bb2697a338088b86f5 /Jenkinsfile | |
parent | 57bd20e3f1bbf41724b9d743f27b82419d70886f (diff) | |
download | vyos-1x-8b7940111a0ed42d19be30bac7f951b385eb3e85.tar.gz vyos-1x-8b7940111a0ed42d19be30bac7f951b385eb3e85.zip |
Jenkins: T1817: support GitHub PullRequest builds
Diffstat (limited to 'Jenkinsfile')
-rw-r--r-- | Jenkinsfile | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Jenkinsfile b/Jenkinsfile index ed98477f2..7a79b0f43 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 } } } |