Properly collect project version number for CI jobs.
The outputs on Jenkins are very different than the outputs when run locally. They must be gathered in a more sophisticated fashion that grepping console logs.
This commit is contained in:
26
Jenkinsfile
vendored
26
Jenkinsfile
vendored
@@ -39,17 +39,6 @@ pipeline {
|
||||
}
|
||||
stage("Test other configurations") {
|
||||
parallel {
|
||||
stage("Test: springnext (jdk8)") {
|
||||
agent {
|
||||
docker {
|
||||
image 'adoptopenjdk/openjdk8:latest'
|
||||
args '-v $HOME/.m2:/root/.m2'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh "PROFILE=springnext,convergence ci/test.sh"
|
||||
}
|
||||
}
|
||||
stage("Test: spring-buildsnapshot (jdk8)") {
|
||||
agent {
|
||||
docker {
|
||||
@@ -121,11 +110,8 @@ pipeline {
|
||||
|
||||
steps {
|
||||
script {
|
||||
// Warm up this plugin quietly before using it.
|
||||
sh "./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version"
|
||||
|
||||
PROJECT_VERSION = sh(
|
||||
script: "./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO",
|
||||
script: "ci/version.sh",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
@@ -174,11 +160,8 @@ pipeline {
|
||||
|
||||
steps {
|
||||
script {
|
||||
// Warm up this plugin quietly before using it.
|
||||
sh "./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version"
|
||||
|
||||
PROJECT_VERSION = sh(
|
||||
script: "./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO",
|
||||
script: "ci/version.sh",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
@@ -209,11 +192,8 @@ pipeline {
|
||||
|
||||
steps {
|
||||
script {
|
||||
// Warm up this plugin quietly before using it.
|
||||
sh "./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version"
|
||||
|
||||
PROJECT_VERSION = sh(
|
||||
script: "./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO",
|
||||
script: "ci/version.sh",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
./mvnw -P${PROFILE} -Dmaven.test.skip=true clean deploy -B
|
||||
MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -P${PROFILE} -Dmaven.test.skip=true clean deploy -B
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
./mvnw -P${PROFILE} clean dependency:list test -Dsort -B
|
||||
MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -P${PROFILE} clean dependency:list test -Dsort -B
|
||||
|
||||
14
ci/version.sh
Executable file
14
ci/version.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
RAW_VERSION=`MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw \
|
||||
org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate \
|
||||
-Dexpression=project.version -q -DforceStdout`
|
||||
|
||||
# Split things up
|
||||
VERSION_PARTS=($RAW_VERSION)
|
||||
|
||||
# Grab the last part, which is the actual version number.
|
||||
echo ${VERSION_PARTS[${#VERSION_PARTS[@]}-1]}
|
||||
|
||||
Reference in New Issue
Block a user