Skip to content

Instantly share code, notes, and snippets.

@NicolasGeraud
Created February 7, 2020 14:48
Show Gist options
  • Save NicolasGeraud/87e83cac31da98c3c8d269a144679803 to your computer and use it in GitHub Desktop.
Save NicolasGeraud/87e83cac31da98c3c8d269a144679803 to your computer and use it in GitHub Desktop.
node("Agent001") {
def server
def buildInfo
stage ('Checkout') {
checkout scm
}
stage ('Artifactory configuration') {
server = Artifactory.server "sprint0-artifactory"
rtMaven = Artifactory.newMavenBuild()
rtMaven.tool = "mvn"
rtMaven.deployer releaseRepo: 'private-releases', snapshotRepo: 'private-snapshots', server: server
buildInfo = Artifactory.newBuildInfo()
}
stage ("Build") {
rtMaven.run pom: 'pom.xml', goals: 'clean install', buildInfo: buildInfo
}
stage ('Publish build info') {
try {
sh "ls **/target/surefire-reports/TEST-*.xml"
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
} catch (Exception ex) {
echo "No tests to archive"
}
try {
sh "ls target/surefire-reports/TEST-*.xml"
step([$class: 'JUnitResultArchiver', testResults: 'target/surefire-reports/TEST-*.xml'])
} catch (Exception ex) {
echo "No tests to archive"
}
server.publishBuildInfo buildInfo
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment