You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by sk...@apache.org on 2019/05/10 12:50:11 UTC

[netbeans-jenkins-lib] branch master created (now 35d41df)

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

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


      at 35d41df  Initial commit copy deeply inspired by Apache Archiva

This branch includes the following new commits:

     new 35d41df  Initial commit copy deeply inspired by Apache Archiva

The 1 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.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[netbeans-jenkins-lib] 01/01: Initial commit copy deeply inspired by Apache Archiva

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

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

commit 35d41dfe30d91bd1b41f894f3b91c9a849f9255f
Author: Eric Barboni <sk...@apache.org>
AuthorDate: Fri May 10 14:49:56 2019 +0200

    Initial commit copy deeply inspired by Apache Archiva
---
 README                       |   1 +
 vars/asfStandardBuild.groovy | 134 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 135 insertions(+)

diff --git a/README b/README
new file mode 100644
index 0000000..7af3655
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+Shared Jenkins pipeline for Apache NetBeans Maven related builds
diff --git a/vars/asfStandardBuild.groovy b/vars/asfStandardBuild.groovy
new file mode 100644
index 0000000..072399e
--- /dev/null
+++ b/vars/asfStandardBuild.groovy
@@ -0,0 +1,134 @@
+#!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.
+ */
+
+// this script is taken from olamy works on archiva-jenkins-lib for the Apache Archiva project
+def call(Map params = [:]) {
+    // Faster build and reduces IO needs
+    properties([
+            disableConcurrentBuilds(),
+            durabilityHint('PERFORMANCE_OPTIMIZED'),
+            buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '3'))
+        ])
+
+    // now determine params
+    def jdk = params.containsKey('jdk') ? params.jdk : 'JDK 1.8 (latest)'
+    // use the cmdLine parameter otherwise default depending on current branch
+    def cmdline = params.containsKey('cmdline') ? params.cmdline : (env.BRANCH_NAME == 'master'?"clean deploy":"clean install")
+    def mvnName = params.containsKey('mvnName') ? params.mvnName : 'Maven 3.5.2'
+
+
+    def defaultPublishers = [artifactsPublisher(disabled: false), junitPublisher(ignoreAttachments: false, disabled: false),
+        findbugsPublisher(disabled: true), openTasksPublisher(disabled: true),
+        dependenciesFingerprintPublisher(disabled: false), invokerPublisher(disabled: true),
+        pipelineGraphPublisher(disabled: false), mavenLinkerPublisher(disabled: false)]
+
+    def publishers = params.containsKey('publishers') ? params.publishers : defaultPublishers
+
+
+    pipeline {
+        agent any
+        stages{
+            stage("Build"){
+                agent { node { label 'ubuntu' } }
+                options { timeout(time: 120, unit: 'MINUTES') }
+                steps{
+                    mavenBuild( jdk, cmdline, mvnName, publishers)
+                }
+            }
+        }
+        post {
+            always {
+                cleanWs() // deleteDirs: true, notFailBuild: true, patterns: [[pattern: '**/.repository/**', type: 'INCLUDE']]
+            }
+            unstable {
+                script{
+                    notifyBuild( "Unstable Build ")
+                }
+            }
+            failure {
+                script{
+                    notifyBuild( "Error in build ")
+                }
+            }
+            success {
+                script {
+                    def previousResult = currentBuild.previousBuild?.result
+                    if (previousResult && !currentBuild.resultIsWorseOrEqualTo( previousResult ) ) {
+                        notifyBuild( "Fixed" )
+                    }
+                }
+            }
+        }
+    }
+}
+
+/**
+ * To other developers, if you are using this method above, please use the following syntax.
+ *
+ * mavenBuild("<jdk>", "<profiles> <goals> <plugins> <properties>"
+ *
+ * @param jdk the jdk tool name (in jenkins) to use for this build
+ * @param cmdline the command line in "<profiles> <goals> <properties>"`format.
+ * @paran mvnName maven installation to use
+ * @param publishers array of publishers to configure (need to be defined as we publisherStrategy: 'EXPLICIT')
+ * @return the Jenkinsfile step representing a maven build
+ */
+def mavenBuild(jdk, cmdline, mvnName, publishers) {
+    def localRepo = "../.maven_repositories/${env.EXECUTOR_NUMBER}" // ".repository" //
+    //def settingsName = 'archiva-uid-jenkins'
+    def mavenOpts = '-Xms1g -Xmx4g -Djava.awt.headless=true'
+
+    withMaven(
+        maven: mvnName,
+        jdk: "$jdk",
+        options: publishers,
+        publisherStrategy: 'EXPLICIT',
+        //globalMavenSettingsConfig: settingsName,
+        mavenOpts: mavenOpts,
+        mavenLocalRepo: localRepo) {
+        // Some common Maven command line + provided command line
+        sh "mvn -V -B -U -e -Dmaven.test.failure.ignore=true $cmdline "
+    }
+}
+
+def notifyBuild(String buildStatus) {
+    // default the value
+    buildStatus = buildStatus ?: "UNKNOWN"
+    def color
+    if (buildStatus == 'STARTED') {
+        color = '#F0F0F0'
+    } else if (buildStatus == 'SUCCESS') {
+        color = '#00FF00'
+    } else if (buildStatus == 'UNSTABLE') {
+        color = '#ffff50'
+    } else if (buildStatus == 'UNKNOWN') {
+        color = '#a0a0a0'
+    }else {
+        color = '#FF0000'
+    }
+    slackSend (channel:'#netbeans-builds', message:"${buildStatus}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL}) ",color: color)
+     
+
+     
+}
+
+// vim: et:ts=2:sw=2:ft=groovy
+


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists