This is an automated email from the ASF dual-hosted git repository.

gboue pushed a commit to branch fix-it-failure
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git


The following commit(s) were added to refs/heads/fix-it-failure by this push:
     new 1c57e1d  archive invoker output to see what is going on...
1c57e1d is described below

commit 1c57e1d5953e786310b39c5d25ae81a0245057f8
Author: Guillaume BouĂ© <[email protected]>
AuthorDate: Fri Aug 17 20:48:34 2018 +0200

    archive invoker output to see what is going on...
---
 Jenkinsfile | 194 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 192 insertions(+), 2 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index dc229a1..2278690 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,4 +1,6 @@
-/**
+#!/usr/bin/env groovy
+
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -17,4 +19,192 @@
  * under the License.
  */
 
-asfMavenTlpPlgnBuild(jdk:['8'],os:['windows'],maven:['3.5.x'])
+build(jdk:['8'],os:['windows'],maven:['3.5.x'])
+
+def build(Map params = [:]) {
+  Map taskContext = [:]
+  try {
+    // set build retention time first
+    def buildRetention
+    if (env.BRANCH_NAME == 'master') {
+      buildRetention = buildDiscarder(logRotator(artifactDaysToKeepStr: '', 
artifactNumToKeepStr: '3', daysToKeepStr: '21', numToKeepStr: '25'))
+    } else {
+      buildRetention = buildDiscarder(logRotator(artifactDaysToKeepStr: '', 
artifactNumToKeepStr: '1', daysToKeepStr: '7', numToKeepStr: '5'))
+    }
+    properties([buildRetention])
+
+    // now determine the matrix of parallel builds
+    def oses = params.containsKey('os') ? params.os : ['linux', 'windows']
+    def jdks = params.containsKey('jdks') ? params.jdks : 
params.containsKey('jdk') ? params.jdk : ['7','8','9','10']
+    def jdkMin = jdks[0];
+    def mavens = params.containsKey('maven') ? params.maven : 
['3.0.x','3.2.x','3.3.x','3.5.x']
+    // def failFast = params.containsKey('failFast') ? params.failFast : true
+    // Just temporarily
+    def failFast = false;
+    def siteJdk = params.containsKey('siteJdk') ? params.siteJdk : '8'
+    def siteMvn = params.containsKey('siteMvn') ? params.siteJdk : '3.5.x'
+    
+    taskContext['failFast'] = failFast;
+    Map tasks = [failFast: failFast]
+    boolean first = true
+    for (String os in oses) {
+      for (def mvn in mavens) {
+        def jdk = Math.max( jdkMin as Integer, jenkinsEnv.jdkForMaven( mvn ) 
as Integer) as String
+        jdks = jdks.findAll{ it != jdk }
+        doCreateTask( os, jdk, mvn, tasks, first, 'build', taskContext )
+      }
+      for (def jdk in jdks) {
+        def mvn = jenkinsEnv.mavenForJdk(jdk)
+        doCreateTask( os, jdk, mvn, tasks, first, 'build', taskContext )
+      }
+      
+      // doesn't work for multimodules yet
+      // doCreateTask( os, siteJdk, siteMvn, tasks, first, 'site', taskContext 
)
+      
+      // run with apache-release profile, consider it a dryRun with SNAPSHOTs
+      // doCreateTask( os, siteJdk, siteMvn, tasks, first, 'release', 
taskContext )
+    }
+    // run the parallel builds
+    parallel(tasks)
+
+    // JENKINS-34376 seems to make it hard to detect the aborted builds
+  } catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
+    // this ambiguous condition means a user probably aborted
+    if (e.causes.size() == 0) {
+      currentBuild.result = "ABORTED"
+    } else {
+      currentBuild.result = "FAILURE"
+    }
+    throw e
+  } catch (hudson.AbortException e) {
+    // this ambiguous condition means during a shell step, user probably 
aborted
+    if (e.getMessage().contains('script returned exit code 143')) {
+      currentBuild.result = "ABORTED"
+    } else {
+      currentBuild.result = "FAILURE"
+    }
+    throw e
+  } catch (InterruptedException e) {
+    currentBuild.result = "ABORTED"
+    throw e
+  } catch (Throwable e) {
+    currentBuild.result = "FAILURE"
+    throw e
+  } finally {
+    // notify completion
+    if (taskContext.failingFast != null) {
+      echo "***** FAST FAILURE *****\n\nFast failure triggered by 
${taskContext.failingFast}\n\n***** FAST FAILURE *****"
+    }
+    stage("Notifications") {
+      jenkinsNotify()
+    }
+  }
+}
+
+def doCreateTask( os, jdk, maven, tasks, first, plan, taskContext )
+{
+    String label = jenkinsEnv.labelForOS(os);
+    String jdkName = jenkinsEnv.jdkFromVersion(os, "${jdk}")
+    String mvnName = jenkinsEnv.mvnFromVersion(os, "${maven}")
+    echo "OS: ${os} JDK: ${jdk} Maven: ${maven} => Label: ${label} JDK: 
${jdkName} Maven: ${mvnName}"
+    if (label == null || jdkName == null || mvnName == null) {
+      echo "Skipping ${os}-jdk${jdk} as unsupported by Jenkins Environment"
+      return;
+    }
+    def cmd = [
+      'mvn',
+      '-P+run-its',
+      '-Dmaven.test.failure.ignore=true',
+      '-Dfindbugs.failOnError=false',
+      '-DskipTests',
+    ]
+    if (!first) {
+      cmd += '-Dfindbugs.skip=true'
+    }
+    if (jdk == '7') {
+      // Java 7u80 has TLS 1.2 disabled by default: need to explicitely enable
+      cmd += '-Dhttps.protocols=TLSv1.2'
+    }
+
+    if (plan == 'build') {
+      cmd += 'clean'
+      cmd += 'verify'
+    }
+    else if (plan == 'site') {
+      cmd += 'site'
+      cmd += '-Preporting'
+    }
+    else if (plan == 'release') {
+      cmd += 'verify'
+      cmd += '-Papache-release'
+    }
+    
+    def disablePublishers = !first
+    first = false
+    String stageId = "${os}-jdk${jdk}-m${maven}_${plan}"
+    tasks[stageId] = {
+      node(jenkinsEnv.nodeSelection(label)) {
+      stage("Checkout ${stageId}") {
+        echo "PATH: ${env.PATH}"
+        try {
+          dir(stageId) {
+            checkout scm
+          }
+        } catch (Throwable e) {
+          // First step to keep the workspace clean and safe disk space
+          cleanWs()
+          if (!taskContext.failFast) {
+            throw e
+          } else if (taskContext.failingFast == null) {
+            taskContext.failingFast = stageId
+            echo "[FAIL FAST] This is the first failure and likely root cause"
+            throw e
+          } else {
+            echo "[FAIL FAST] ${taskContext.failingFast} had first failure, 
ignoring ${e.message}"
+          }
+        } 
+      }
+      stage("Build ${stageId}") {
+        if (taskContext.failingFast != null) {
+          cleanWs()
+          echo "[FAIL FAST] ${taskContext.failingFast} has failed. Skipping 
${stageId}."
+        } else try {
+          withMaven(jdk:jdkName, maven:mvnName, mavenLocalRepo:'.repository', 
options: [
+            artifactsPublisher(disabled: disablePublishers),
+            junitPublisher(ignoreAttachments: false),
+            findbugsPublisher(disabled: disablePublishers),
+            openTasksPublisher(disabled: disablePublishers),
+            dependenciesFingerprintPublisher(),
+            invokerPublisher(),
+            pipelineGraphPublisher()
+          ]) {
+            dir (stageId) {
+              if (isUnix()) {
+                sh cmd.join(' ')
+              } else {
+                bat cmd.join(' ')
+              }
+            }
+          }
+          dir (stageId) {
+            zip archive: true, zipFile: 'invoker.zip', dir: 
'target/it/detectLinks'
+          }
+        } catch (Throwable e) {
+          // First step to keep the workspace clean and safe disk space
+          cleanWs()
+          if (!taskContext.failFast) {
+            throw e
+          } else if (taskContext.failingFast == null) {
+            taskContext.failingFast = stageId
+            echo "[FAIL FAST] This is the first failure and likely root cause"
+            throw e
+          } else {
+            echo "[FAIL FAST] ${taskContext.failingFast} had first failure, 
ignoring ${e.message}"
+          }
+        } finally {
+          cleanWs()
+        }
+      }
+      }
+    }
+}

Reply via email to