-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathJenkinsfile
73 lines (69 loc) · 1.7 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
68
69
70
71
72
73
#!/usr/bin/env groovy
pipeline {
agent {
docker {
image 'prefec2/jdk11-maven-363-gradle671'
args env.DOCKER_ARGS
}
}
environment {
GRADLE_USER_HOME= "${env.WORKSPACE}/.gradle"
}
stages {
stage('Build') {
steps {
sh 'test -d $GRADLE_USER_HOME || mkdir $GRADLE_USER_HOME'
sh './gradlew clean'
sh './gradlew assemble'
}
}
stage('Test') {
steps {
sh './gradlew test'
}
}
stage('Static Analysis') {
steps {
sh './gradlew check'
}
post {
always {
recordIssues(
enabledForFailure: true, tools: [
java(),
javaDoc(),
checkStyle(pattern: '**/build/reports/checkstyle/*.xml'),
pmdParser(pattern: '**/build/reports/pmd/*.xml')
]
)
}
}
}
stage ('Deploy') {
when {
beforeAgent true
branch 'master'
}
steps {
withCredentials([
usernamePassword(
credentialsId: 'sonatype-username-pw',
usernameVariable: 'teetimeMavenUser',
passwordVariable: 'teetimeMavenPassword'
),
string(
credentialsId: 'sonatype-teetime-pgp-passphrase',
variable: 'PASSPHRASE'),
file(
credentialsId: 'sonatype-pgp-key',
variable: 'KEY_FILE'),
string(
credentialsId: 'sonatype-key-id',
variable: 'KEY_ID')
]) {
sh './gradlew -Psigning.secretKeyRingFile="${KEY_FILE}" -Psigning.password="${PASSPHRASE}" -Psigning.keyId="${KEY_ID}" publish'
}
}
}
}
}