hal/Jenkinsfile

36 lines
1.1 KiB
Text
Raw Normal View History

2017-01-10 17:22:51 +01:00
// Jenkinsfile (Pipeline Script)
node {
// Configure environment
2017-10-17 16:29:07 +02:00
env.JAVA_HOME = tool name: 'jdk8'
2017-01-10 17:22:51 +01:00
env.REPO_URL = "repo.koc.se/hal.git" //scm.getUserRemoteConfigs()[0].getUrl()
2020-08-28 23:07:24 +02:00
env.BUILD_NAME = "BUILD-${env.BUILD_ID}"
2017-01-10 17:22:51 +01:00
checkout scm
stage('Build') {
2020-08-28 23:07:24 +02:00
sh './gradlew clean'
sh './gradle build'
2017-01-10 17:22:51 +01:00
}
stage('Test') {
try {
2020-08-28 23:07:24 +02:00
sh './gradlew test'
2017-01-10 17:22:51 +01:00
} finally {
2020-08-28 23:07:24 +02:00
step([$class: 'JUnitResultArchiver', testResults: 'build/test-results/test/*.xml'])
2017-01-10 17:22:51 +01:00
}
}
stage('Package') {
2020-08-28 23:07:24 +02:00
sh './gradlew distZip'
archiveArtifacts artifacts: 'build/distributions/Hal.zip', fingerprint: true
2017-01-10 17:22:51 +01:00
// 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}"
}
}
}