zutil/Jenkinsfile

38 lines
1.1 KiB
Text
Raw Normal View History

2017-10-06 17:13:45 +02:00
#!groovy
2016-12-19 15:56:30 +01:00
// Jenkinsfile (Pipeline Script)
node {
2016-12-19 17:24:07 +01:00
// Configure environment
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
2017-10-06 17:13:45 +02:00
stage('Checkout') {
git url: "https://" + env.REPO_URL
}
2016-12-19 15:56:30 +01:00
2017-10-11 15:45:47 +02:00
withMaven(jdk: "jdk8", maven: "m3.5", mavenLocalRepo: ".repository", mavenSettingsConfig: "639c4560-87b7-4502-bb3d-2c44845cd2b5") {
2016-12-19 15:56:30 +01:00
2017-10-06 16:37:36 +02:00
stage('Build') {
sh 'mvn clean compile'
2016-12-19 15:56:30 +01:00
}
2017-10-06 16:37:36 +02:00
stage('Test') {
2017-10-06 17:13:45 +02:00
sh 'mvn test'
2017-10-06 16:37:36 +02:00
}
2016-12-19 15:56:30 +01:00
2017-10-06 16:37:36 +02:00
stage('Package') {
2017-10-11 15:09:00 +02:00
sh 'mvn -DskipStatic -DskipTests package'
2016-12-19 17:02:55 +01:00
2017-10-06 16:37:36 +02:00
// Tag artifact
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'f8e5f6c6-4adb-4ab2-bb5d-1c8535dff491',
2017-10-06 17:13:45 +02:00
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
2017-10-06 16:37:36 +02: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
}
2017-10-11 14:51:33 +02:00
stage('Deploy') {
sh 'mvn -DskipStatic -DskipTests deploy'
}
2016-12-19 15:56:30 +01:00
}
}