| #!groovy |
| // Jenkins Settings |
| properties([ |
| [$class: 'jenkins.model.BuildDiscarderProperty', |
| strategy: [$class: 'LogRotator', numToKeepStr: '20', artifactNumToKeepStr: '20'] |
| ] |
| ]) |
| |
| timestamps { |
| timeout(time: 45, unit: 'MINUTES') { |
| node() { |
| try { |
| currentBuild.displayName=env.BRANCH_NAME + ' #' + env.BUILD_NUMBER |
| |
| // Gain access to installed tools in Jenkins |
| def JAVA_TOOL=tool 'jdk1.8.0-latest' |
| def MAVEN_TOOL=tool 'apache-maven-latest' |
| def MEM_ARGS="-Xms512m -Xmx4096m -XX:MaxPermSize=2048m" |
| |
| stage('Preparation') { |
| checkout scm |
| } |
| |
| stage('Build') { |
| withEnv(["JAVA_HOME=${JAVA_TOOL}", "PATH+MAVEN=${MAVEN_TOOL}/bin:${env.JAVA_HOME}/bin", |
| "JAVA_OPTS=${MEM_ARGS}", "MAVEN_OPTS=${MEM_ARGS}"]) { |
| try { |
| wrap([$class:'Xvnc', useXauthority: true]) { |
| sh "mvn -V -B -e -fae -T 4 clean install -DskipRCP" |
| } |
| } finally { |
| step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml']) |
| } |
| } |
| } |
| |
| // Archive the update site so that we can use it in the future - but only for the master branch. |
| if (env.BRANCH_NAME.equals("master")) { |
| stage('Archive Artifacts') { |
| // Fingerprints will allow this artifact to be traceable if a downstream job references it in the future. |
| archiveArtifacts artifacts: 'releng/org.eclipse.tigerstripe.update-site/target/*.zip', fingerprint: true |
| } |
| } |
| |
| currentBuild.result = 'SUCCESS' |
| } catch (any) { |
| currentBuild.result = 'FAILURE' |
| throw any |
| } finally { |
| if (currentBuild.result != 'ABORTED') { |
| step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'danijoh2@cisco.com,rcraddoc@cisco.com', sendToIndividuals: true]) |
| } |
| } |
| } |
| } |
| } |