hal/Jenkinsfile
2017-10-17 16:29:07 +02:00

36 lines
1 KiB
Groovy
Executable file

// Jenkinsfile (Pipeline Script)
node {
// Configure environment
env.JAVA_HOME = tool name: 'jdk8'
env.REPO_URL = "repo.koc.se/hal.git" //scm.getUserRemoteConfigs()[0].getUrl()
env.BUILD_NAME = "BUILD-" + env.BUILD_ID
checkout scm
stage('Build') {
sh 'ant clean'
sh 'ant build-all'
}
stage('Test') {
try {
sh 'ant test-all'
} finally {
step([$class: 'JUnitResultArchiver', testResults: 'build/reports/*.xml'])
}
}
stage('Package') {
sh 'ant package-all'
archiveArtifacts artifacts: 'build/release/**', fingerprint: true
// Tag artifact
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'f8e5f6c6-4adb-4ab2-bb5d-1c8535dff491',
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
sh "git tag ${env.BUILD_NAME}"
sh "git push 'https://${USERNAME}:${PASSWORD}@${env.REPO_URL}' ${env.BUILD_NAME}"
}
}
}