-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
64 lines (62 loc) · 1.73 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
properties([
parameters([
choice(name: 'CLEAN', choices: ['false', 'true'], description: 'Clean workspace before build'),
string(name: 'BRANCH', defaultValue: 'develop', description: 'Default branch'),
string(name: 'RELEASE_VERSION', defaultValue: '', description: 'Release version')
])
])
pipeline {
agent {
docker {
image 'maven:3.6.3-openjdk-8'
args env.DOCKER_ARGS
}
}
stages {
stage('Clean') {
when{
expression{
return params.CLEAN == 'true';
}
}
steps {
// Cleaning with cleanWS() has known issues use 'rm' instead
sh 'rm -rf *'
}
}
stage('Clone') {
steps {
git branch: params.BRANCH, url: 'https://github.com/takipi/overops-gitlab-plugin.git'
}
}
stage('Build') {
steps {
sh 'mvn clean install'
archive (includes: 'target/*.jar')
sh 'mvn dockerfile:build'
}
}
stage('Report'){
steps{
jacoco(
execPattern: 'target/*.exec',
classPattern: 'target/classes',
sourcePattern: 'src/main/java',
exclusionPattern: 'src/test*'
)
}
}
stage('Deploy') {
when{
expression{
return params.RELEASE_VERSION != '';
}
}
steps {
echo 'TBD'
// TODO Figure out how to inject RELEASE_VERSION / TAG / PUSH
// sh 'mvn dockerfile:push'
}
}
}
}