forked from argouml-tigris-org/argouml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
81 lines (76 loc) · 2.42 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
#!groovy
// This is the same file in all argouml projects that use maven. The
// process to do changes in this file is:
// 1. Make the change in the argouml project.
// 2. Push the change to gerrit to get it verified, approved and merged.
// 3. Copy the new version of the file into all other projects and push
// it to gerrit to get it verified, approved and merged in each of
// the other projects.
//
// The file contains some assumptions on how the build machine is set up.
// See https://github.com/argouml-tigris-org/argouml/wiki/Jenkins-configuration
if (env.GERRIT_API_URL == null) {
this.gerritComment = { dict -> }
this.gerritReview = { dict -> }
}
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '10', daysToKeepStr: '100'))
}
triggers {
snapshotDependencies()
}
agent {
docker {
image 'maven:3-ibmjava-8'
args '-v maven-repo:/var/maven/.m2 -e MAVEN_CONFIG=/var/maven/.m2'
}
}
environment {
GERRIT_CREDENTIALS_ID = 'gerrithub-user'
}
stages {
stage('compile') {
steps {
gerritReview labels: [Verified:0], message: """Build starts.
Build has these steps:
1. Compile (corresponding to mvn compile).
2. Run tests (corresponding to mvn test).
3. Generate site (corresponding to mvn site).
If these are all successful, it is scored as Verified."""
timeout(time:1, unit: 'HOURS') {
withMaven() {
sh '$MVN_CMD -Duser.home=/var/maven -B compile'
}
}
gerritReview labels: [:], message: "Compiled without error."
}
}
stage('test') {
steps {
timeout(time:1, unit: 'HOURS') {
withMaven() {
sh '$MVN_CMD -Duser.home=/var/maven -B test'
}
}
gerritReview labels: [:], message: "Tests run without error."
}
}
stage('site') {
steps {
timeout(time:1, unit: 'HOURS') {
withMaven(options: [junitPublisher(disabled: true,
healthScaleFactor: 0.0)]) {
sh '$MVN_CMD -Duser.home=/var/maven -B site'
}
}
gerritReview labels: [:], message: "Site generated without error."
}
}
}
post {
success { gerritReview labels: [Verified: 1], message: 'Build succeeded.' }
unstable { gerritReview labels: [Verified: 0], message: 'Build is unstable' }
failure { gerritReview labels: [Verified: -1], message: 'Build failed.' }
}
}