Skip to content

Instantly share code, notes, and snippets.

@foxutech
Created March 22, 2018 11:43
Show Gist options
  • Save foxutech/2b2999f70188ddca2573ebf1ba000019 to your computer and use it in GitHub Desktop.
Save foxutech/2b2999f70188ddca2573ebf1ba000019 to your computer and use it in GitHub Desktop.
node ('master'){
checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CleanCheckout']],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: 'git-credentials', url: 'https://github.com/user/repo.git']]
])
steps {
sh 'ant -f build.xml -v'
}
post {
success {
archiveArtifacts artifacts: 'dist/*.jar', fingerprint: true
}
}
stage("SonarQube Quality Gate") {
timeout(time: 1, unit: 'HOURS') {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
stage ('Distribute binaries') {
def SERVER_ID = '4711'
def server = Artifactory.server SERVER_ID
def uploadSpec =
"""
{
"files": [
{
"pattern": "all/target/all-(*).war",
"target": "libs-snapshots-local/com/huettermann/web/{1}/"
}
]
}
"""
def buildInfo = Artifactory.newBuildInfo()
buildInfo.env.capture = true
buildInfo=server.upload(uploadSpec)
server.publishBuildInfo(buildInfo)
}
post {
success {
emailext(
subject: "${env.JOB_NAME} [${env.BUILD_NUMBER}] Development Promoted to Master",
body: """<p>'${env.JOB_NAME} [${env.BUILD_NUMBER}]' Development Promoted to Master":</p>
<p>Check console output at &QUOT;<a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>&QUOT;</p>""",
to: "[email protected]"
)
}
}
post {
failure {
emailext(
subject: "${env.JOB_NAME} [${env.BUILD_NUMBER}] Failed!",
body: """<p>'${env.JOB_NAME} [${env.BUILD_NUMBER}]' Failed!":</p>
<p>Check console output at &QUOT;<a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>&QUOT;</p>""",
to: "[email protected]"
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment