-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
67 lines (59 loc) · 1.88 KB
/
Jenkinsfile
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
library identifier: 'notifications@master', retriever: modernSCM(
[$class: 'GitSCMSource',
remote: 'https://github.com/zero-88/jenkins-pipeline-shared.git'])
pipeline {
agent {
docker "gradle:jdk8-alpine"
}
stages {
stage("Build") {
steps {
sh "gradle clean dist"
script {
VERSION = sh(script: "gradle properties | grep 'version:' | awk '{print \$2}'", returnStdout: true).trim()
}
}
post {
success {
archiveArtifacts artifacts: "build/distributions/*", fingerprint: true
archiveArtifacts artifacts: "build/docs/*", fingerprint: true
}
}
}
stage("Test") {
steps {
sh "gradle test jacocoTestReport"
}
post {
always {
junit 'build/test-results/**/*.xml'
zip archive: true, dir: "build/reports", zipFile: "build/reports/test-reports.zip"
}
}
}
stage("Analysis") {
steps {
script {
withCredentials([string(credentialsId: 'SONAR_TOKEN', variable: 'SONAR_TOKEN')]) {
sh "set +x"
sh "gradle sonarqube -Dsonar.organization=zero-88-github -Dsonar.branch.name=${GIT_BRANCH} " +
"-Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${SONAR_TOKEN}"
}
}
}
}
stage("Publish") {
when { tag "v*" }
steps {
// TODO: Update later
echo "Deploy"
}
}
}
post {
always {
sh "apk add git"
emailNotifications(VERSION)
}
}
}