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 55829c23590e553d0d8b507b4c8a4de12f9c40bc
Author: HervĂ© Boutemy <[email protected]>
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, 19 insertions(+), 50 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 ef6ce9b..48fed66 100644
--- a/apache-maven/pom.xml
+++ b/apache-maven/pom.xml
@@ -184,6 +184,7 @@ under the License.
             <configuration>
               <descriptors>
                 <descriptor>src/main/assembly/bin.xml</descriptor>
+                <descriptor>src/main/assembly/src.xml</descriptor>
               </descriptors>
             </configuration>
           </execution>
@@ -192,6 +193,7 @@ under the License.
       <plugin>
         <groupId>net.nicoulaj.maven.plugins</groupId>
         <artifactId>checksum-maven-plugin</artifactId>
+        <version>1.8</version>
         <executions>
           <execution>
             <id>source-release-checksum</id>
@@ -208,8 +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}-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 327ed52..6ca2550 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 3a8234c..2ebc86f 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>
     <source-date-epoch>1569085893</source-date-epoch>
+    <buildId>${os.name}-jdk${java.version}</buildId>
   </properties>
 
   <modules>

Reply via email to