Skip to content

Commit

Permalink
Issue #000 fix: updated build script
Browse files Browse the repository at this point in the history
  • Loading branch information
krgauraw committed Feb 23, 2021
1 parent 94b71b2 commit 22d1eba
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions build/content-service/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,11 @@ 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 + "_" + env.BUILD_NUMBER
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 + "_" + env.BUILD_NUMBER
println(ANSI_BOLD + ANSI_YELLOW + "github_release_tag specified, building from 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

stage('Build') {
Expand Down Expand Up @@ -55,4 +47,4 @@ node('build-slave') {
currentBuild.result = "FAILURE"
throw err
}
}
}

0 comments on commit 22d1eba

Please sign in to comment.