From fd231b40fca4d277bd7b74f6dfffd34438e8c152 Mon Sep 17 00:00:00 2001 From: Primakov Alexandr Date: Wed, 4 Mar 2020 23:25:29 +0300 Subject: [PATCH] branch name --- predeploy/Jenkinsfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/predeploy/Jenkinsfile b/predeploy/Jenkinsfile index a0c197c..149cec8 100644 --- a/predeploy/Jenkinsfile +++ b/predeploy/Jenkinsfile @@ -2,14 +2,17 @@ stage ('predeploy') { echo 'checking tag' script { def tag = sh(returnStdout: true, script: "git tag --contains").trim() + def branchName = sh(returnStdout: true, script: "git rev-parse --abbrev-ref HEAD").trim() if (tag) { echo 'found tag ' + tag def tagNoV = tag.substring(1) - sh "cd ${TARGET_FOLDER} ; echo 'mkdir ${tagNoV}; mv ./master/* ./${tagNoV}; rm -r -d ./master; rm ${DEPLOY_VERSION_SH}' > ${DEPLOY_VERSION_SH}" + sh "cd ${TARGET_FOLDER}; echo '${tagNoV}' > ${DEPLOY_VERSION_VAR}" + // sh "cd ${TARGET_FOLDER} ; echo 'mkdir ${tagNoV}; mv ./${branchName}/* ./${tagNoV}; rm -r -d ./${branchName}; rm ${DEPLOY_VERSION_VAR}' > ${DEPLOY_VERSION_VAR}" } else { echo 'tag not found' - sh "cd ${TARGET_FOLDER} ; echo 'rm ${DEPLOY_VERSION_SH}' > ${DEPLOY_VERSION_SH}" + sh "cd ${TARGET_FOLDER}; echo '${branchName}' > ${DEPLOY_VERSION_VAR}" + // sh "cd ${TARGET_FOLDER} ; echo 'rm ${DEPLOY_VERSION_VAR}' > ${DEPLOY_VERSION_VAR}" } } }