-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathJenkinsfile
executable file
·111 lines (103 loc) · 3.16 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
@Library('gbif-common-jenkins-pipelines') _
pipeline {
agent any
tools {
maven 'Maven 3.8.5'
jdk 'OpenJDK11'
}
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
skipStagesAfterUnstable()
timestamps()
}
parameters {
separator(name: "release_separator", sectionHeader: "Release Parameters")
booleanParam(name: 'RELEASE', defaultValue: false, description: 'Do a Maven release')
string(name: 'RELEASE_VERSION', defaultValue: '', description: 'Release version (optional)')
string(name: 'DEVELOPMENT_VERSION', defaultValue: '', description: 'Development version (optional)')
booleanParam(name: 'DRY_RUN_RELEASE', defaultValue: false, description: 'Dry Run Maven release')
}
environment {
JETTY_PORT = utils.getPort()
POM_VERSION = readMavenPom().getVersion()
}
stages {
stage('Maven build: Main project') {
when {
allOf {
not { expression { params.RELEASE } };
}
}
steps {
configFileProvider([
configFile(fileId: 'org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig1387378707709', variable: 'MAVEN_SETTINGS')
]) {
sh 'mvn -s ${MAVEN_SETTINGS} -Djetty.port=${JETTY_PORT} clean test verify deploy dependency:analyze -Pclb-build -U'
}
}
}
stage('Trigger WS deploy dev2') {
when {
allOf {
not { expression { params.RELEASE } };
branch 'dev';
}
}
steps {
build job: "checklistbank-ws-dev-deploy", wait: false, propagate: false
}
}
stage('Build and push Docker images: Checklistbank workflow') {
when {
allOf {
not { expression { params.RELEASE } };
}
}
steps {
sh 'build/checklistbank-workflow-docker-build.sh $POM_VERSION'
}
}
stage('Maven release: Main project') {
when {
allOf {
expression { params.RELEASE };
branch 'master';
}
}
environment {
RELEASE_ARGS = utils.createReleaseArgs(params.RELEASE_VERSION, params.DEVELOPMENT_VERSION, params.DRY_RUN_RELEASE)
}
steps {
configFileProvider(
[configFile(fileId: 'org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig1387378707709',
variable: 'MAVEN_SETTINGS_XML')]) {
git 'https://github.com/gbif/checklistbank.git'
sh 'mvn -s $MAVEN_SETTINGS_XML -B -Denforcer.skip=true release:prepare release:perform $RELEASE_ARGS'
}
}
}
stage('Docker Release: Checklistbank workflow') {
when {
allOf {
expression { params.RELEASE };
not { expression { params.DRY_RUN_RELEASE } }
branch 'master';
}
}
environment {
VERSION = utils.getReleaseVersion(params.RELEASE_VERSION, POM_VERSION)
}
steps {
sh 'build/checklistbank-workflow-docker-build.sh ${VERSION}'
}
}
}
post {
success {
echo 'Pipeline executed successfully!'
}
failure {
echo 'Pipeline execution failed!'
}
}
}