Skip to content

Commit

Permalink
[BUILD] Fix numbering issues. (#1436)
Browse files Browse the repository at this point in the history
Jenkins does not set empty env variables. Therefore the
CI_VERSION_SUFFIX is set to BRANCH_NAME.
  • Loading branch information
michal-raska authored and mmalohlava committed Nov 20, 2018
1 parent ed297dc commit 03d9a89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ CONTAINER_TAG := $(shell echo $(VERSION) | sed 's/[+\/]/-/g')

CONTAINER_NAME_TAG = $(CONTAINER_NAME):$(CONTAINER_TAG)

CI_VERSION_SUFFIX ?= $(BRANCH_NAME)
ifneq ($(CI), 1)
CI_VERSION_SUFFIX ?= $(BRANCH_NAME)
endif

ARCH_SUBST = undefined
FROM_SUBST = undefined
Expand Down
5 changes: 3 additions & 2 deletions ci/Jenkinsfile.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ ansiColor('xterm') {
def stageDir = 'checkout'
dir (stageDir) {
buildSummary.stageWithSummary('Checkout and Setup Env', stageDir) {
deleteDir()
def scmEnv = checkout scm
env.DTBL_GIT_HASH = scmEnv.GIT_COMMIT
env.BRANCH_NAME = scmEnv.GIT_BRANCH.replaceAll('origin/', '').replaceAll('/', '-')
Expand All @@ -121,7 +122,7 @@ ansiColor('xterm') {
if (isRelease()) {
CI_VERSION_SUFFIX = ''
}
if (env.BRANCH_NAME != 'master' || !env.BRANCH_NAME.startsWith(RELEASE_BRANCH_PREFIX)) {
if (env.BRANCH_NAME != 'master' && !env.BRANCH_NAME.startsWith(RELEASE_BRANCH_PREFIX)) {
CI_VERSION_SUFFIX = "${env.BRANCH_NAME.replaceAll('(/|_|\\ )', '-')}${CI_VERSION_SUFFIX.split('_').last()}"
}
env.CI_VERSION_SUFFIX = CI_VERSION_SUFFIX
Expand All @@ -133,7 +134,7 @@ ansiColor('xterm') {
}

stash includes: "CHANGELOG.md", name: 'CHANGELOG'
final String dockerImageTag = sh(script: 'make docker_image_tag', returnStdout: true).trim()
final String dockerImageTag = sh(script: "make ${MAKE_OPTS} docker_image_tag", returnStdout: true).trim()
docker.image("${X86_64_CENTOS_DOCKER_IMAGE_NAME}:${dockerImageTag}").inside {
def dockerfileSHAsString = ""
EXPECTED_SHAS.files.each { filename, sha ->
Expand Down

0 comments on commit 03d9a89

Please sign in to comment.