From 45a9ea3c32183c0b0e7bbcabbe41dbe8d6337744 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 6 Oct 2019 11:33:51 +0200 Subject: Jenkins: add getGitRepoName() --- Jenkinsfile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c81dc1d7..34c7b766 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,11 +25,17 @@ def getGitRepoURL() { return scm.userRemoteConfigs[0].url } -// Returns true if this is a custom build launched on any project fork, -// returns false if this is build from git@github.com:vyos/vyos-build.git +def getGitRepoName() { + return getGitRepoURL().split('/').last() +} + +// Returns true if this is a custom build launched on any project fork. +// Returns false if this is build from git@github.com:vyos/. +// can be e.g. vyos-1x.git or vyatta-op.git def isCustomBuild() { - def gitURI = "git@github.com:vyos/vyos-build.git" - def httpURI = "https://github.com/vyos/vyos-build.git" + // GitHub organisation base URL + def gitURI = 'git@github.com:vyos/' + getGitRepoName() + def httpURI = 'https://github.com/vyos/' + getGitRepoName() return ! ((getGitRepoURL() == gitURI) || (getGitRepoURL() == httpURI)) } -- cgit v1.2.3