Skip to content

Commit

Permalink
Get PROJECT_VERSION from version-def.sh [skip ci] (#7141)
Browse files Browse the repository at this point in the history
* Get PROJECT_VERSION from version-def.sh

`cut -d , ...` will fail to parse PROJECT_VERSION, if we change the echo output in version-def.sh

Change the way to get PROJECT_VERSION from version-def.sh

Run stage 'Determine Project Version' in docker container to fix "mvn: command not found"

Signed-off-by: Tim Liu <[email protected]>

* PREMERGE_CI_2_ARGUMENT = 'ci_2'

Signed-off-by: Tim Liu <[email protected]>

Signed-off-by: Tim Liu <[email protected]>
  • Loading branch information
NvTimLiu authored Nov 23, 2022
1 parent 2354799 commit b7ada9f
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions jenkins/Jenkinsfile-blossom.premerge
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,23 @@ pipeline {

steps {
script {
// Retrieve PROJECT_VER from version-def.sh, e.g, '<major>.<minor>.<patch>-SNAPSHOT'
PROJECT_VER = sh(returnStdout: true, script: "bash $JENKINS_ROOT/version-def.sh | cut -d ',' -f 3 | cut -d ' ' -f 3")
PROJECT_VER = PROJECT_VER.split('-')[0] // Remove trailing '-SNAPSHOT'
echo PROJECT_VER

def versions = PROJECT_VER.split('\\.')
major_ver = versions[0].toInteger()
minor_ver = versions[1].toInteger()
container('cpu') {
// Retrieve PROJECT_VER from version-def.sh, e.g, '<major>.<minor>.<patch>-SNAPSHOT'
PROJECT_VER = sh(returnStdout: true,
script: '''#!/bin/bash
source jenkins/version-def.sh >& /dev/null
echo $PROJECT_VER
''').trim()
PROJECT_VER = PROJECT_VER.split('-')[0] // Remove trailing '-SNAPSHOT'
echo PROJECT_VER

def versions = PROJECT_VER.split('\\.')
major_ver = versions[0].toInteger()
minor_ver = versions[1].toInteger()

if (major_ver >= 22) {
PREMERGE_CI_2_ARGUMENT = "ci_2"
} else {
error("Unsupported major version: $major_ver")
echo PREMERGE_CI_2_ARGUMENT
}

echo PREMERGE_CI_2_ARGUMENT
}
}
}
Expand Down

0 comments on commit b7ada9f

Please sign in to comment.