forked from neoteric-eu/neo-starters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
44 lines (39 loc) · 1.28 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
#!groovy
node {
stage('Checkout') {
echo 'Checkout'
sh "rm -rf *"
sh "rh -rf .git"
checkout scm
}
stage('Build') {
echo 'Build Neo-Starters'
mvn 'clean package -DskipTests -B -e -V'
}
stage('Test') {
mvn 'test -B -e -V'
}
stage('Sonar') {
if ('development'.equalsIgnoreCase(env.BRANCH_NAME)) {
echo 'Development branch - running regular Sonar'
mvn 'sonar:sonar -B -e -V'
} else if (env.CHANGE_ID != null) {
echo 'Pull request - running Sonar preview'
mvn "sonar:sonar -Dsonar.github.pullRequest=${env.CHANGE_ID} -Dsonar.github.repository=neoteric-eu/neo-starters -Dsonar.github.oauth=${env.SONAR_OAUTH} -Dsonar.analysis.mode=issues -B -e -V"
} else {
echo 'Should not be here'
}
}
if ('development'.equalsIgnoreCase(env.BRANCH_NAME)) {
stage('Deploy SNAPSHOT') {
echo 'Deploy SNAPSHOT'
configFileProvider(
[configFile(fileId: '1d4fc1ee-2ac5-4b80-aec2-e1591a34bb9b', variable: 'MAVEN_SETTINGS')]) {
mvn 'deploy -s $MAVEN_SETTINGS -B -e -V -DskipTests -PreleaseStarters'
}
}
}
}
def mvn(args) {
sh "${tool 'M3'}/bin/mvn ${args}"
}