Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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