-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
35 lines (29 loc) · 1.06 KB
/
Jenkinsfile
File metadata and controls
35 lines (29 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Jenkinsfile (Pipeline Script)
node {
// Configure environment
env.JAVA_HOME = tool name: 'jdk-11'
env.REPO_URL = "repo.koc.se/hal.git" //scm.getUserRemoteConfigs()[0].getUrl()
env.BUILD_NAME = "BUILD-${env.BUILD_ID}"
checkout scm
stage('Build') {
sh './gradlew clean'
sh './gradlew build'
}
stage('Test') {
try {
sh './gradlew test'
} finally {
step([$class: 'JUnitResultArchiver', testResults: 'build/test-results/test/*.xml'])
}
}
stage('Package') {
sh './gradlew distZip'
archiveArtifacts artifacts: 'build/distributions/Hal.zip', 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}"
}
}
}