Add the Jenkinsfile that's currently being used in ci.j.o to the repo

This commit is contained in:
R. Tyler Croy 2016-02-12 09:43:23 -08:00
parent 4ac543b576
commit 70574f9b9d
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F

40
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,40 @@
#!groovy
/* Only keep the X most recent builds. */
properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator',
numToKeepStr: '50',
artifactNumToKeepStr: '20']]])
stage 'Build'
node('docker') {
checkout scm
withMavenEnv {
sh 'mvn clean package'
step([$class: 'ArtifactArchiver', artifacts: '**/target/*.war', fingerprint: true])
}
}
/* This code shame-lessly copied and pasted from some Jenkinsfile code abayer
wrote for the jenkinsci/jenkins project */
void withMavenEnv(List envVars = [], def body) {
// The names here are currently hardcoded for my test environment. This needs
// to be made more flexible.
// Using the "tool" Workflow call automatically installs those tools on the
// node.
String mvntool = tool name: "mvn3.3.3", type: 'hudson.tasks.Maven$MavenInstallation'
String jdktool = tool name: "jdk7_80", type: 'hudson.model.JDK'
// Set JAVA_HOME, MAVEN_HOME and special PATH variables for the tools we're
// using.
List mvnEnv = ["PATH+MVN=${mvntool}/bin", "PATH+JDK=${jdktool}/bin", "JAVA_HOME=${jdktool}", "MAVEN_HOME=${mvntool}"]
// Add any additional environment variables.
mvnEnv.addAll(envVars)
// Invoke the body closure we're passed within the environment we've created.
withEnv(mvnEnv) {
body.call()
}
}