From 9786bc4c98dd07312150861e96b712d3811541c2 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Sat, 14 Nov 2020 14:10:44 +1000 Subject: [PATCH] add Jenkinsfile for autobahn build Signed-off-by: olivier lamy --- Jenkinsfile-autobahn | 104 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 Jenkinsfile-autobahn diff --git a/Jenkinsfile-autobahn b/Jenkinsfile-autobahn new file mode 100644 index 00000000000..ec3922c8eb3 --- /dev/null +++ b/Jenkinsfile-autobahn @@ -0,0 +1,104 @@ +#!groovy + +pipeline { + agent any + // save some io during the build + options { durabilityHint( 'PERFORMANCE_OPTIMIZED' ) } + stages { + stage( "Parallel Stage" ) { + parallel { + stage( "Build / Test - JDK11" ) { + agent { + node { label 'linux' } + } + steps { + container( 'jetty-build' ) { + timeout( time: 120, unit: 'MINUTES' ) { + mavenBuild( "jdk11", "-T3 clean install -Pautobahn", "maven3", true ) // + // Collect up the jacoco execution results (only on main build) + jacoco inclusionPattern: '**/org/eclipse/jetty/**/*.class', + exclusionPattern: '' + + // build tools + '**/org/eclipse/jetty/ant/**' + ',**/org/eclipse/jetty/maven/**' + + ',**/org/eclipse/jetty/jspc/**' + + // example code / documentation + ',**/org/eclipse/jetty/embedded/**' + ',**/org/eclipse/jetty/asyncrest/**' + + ',**/org/eclipse/jetty/demo/**' + + // special environments / late integrations + ',**/org/eclipse/jetty/gcloud/**' + ',**/org/eclipse/jetty/infinispan/**' + + ',**/org/eclipse/jetty/osgi/**' + ',**/org/eclipse/jetty/spring/**' + + ',**/org/eclipse/jetty/http/spi/**' + + // test classes + ',**/org/eclipse/jetty/tests/**' + ',**/org/eclipse/jetty/test/**', + execPattern: '**/target/jacoco.exec', + classPattern: '**/target/classes', + sourcePattern: '**/src/main/java' + warnings consoleParsers: [[parserName: 'Maven'], [parserName: 'Java']] + junit testResults: '**/target/surefire-reports/*.xml,**/target/invoker-reports/TEST*.xml,**/target/autobahntestsuite-reports/*.xml' + } + } + } + } + } + } + } + post { + failure { + slackNotif() + } + unstable { + slackNotif() + } + fixed { + slackNotif() + } + } +} + + +def slackNotif() { + script { + try { + if (env.BRANCH_NAME == 'jetty-10.0.x' || env.BRANCH_NAME == 'jetty-9.4.x' || env.BRANCH_NAME == 'jetty-11.0.x') { + //BUILD_USER = currentBuild.rawBuild.getCause(Cause.UserIdCause).getUserId() + // by ${BUILD_USER} + COLOR_MAP = ['SUCCESS': 'good', 'FAILURE': 'danger', 'UNSTABLE': 'danger', 'ABORTED': 'danger'] + slackSend channel: '#jenkins', + color: COLOR_MAP[currentBuild.currentResult], + message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} - ${env.BUILD_URL}" + } + } catch (Exception e) { + e.printStackTrace() + echo "skip failure slack notification: " + e.getMessage() + } + } +} + +/** + * To other developers, if you are using this method above, please use the following syntax. + * + * mavenBuild("", " " + * + * @param jdk the jdk tool name (in jenkins) to use for this build + * @param cmdline the command line in " "`format. + * @paran mvnName maven installation to use + * @return the Jenkinsfile step representing a maven build + */ +def mavenBuild(jdk, cmdline, mvnName, junitPublishDisabled) { + def localRepo = ".repository" + def mavenOpts = '-Xms1g -Xmx4g -Djava.awt.headless=true' + + withMaven( + maven: mvnName, + jdk: "$jdk", + publisherStrategy: 'EXPLICIT', + options: [junitPublisher(disabled: junitPublishDisabled), mavenLinkerPublisher(disabled: false), pipelineGraphPublisher(disabled: false)], + mavenOpts: mavenOpts, + mavenLocalRepo: localRepo) { + // Some common Maven command line + provided command line + sh "mvn -Premote-session-tests -Pci -V -B -e -Djetty.testtracker.log=true $cmdline -Dunix.socket.tmp=" + env.JENKINS_HOME + } +} + + +// vim: et:ts=2:sw=2:ft=groovy