-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkinsfile.release
More file actions
76 lines (67 loc) · 2.81 KB
/
Jenkinsfile.release
File metadata and controls
76 lines (67 loc) · 2.81 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
pipeline {
agent {
label 'DS agent'
}
options {
disableConcurrentBuilds()
timeout(time: 40, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '5'))
}
environment {
PROJECT = 'ds-storage'
BUILD_TO_TRIGGER = 'ds-license'
}
parameters {
string(name: 'VERSION', defaultValue: "X.X.X", description: 'Version to release')
}
stages {
stage('Echo Environment Variables') {
steps {
echo "Version: ${params.VERSION}"
}
}
stage('Check Version') {
steps {
script {
if ( !params.VERSION || params.VERSION == 'X.X.X' ) {
currentBuild.description = "No valid version"
currentBuild.result = 'ABORTED'
error("Stopping pipeline: No valid version is set.")
}
}
}
}
stage('Change version') {
steps {
withMaven(options: [artifactsPublisher(fingerprintFilesDisabled: true, archiveFilesDisabled: true)], traceability: true, mavenLocalRepo: "${WORKSPACE}/repository") {
sh "mvn versions:set -DnewVersion=${params.VERSION} -DgenerateBackupPoms=false"
echo "Changing MVN version to: ${params.VERSION}"
}
}
}
stage('Update parent') {
steps {
withMaven(options: [artifactsPublisher(fingerprintFilesDisabled: true, archiveFilesDisabled: true)], traceability: true, mavenLocalRepo: "${WORKSPACE}/repository") {
sh """sed -i "/<parent>/,/<version>/ s/<version>.*<\\/version>/<version>${params.VERSION}<\\/version>/" pom.xml"""
echo "Changing parent to: ${params.VERSION}"
}
}
}
stage('Change dependencies') {
steps {
withMaven(options: [artifactsPublisher(fingerprintFilesDisabled: true, archiveFilesDisabled: true)], traceability: true, mavenLocalRepo: "${WORKSPACE}/repository") {
sh "mvn versions:use-dep-version -Dincludes=dk.kb.dsshared:*,dk.kb.storage:*,dk.kb.license:*,dk.kb.present:*,dk.kb.kaltura:* -DdepVersion=${params.VERSION} -DforceVersion=true -DgenerateBackupPoms=false"
echo "Changing MVN dependencies to: ${params.VERSION}"
}
}
}
stage('Release to Nexus') {
steps {
withMaven(options: [artifactsPublisher(fingerprintFilesDisabled: true, archiveFilesDisabled: true)], traceability: true, mavenLocalRepo: "${WORKSPACE}/repository") {
// Execute Maven Release
sh "mvn clean deploy"
}
}
}
}
}