-
Notifications
You must be signed in to change notification settings - Fork 7
/
Jenkinsfile
53 lines (53 loc) · 1.45 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
pipeline {
agent any
tools {
jdk "jdk-21"
maven "maven-3.9"
}
triggers {
pollSCM "H H * * *"
}
parameters {
booleanParam(name: "CLEAN", description: "Clean workspace.", defaultValue: false)
booleanParam(name: "RELEASE", description: "Release that thang.", defaultValue: false)
}
options {
skipDefaultCheckout(true) // This is required if you want to clean before build
}
stages {
stage('Info') {
steps {
echo '=== Stage: Info ==='
sh 'java -version'
sh 'mvn -version'
}
}
stage('Clean') {
when {expression { params.RELEASE || params.CLEAN }}
steps {
echo "=== Stage: Clean ==="
cleanWs()
}
}
stage("Checkout") {
steps {
echo "=== Stage: Checkout ==="
checkout scm
}
}
stage('Snapshot') {
when {expression { !params.RELEASE }}
steps {
echo "=== Stage: Snapshot (Build & Deploy) ==="
sh 'mvn clean deploy docker:build docker:push -Ddkr.tag=snapshot'
}
}
stage('Release') {
when {expression { params.RELEASE }}
steps {
echo "=== Stage: Release (Build & Deploy) ==="
sh 'mvn -B release:prepare release:perform -Darguments=-Ddkr.tag=stable'
}
}
}
}