From 6acc6e0876d70a3626b1e3897e20c46e1ace789c Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 7 Jul 2018 08:39:37 +0100 Subject: [PATCH] jenkins: only deploy when published to github --- Jenkinsfile.groovy | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile.groovy b/Jenkinsfile.groovy index e61c0ee..b26d332 100644 --- a/Jenkinsfile.groovy +++ b/Jenkinsfile.groovy @@ -1,3 +1,4 @@ +final String publicRepo = 'https://github.com/kemitix/' final String mvn = "mvn --batch-mode --update-snapshots --errors" final Integer dependenciesSupportJDK = 10 @@ -23,10 +24,10 @@ pipeline { } } } - stage('Deploy (release on gitlab)') { + stage('Deploy (published release branch)') { when { expression { - (branchStartsWith('release/') && isPublished()) + (branchStartsWith('release/') && isPublished(publicRepo)) } } steps { @@ -58,10 +59,11 @@ private boolean branchStartsWith(String branchName) { startsWith(env.GIT_BRANCH, branchName) } -private boolean isPublished() { - startsWith(env.GIT_URL, 'https://') +private boolean isPublished(repo) { + startsWith(env.GIT_URL, repo) } private boolean startsWith(String value, String match) { value != null && value.startsWith(match) } +