forked from kiegroup/optaweb-vehicle-routing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
95 lines (87 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
86
87
88
89
90
91
92
93
94
95
@Library('jenkins-pipeline-shared-libraries')_
changeAuthor = env.ghprbPullAuthorLogin ?: CHANGE_AUTHOR
changeBranch = env.ghprbSourceBranch ?: CHANGE_BRANCH
changeTarget = env.ghprbTargetBranch ?: CHANGE_TARGET
pipeline {
agent {
label 'kie-rhel7 && kie-mem16g'
}
tools {
maven 'kie-maven-3.6.3'
jdk 'kie-jdk11'
}
options {
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '10', numToKeepStr: '')
timeout(time: 120, unit: 'MINUTES')
}
environment {
MAVEN_OPTS = '-Xms1024m -Xmx4g'
}
stages {
stage('Initialize') {
steps {
script {
mailer.buildLogScriptPR()
checkoutRepo('optaweb-vehicle-routing')
}
}
}
stage('Build Optaweb Vehicle Routing') {
steps {
mavenCleanInstall("optaweb-vehicle-routing", false, ["run-code-coverage", "integration-tests"])
}
}
/* Uncomment to switch SonarCloud analysis from Travis to this pipeline.
stage('Analyze Optaweb Vehicle Routing by SonarCloud') {
steps {
withCredentials([string(credentialsId: 'SONARCLOUD_TOKEN', variable: 'SONARCLOUD_TOKEN')]) {
runMaven("sonar:sonar", "optaweb-vehicle-routing", true, ["sonarcloud-analysis"], "-e -nsu")
}
}
*/
}
post {
always {
sh '$WORKSPACE/trace.sh'
junit '**/target/surefire-reports/**/*.xml, **/target/failsafe-reports/**/*.xml'
echo 'Archiving screenshots and videos ...'
archiveArtifacts artifacts: '**/cypress/screenshots/**, **/cypress/videos/**'
cleanWs()
}
failure {
script {
mailer.sendEmail_failedPR()
}
}
unstable {
script {
mailer.sendEmail_unstablePR()
}
}
fixed {
script {
mailer.sendEmail_fixedPR()
}
}
}
}
void checkoutRepo(String repo, String dirName = repo) {
dir(dirName) {
githubscm.checkoutIfExists(repo, changeAuthor, changeBranch, 'kiegroup', changeTarget, true)
}
}
void mavenCleanInstall(String directory, boolean skipTests = false, List profiles = [], String extraArgs = "") {
runMaven("clean install", directory, skipTests, profiles, extraArgs)
}
void runMaven(String command, String directory, boolean skipTests = false, List profiles = [], String extraArgs = "") {
mvnCmd = command
if (profiles.size() > 0) {
mvnCmd += " -P${profiles.join(',')}"
}
if (extraArgs != "") {
mvnCmd += " ${extraArgs}"
}
dir(directory) {
maven.runMavenWithSubmarineSettings(mvnCmd, skipTests)
}
}