40 lines
1.2 KiB
Groovy
Executable file
40 lines
1.2 KiB
Groovy
Executable file
// Jenkinsfile (Pipeline Script)
|
|
node {
|
|
// Configure environment
|
|
//env.JAVA_HOME = tool name: 'JDK8'
|
|
env.REPO_URL = "repo.koc.se/zallery.git"
|
|
env.BUILD_NAME = "BUILD-" + env.BUILD_ID
|
|
|
|
|
|
checkout scm
|
|
|
|
stage('Build') {
|
|
sh 'ant clean'
|
|
sh 'ant build'
|
|
}
|
|
|
|
stage('Package') {
|
|
sh 'ant package'
|
|
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}"
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Deploy') {
|
|
timeout(time:2, unit:'HOURS') {
|
|
input message: 'Deploy?', submitter: 'ziver'
|
|
}
|
|
node {
|
|
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: '46f1d99b-2037-47b9-a7b7-57a1066337fc',
|
|
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
|
|
sh 'ant -Dtomcat.user=${USERNAME} -Dtomcat.pass=${PASSWORD} deploy'
|
|
}
|
|
}
|
|
}
|
|
|