Skip to content

Instantly share code, notes, and snippets.

@twasink
Created August 1, 2016 12:56
Show Gist options
  • Save twasink/2e893dc50d20fac2a94661042da8aa2b to your computer and use it in GitHub Desktop.
Save twasink/2e893dc50d20fac2a94661042da8aa2b to your computer and use it in GitHub Desktop.
#!groovy
node {
// Need to replace the '%2F' used by Jenkins to deal with / in the path (e.g. story/...)
// because tests that do getResource will escape the % again, and the test files can't be found
ws("workspace/${env.JOB_NAME}/${env.BRANCH_NAME}".replace('%2F', '_')) {
// Mark the code checkout 'stage'....
stage 'Checkout'
checkout scm
// Mark the code build 'stage'....
stage 'Build'
def mvnHome = tool 'maven-3.3.9'
sh "${mvnHome}/bin/mvn clean verify -B"
junit testResults: '**/surefire-reports/*.xml'
stage 'Publish'
step([$class: 'S3BucketPublisher',
dontWaitForConcurrentBuildCompletion: false,
entries: [[bucket: '${env.MY_S3_BUCKET}',
excludedFile: '',
flatten: false,
gzipFiles: false,
keepForever: false,
managedArtifacts: true,
noUploadOnFailure: true,
selectedRegion: 'us-east-1',
sourceFile: '**/target/*.war',
storageClass: 'STANDARD',
uploadFromSlave: true,
useServerSideEncryption: false
]],
profileName: 's3Artefacts'])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment