You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2018/06/29 12:13:07 UTC

[maven-jenkins-lib] branch master updated (ccdee50 -> 8496179)

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

rfscholte pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jenkins-lib.git.


    from ccdee50  TLSv1.x being deactivated since June. So only TLSv1.2 is valid for Central.
     new 0b6e9ff  Add asfMavenTlpPlgnBuild to run plugins with multiple Maven versions
     new 8496179  Add maven version to stageId

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 vars/asfMavenTlpPlgnBuild.groovy | 167 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 167 insertions(+)
 create mode 100644 vars/asfMavenTlpPlgnBuild.groovy


[maven-jenkins-lib] 01/02: Add asfMavenTlpPlgnBuild to run plugins with multiple Maven versions

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jenkins-lib.git

commit 0b6e9ff2ff438b1bca87e6d7feefa8f247fc091b
Author: rfscholte <rf...@apache.org>
AuthorDate: Thu May 10 11:46:54 2018 +0200

    Add asfMavenTlpPlgnBuild to run plugins with multiple Maven versions
---
 vars/asfMavenTlpPlgnBuild.groovy | 167 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 167 insertions(+)

diff --git a/vars/asfMavenTlpPlgnBuild.groovy b/vars/asfMavenTlpPlgnBuild.groovy
new file mode 100644
index 0000000..ac85231
--- /dev/null
+++ b/vars/asfMavenTlpPlgnBuild.groovy
@@ -0,0 +1,167 @@
+#!/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
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def call(Map params = [:]) {
+  def failingFast = null
+  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 mavens = params.containsKey('maven') ? params.maven : ['3.0.x','3.1.x','3.2.x','3.3.x','3.5.x']
+    def failFast = params.containsKey('failFast') ? params.failFast : true
+    Map tasks = [failFast: failFast]
+    boolean first = true
+    for (String os in oses) {
+      for (def mvn in mavens) {
+	    def jdk = jenkinsEnv.jdkForMaven(mvn)
+		jdks.remove(jdk)
+	    doCreateTask( os, jdk, mvn, tasks )
+      }
+      for (def jdk in jdks) {
+	    def mvn = jenkinsEnv.mavenForJdk(jdk)
+	    doCreateTask( os, jdk, mvn, tasks )
+      }
+    }
+    // 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 (failingFast != null) {
+      echo "***** FAST FAILURE *****\n\nFast failure triggered by ${failingFast}\n\n***** FAST FAILURE *****"
+    }
+    stage("Notifications") {
+      jenkinsNotify()
+    }
+  }
+}
+
+def doCreateTask( os, jdk, maven, tasks )
+{
+	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',
+	]
+	if (!first) {
+	  cmd += '-Dfindbugs.skip=true'
+	}
+	cmd += 'clean'
+	cmd += 'verify'
+	def disablePublishers = !first
+	first = false
+	String stageId = "${os}-jdk${jdk}"
+	tasks[stageId] = {
+	  node(label) {
+		stage("Checkout ${stageId}") {
+		  try {
+			dir('m') {
+			  checkout scm
+			}
+		  } catch (Throwable e) {
+			if (!failFast) {
+			  throw e
+			} else if (failingFast == null) {
+			  failingFast = stageId
+			  echo "[FAIL FAST] This is the first failure and likely root cause"
+			  throw e
+			} else {
+			  echo "[FAIL FAST] ${failingFast} had first failure, ignoring ${e.message}"
+			}
+		  }
+		}
+		stage("Build ${stageId}") {
+		  if (failingFast != null) {
+			echo "[FAIL FAST] ${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 ('m') {
+				if (isUnix()) {
+				  sh cmd.join(' ')
+				} else {
+				  bat cmd.join(' ')
+				}
+			  }
+			}
+		  } catch (Throwable e) {
+			if (!failFast) {
+			  throw e
+			} else if (failingFast == null) {
+			  failingFast = stageId
+			  echo "[FAIL FAST] This is the first failure and likely root cause"
+			  throw e
+			} else {
+			  echo "[FAIL FAST] ${failingFast} had first failure, ignoring ${e.message}"
+			}
+		  }
+		}
+	  }
+	}
+}
\ No newline at end of file


[maven-jenkins-lib] 02/02: Add maven version to stageId

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jenkins-lib.git

commit 8496179b512a24c21334ae0a5ef7986fce3b03d2
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Jun 29 14:12:13 2018 +0200

    Add maven version to stageId
---
 vars/asfMavenTlpPlgnBuild.groovy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vars/asfMavenTlpPlgnBuild.groovy b/vars/asfMavenTlpPlgnBuild.groovy
index ac85231..5d706bb 100644
--- a/vars/asfMavenTlpPlgnBuild.groovy
+++ b/vars/asfMavenTlpPlgnBuild.groovy
@@ -109,7 +109,7 @@ def doCreateTask( os, jdk, maven, tasks )
 	cmd += 'verify'
 	def disablePublishers = !first
 	first = false
-	String stageId = "${os}-jdk${jdk}"
+	String stageId = "${os}-jdk${jdk}_m${maven}"
 	tasks[stageId] = {
 	  node(label) {
 		stage("Checkout ${stageId}") {