From 18a77b4e5dd658171c3c45b847b1cd7ef6ac864f Mon Sep 17 00:00:00 2001 From: Andrei Gheorghiu Date: Tue, 18 Oct 2016 15:53:13 +0200 Subject: changed how we get manifest repo url --- Jenkinsfile | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'Jenkinsfile') diff --git a/Jenkinsfile b/Jenkinsfile index 409597e..087101e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,18 +5,27 @@ MANIFEST_REPOSITORY = null BRANCH = env.BRANCH_NAME -node ('master') { - print 'master node' - dir ("../${env.BRANCH_NAME}@script") { - def git_remote_url = sh returnStdout: true, script: "git remote get-url origin" - def git_repo = git_remote_url.trim().split('/')[-1] - def git_repo_name = git_repo.replace('.git','') - def profile = git_repo_name.split('-')[-1] - env.PROFILE = profile - MANIFEST_REPOSITORY = git_remote_url.trim() - sh 'echo $PROFILE' - } -} +def scmInstance = scm.getUserRemoteConfigs()[0] +MANIFEST_REPOSITORY = scmInstance.getUrl() +def git_repo_name = scmInstance.getName() +env.PROFILE = git_repo_name.split('-')[-1] + +print "MANIFEST_REPOSITORY: " + MANIFEST_REPOSITORY +print "git_repo_name: " + git_repo_name +print "PROFILE: " + env.PROFILE + +// node ('master') { + // print 'master node' + // dir ("../${env.BRANCH_NAME}@script") { + // def git_remote_url = sh returnStdout: true, script: "git remote get-url origin" + // def git_repo = git_remote_url.trim().split('/')[-1] + // def git_repo_name = git_repo.replace('.git','') + // def profile = git_repo_name.split('-')[-1] + // env.PROFILE = profile + // MANIFEST_REPOSITORY = git_remote_url.trim() + // sh 'echo $PROFILE' + // } +// } fileLoader.withGit('git@git.enea.se:eltf/jenkins.git', 'master', null, '') { fileLoader.load('freeze_manifest.groovy'); -- cgit v1.2.3-54-g00ecf