From 91ca492a76b56cbf2eefd8ab6340cbd6b616dd51 Mon Sep 17 00:00:00 2001 From: Venkateshwaran Selvaraj <venkateshwarans@ilimi.in> Date: Tue, 16 Feb 2021 17:31:18 +0530 Subject: [PATCH] Issue #000 fix: Jenkins changes update --- Jenkinsfile | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 155bca5..f78ee7b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,19 +15,9 @@ node('build-slave') { else println(ANSI_BOLD + ANSI_GREEN + "Found environment variable named hub_org with value as: " + hub_org + ANSI_NORMAL) cleanWs() - if (params.github_release_tag == "") { - checkout scm - commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim() - branch_name = sh(script: 'git name-rev --name-only HEAD | rev | cut -d "/" -f1| rev', returnStdout: true).trim() - build_tag = branch_name + "_" + commit_hash - println(ANSI_BOLD + ANSI_YELLOW + "github_release_tag not specified, using the latest commit hash: " + commit_hash + ANSI_NORMAL) - } - else { - def scmVars = checkout scm - checkout scm: [$class: 'GitSCM', branches: [[name: "refs/tags/$params.github_release_tag"]], userRemoteConfigs: [[url: scmVars.GIT_URL]]] - build_tag = params.github_release_tag - println(ANSI_BOLD + ANSI_YELLOW + "github_release_tag specified, building from github_release_tag: " + params.github_release_tag + ANSI_NORMAL) - } + checkout scm + commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim() + build_tag = sh(script: "echo " + params.github_release_tag.split('/')[-1] + "_" + commit_hash + "_" + env.BUILD_NUMBER, returnStdout: true).trim() echo "build_tag: " + build_tag } @@ -51,4 +41,4 @@ node('build-slave') { throw err } -} \ No newline at end of file +} -- GitLab