From 2696744006a44f210a66e96a1f9ed396c46baf36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Wed, 2 May 2018 07:59:28 +0200 Subject: [PATCH] test --- Jenkinsfile | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 34465f3..562b197 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,26 +1,20 @@ #!/usr/bin/env groovy import groovy.json.JsonOutput -// for inline scripts -def gitRepo -def gitBranch +def gitRepo = "" +def gitBranch = params.GIT_BRANCH != null && params.GIT_BRANCH != "" ? params.GIT_BRANCH : "master" node('nodejs') { // Get Source Code from SCM (Git) as configured in the Jenkins Project stage('Checkout Source') { // For Jenkinsfile from GIT - checkout scm - gitRepo = scm.getUserRemoteConfigs()[0].getUrl() - gitBranch = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim() - - sh 'env' - echo "${gitRepo} ${gitBranch}" - sh 'false' - - // for inline scripts - //git url: gitRepo - //gitRepo = "https://github.com/nmasse-itix/summit-api.git" - //gitBranch = "master" + if (gitRepo == null || gitRepo == "") { + checkout scm + gitRepo = scm.getUserRemoteConfigs()[0].getUrl() + } else { + // for inline scripts + git url: gitRepo, branch: gitBranch + } } def towerExtraVars = [