Repository navigation
Expand file tree
/
Copy pathJenkinsfile
More file actions
97 lines (95 loc) · 3 KB
/
Copy pathJenkinsfile
File metadata and controls
97 lines (95 loc) · 3 KB
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
@Library('gbif-common-jenkins-pipelines') _
pipeline {
agent any
tools {
maven 'Maven 3.9.9'
jdk 'OpenJDK17'
}
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
skipStagesAfterUnstable()
timestamps()
disableConcurrentBuilds()
}
triggers {
snapshotDependencies()
}
parameters {
separator(name: "release_separator", sectionHeader: "Release Main Project 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()
}
stages {
stage('Maven build') {
when {
allOf {
not { expression { params.RELEASE } };
}
}
steps {
withMaven(
globalMavenSettingsConfig: 'org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig1387378707709',
mavenSettingsConfig: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1396361652540',
traceability: true) {
sh '''
mvn -B -U clean package dependency:analyze
'''
}
}
}
stage('Snapshot to nexus') {
when {
allOf {
not { expression { params.RELEASE } };
anyOf {
branch 'dev';
branch 'feature/*';
}
}
}
steps {
withMaven (
globalMavenSettingsConfig: 'org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig1387378707709',
mavenSettingsConfig: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1396361652540',
traceability: true){
sh 'mvn -B -DskipTests deploy'
}
}
}
stage('Maven release') {
when {
allOf {
expression { params.RELEASE };
branch 'master';
}
}
environment {
RELEASE_ARGS = utils.createReleaseArgs(params.RELEASE_VERSION, params.DEVELOPMENT_VERSION, params.DRY_RUN_RELEASE)
}
steps {
withMaven(
globalMavenSettingsConfig: 'org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig1387378707709',
mavenSettingsConfig: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1396361652540',
traceability: true) {
git 'https://github.com/gbif/gbif-api.git'
sh '''
mvn -B -Dresume=false release:prepare release:perform $RELEASE_ARGS
'''
}
}
}
}
post {
success {
echo 'Pipeline executed successfully!'
}
failure {
echo 'Pipeline execution failed!'
}
}
}