zutil/Jenkinsfile

44 lines
1.1 KiB
Text
Raw Normal View History

2016-12-19 15:56:30 +01:00
// Jenkinsfile (Pipeline Script)
node {
2016-12-19 17:24:07 +01:00
// Configure environment
2016-12-19 16:16:39 +01:00
env.JAVA_HOME = tool name: 'JDK8'
2016-12-19 17:24:07 +01:00
env.REPO_URL = "repo.koc.se/zutil-java.git" //scm.getUserRemoteConfigs()[0].getUrl()
env.BUILD_NAME = "BUILD-" + env.BUILD_ID
2016-12-19 16:16:39 +01:00
2016-12-19 15:56:30 +01:00
2016-12-19 17:24:07 +01:00
checkout scm
2016-12-19 16:16:39 +01:00
2016-12-19 15:56:30 +01:00
stage('Build') {
sh 'ant clean'
sh 'ant build'
}
stage('Test') {
try {
sh 'ant test'
} finally {
step([$class: 'JUnitResultArchiver', testResults: 'build/reports/*.xml'])
}
}
stage('Package') {
2016-12-19 17:02:55 +01:00
sh 'ant package'
2016-12-19 17:24:07 +01:00
archiveArtifacts artifacts: 'build/release/*', fingerprint: true
2016-12-19 17:02:55 +01:00
// Tag artifact
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'f8e5f6c6-4adb-4ab2-bb5d-1c8535dff491',
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
2016-12-19 17:24:07 +01:00
sh "git tag ${env.BUILD_NAME}"
sh "git push 'https://${USERNAME}:${PASSWORD}@${env.REPO_URL}' ${env.BUILD_NAME}"
2016-12-19 17:02:55 +01:00
}
2016-12-19 15:56:30 +01:00
}
}
2016-12-20 17:22:58 +01:00
//stage('Deploy') {
// input message: 'Deploy?', submitter: 'ziver'
// node {
// sh 'ant deploy'
// }
//}