You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2019/11/07 12:42:26 UTC
[maven] 03/03: inject buildId containing commitId into classifier
for CI archive
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch reproducible
in repository https://gitbox.apache.org/repos/asf/maven.git
commit 8fe26fa8398caa286835289867b924bd54303392
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Mon Sep 23 08:16:29 2019 +0200
inject buildId containing commitId into classifier for CI archive
---
Jenkinsfile | 56 ++++++----------------------------
apache-maven/pom.xml | 8 ++---
apache-maven/src/main/assembly/bin.xml | 2 +-
apache-maven/src/main/assembly/src.xml | 2 +-
pom.xml | 1 +
5 files changed, 17 insertions(+), 52 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index d3cc099..dfc49a3 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -26,50 +26,9 @@ def runITsOses = ['linux', 'windows']
def runITsJdks = ['7', '8', '11','12']
def runITsMvn = '3.6.0'
def runITscommand = "mvn clean install -Prun-its,embedded -B -U -V" // -DmavenDistro=... -Dmaven.test.failure.ignore=true
-def tests
try {
-def osNode = jenkinsEnv.labelForOS(buildOs)
-node(jenkinsEnv.nodeSelection(osNode)) {
- dir('build') {
- stage('Checkout') {
- checkout scm
- }
-
- def WORK_DIR=pwd()
- def MAVEN_GOAL='verify'
-
- stage('Configure deploy') {
- if (env.BRANCH_NAME == 'master'){
- MAVEN_GOAL='deploy'
- }
- }
-
- stage('Build / Unit Test') {
- String jdkName = jenkinsEnv.jdkFromVersion(buildOs, buildJdk)
- String mvnName = jenkinsEnv.mvnFromVersion(buildOs, buildMvn)
- withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/.repository", options:[
- artifactsPublisher(disabled: false),
- junitPublisher(ignoreAttachments: false),
- findbugsPublisher(disabled: false),
- openTasksPublisher(disabled: false),
- dependenciesFingerprintPublisher(),
- invokerPublisher(),
- pipelineGraphPublisher()
- ]) {
- sh "mvn clean ${MAVEN_GOAL} -B -U -e -fae -V -Dmaven.test.failure.ignore=true"
- }
- dir ('apache-maven/target') {
- sh "mv apache-maven-*-bin.zip apache-maven-dist.zip"
- stash includes: 'apache-maven-dist.zip', name: 'dist'
- }
- }
-
- tests = resolveScm source: [$class: 'GitSCMSource', credentialsId: '', id: '_', remote: 'https://gitbox.apache.org/repos/asf/maven.git', traits: [[$class: 'jenkins.plugins.git.traits.BranchDiscoveryTrait'], [$class: 'GitToolSCMSourceTrait', gitTool: 'Default']]], targets: [BRANCH_NAME, 'master']
- }
-}
-
Map runITsTasks = [:]
for (String os in runITsOses) {
for (def jdk in runITsJdks) {
@@ -79,7 +38,7 @@ for (String os in runITsOses) {
echo "OS: ${os} JDK: ${jdk} => Label: ${osLabel} JDK: ${jdkName}"
def cmd = [
- 'mvn',
+ 'mvn', 'clean',
'verify',
'-DskipTests', '-Drat.skip'
]
@@ -87,15 +46,16 @@ for (String os in runITsOses) {
// Java 7u80 has TLS 1.2 disabled by default: need to explicitely enable
cmd += '-Dhttps.protocols=TLSv1.2'
}
+ cmd += "-DbuildId=${os}-jdk${jdk}"
String stageId = "${os}-jdk${jdk}"
- String stageLabel = "Rebuild ${os.capitalize()} Java ${jdk}"
+ String stageLabel = "${os.capitalize()} Java ${jdk}"
runITsTasks[stageId] = {
node(jenkinsEnv.nodeSelection(osLabel)) {
def WORK_DIR=pwd()
stage("${stageLabel}") {
echo "NODE_NAME = ${env.NODE_NAME}"
- checkout tests
+ checkout scm
withMaven(jdk: jdkName, maven: mvnName, mavenLocalRepo:"${WORK_DIR}/.repository", options:[
artifactsPublisher(disabled: false),
junitPublisher(ignoreAttachments: false),
@@ -106,9 +66,13 @@ for (String os in runITsOses) {
pipelineGraphPublisher()
]) {
if (isUnix()) {
- sh cmd.join(' ')
+ String commitId = sh(returnStdout: true, script: 'git rev-parse HEAD')
+ sh cmd.join(' ') + "-${commitId}"
} else {
- bat cmd.join(' ')
+ String commitId = bat(returnStdout: true, script: 'git rev-parse HEAD').tokenize(' ')[-1].trim()
+ echo "commitId = ${commitId}"
+ echo "command = " + cmd.join(' ') + "-${commitId}"
+ bat cmd.join(' ') + "-${commitId}"
}
}
}
diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml
index 83aab4e..48fed66 100644
--- a/apache-maven/pom.xml
+++ b/apache-maven/pom.xml
@@ -210,10 +210,10 @@ under the License.
<fileSet>
<directory>${project.build.directory}</directory>
<includes>
- <include>${project.artifactId}-${project.version}-bin.zip</include>
- <include>${project.artifactId}-${project.version}-bin.tar.gz</include>
- <include>${project.artifactId}-${project.version}-src.zip</include>
- <include>${project.artifactId}-${project.version}-src.tar.gz</include>
+ <include>${project.artifactId}-${project.version}-bin-${buildId}.zip</include>
+ <include>${project.artifactId}-${project.version}-bin-${buildId}.tar.gz</include>
+ <include>${project.artifactId}-${project.version}-src-${buildId}.zip</include>
+ <include>${project.artifactId}-${project.version}-src-${buildId}.tar.gz</include>
</includes>
</fileSet>
</fileSets>
diff --git a/apache-maven/src/main/assembly/bin.xml b/apache-maven/src/main/assembly/bin.xml
index a04557d..85c02db 100644
--- a/apache-maven/src/main/assembly/bin.xml
+++ b/apache-maven/src/main/assembly/bin.xml
@@ -19,7 +19,7 @@ under the License.
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
- <id>bin</id>
+ <id>bin-${buildId}</id>
<formats>
<format>zip</format>
<format>tar.gz</format>
diff --git a/apache-maven/src/main/assembly/src.xml b/apache-maven/src/main/assembly/src.xml
index 9f43a0a..45fc78b 100644
--- a/apache-maven/src/main/assembly/src.xml
+++ b/apache-maven/src/main/assembly/src.xml
@@ -19,7 +19,7 @@ under the License.
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
- <id>src</id>
+ <id>src-${buildId}</id>
<formats>
<format>zip</format>
<format>tar.gz</format>
diff --git a/pom.xml b/pom.xml
index 46f4926..13c20f3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -77,6 +77,7 @@ under the License.
<checkstyle.violation.ignore>None</checkstyle.violation.ignore>
<checkstyle.excludes>**/package-info.java</checkstyle.excludes>
<project.build.outputTimestamp>2019-11-07T12:32:18Z</project.build.outputTimestamp>
+ <buildId>${os.name}-jdk${java.version}</buildId>
</properties>
<modules>