forked from xenit-eu/alfred-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
85 lines (81 loc) · 2.85 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
74
75
76
77
78
79
80
81
82
83
84
85
def sendEmailNotifications() {
def color = 'purple'
switch(currentBuild.currentResult) {
case 'FAILURE': case 'UNSTABLE':
color = 'red'
break
case 'SUCCESS':
color = 'green'
break
}
subject = "Jenkins job ${env.JOB_NAME} #${env.BUILD_NUMBER}: ${currentBuild.currentResult}"
body = """<html><body>
<p>
<b>Job ${env.JOB_NAME} #${env.BUILD_NUMBER}: <span style="color: ${color};">${currentBuild.currentResult}</span></b>
</p>
<p>
Check console output at <a href='${env.BUILD_URL}'>${env.JOB_NAME}</a>
</p></body></html>"""
emailext(
subject: subject,
body: body,
mimeType: 'text/html',
recipientProviders: [requestor(), culprits(), brokenBuildSuspects()]
)
}
def BuildVersionX(version) {
def gradleCommand = "./gradlew --info --stacktrace "
sh "${gradleCommand} :apix-impl:apix-impl-${version}:test"
sh "${gradleCommand} :apix-integrationtests:test-${version}:integrationTest"
}
node {
def gradleCommand = "./gradlew --info --stacktrace "
try {
stage("Checkout") {
checkout scm
sh "./setup.sh"
}
stage("Build interface") {
// Execute before the integration testing so we can catch potential errors early
sh "${gradleCommand} :apix-interface:build :apix-interface:javadoc"
}
stage("Build 50") {
BuildVersionX( "50")
}
stage("Build 51") {
BuildVersionX("51")
}
stage("Build 52") {
BuildVersionX("52")
}
stage("Build 60") {
BuildVersionX("60")
}
stage("Build 61") {
BuildVersionX("61")
}
stage("Publishing") {
def gitBranch = env.BRANCH_NAME
if(gitBranch.startsWith("release") || gitBranch == "master") {
withCredentials([
usernamePassword(credentialsId: 'sonatype', passwordVariable: 'sonatypePassword', usernameVariable: 'sonatypeUsername'),
string(credentialsId: 'gpgpassphrase', variable: 'gpgPassPhrase')]) {
sh "${gradleCommand} publish " +
" -Ppublish_username=${sonatypeUsername} " +
" -Ppublish_password=${sonatypePassword} " +
" -PkeyId=DF8285F0 " +
" -Ppassword=${gpgPassPhrase} " +
" -PsecretKeyRingFile=/var/jenkins_home/secring.gpg "
}
}
}
}
finally {
stage("Final cleanup") {
junit '**/build/test-results/**/*.xml'
sh "${gradleCommand} composeDownForced"
sendEmailNotifications()
cleanWs()
}
}
}