-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
207 lines (189 loc) · 6.02 KB
/
Jenkinsfile
File metadata and controls
207 lines (189 loc) · 6.02 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
pipeline {
agent none
tools {
maven 'Maven 3.9.0'
jdk 'JDK 25'
}
environment {
/* Constants / Configuration */
BUILD_PROPERTIES_ID = "b60f3998-d8fd-434b-b3c8-ed52aa52bc2e"
BUILD_PROPERTIES_NAME = "jadaptive.build.properties"
MAVEN_CONFIG_ID = "14324b85-c597-44e8-a575-61f925dba528"
}
stages {
stage ('Pretty Installers') {
parallel {
/*
* Linux Installers and Packages
*/
stage ('Linux Pretty Installers') {
agent {
label 'install4j && linux && x86_64'
}
steps {
configFileProvider([
configFile(
fileId: "${env.BUILD_PROPERTIES_ID}",
replaceTokens: true,
targetLocation: "${env.BUILD_PROPERTIES_NAME}",
variable: 'BUILD_PROPERTIES'
)
]) {
withMaven(
globalMavenSettingsConfig: "${env.MAVEN_CONFIG_ID}"
) {
sh 'mvn -U -Dbuild.mediaTypes=unixInstaller,unixArchive,linuxRPM,linuxDeb ' +
'-Dbuild.projectProperties=$BUILD_PROPERTIES ' +
'-DbuildInstaller=true -P translate clean package'
/* Stash installers */
stash includes: 'target/media/*', name: 'linux-pretty'
/* Stash updates.xml */
dir('target/media') {
stash includes: 'updates.xml', name: 'linux-pretty-updates-xml'
}
}
}
}
}
/*
* Windows installers
*/
stage ('Windows Pretty Installers') {
agent {
label 'install4j && windows'
}
steps {
configFileProvider([
configFile(
fileId: "${env.BUILD_PROPERTIES_ID}",
replaceTokens: true,
targetLocation: "${env.BUILD_PROPERTIES_NAME}",
variable: 'BUILD_PROPERTIES'
)
]) {
withMaven(
globalMavenSettingsConfig: "${env.MAVEN_CONFIG_ID}"
) {
bat 'mvn -U -Dinstall4j.verbose=true -Dbuild.mediaTypes=windows,windowsArchive ' +
'"-Dbuild.projectProperties=%BUILD_PROPERTIES%" ' +
'-DbuildInstaller=true -P translate clean package'
/* Stash installers */
stash includes: 'target/media/*', name: 'windows-pretty'
/* Stash updates.xml */
dir('target/media') {
stash includes: 'updates.xml', name: 'windows-pretty-updates-xml'
}
}
}
}
}
/*
* MacOS installers
*/
stage ('MacOS Pretty Installers') {
agent {
label 'install4j && macos'
}
steps {
configFileProvider([
configFile(
fileId: "${env.BUILD_PROPERTIES_ID}",
replaceTokens: true,
targetLocation: "${env.BUILD_PROPERTIES_NAME}",
variable: 'BUILD_PROPERTIES'
)
]) {
withMaven(
globalMavenSettingsConfig: "${env.MAVEN_CONFIG_ID}"
) {
// -Dinstall4j.disableNotarization=true
sh 'mvn -U -Dbuild.mediaTypes=macosFolder,macosFolderArchive ' +
'-Dbuild.projectProperties=$BUILD_PROPERTIES ' +
'-DbuildInstaller=true -P translate clean package'
/* Stash installers */
stash includes: 'target/media/*', name: 'macos-pretty'
/* Stash updates.xml */
dir('target/media') {
stash includes: 'updates.xml', name: 'macos-pretty-updates-xml'
}
}
}
}
}
}
}
stage ('Deploy') {
agent {
label 'linux && !remote'
}
steps {
script {
/* Create full version number from Maven POM version and the
build number */
def pom = readMavenPom file: 'pom.xml'
pom_version_array = pom.version.split('\\.')
suffix_array = pom_version_array[2].split('-')
env.FULL_VERSION = pom_version_array[0] + '.' + pom_version_array[1] + "." + suffix_array[0] + "-${BUILD_NUMBER}"
echo 'Full Maven Version ' + env.FULL_VERSION
}
/* Merge all updates.xml into one */
withMaven(globalMavenSettingsConfig: "${env.MAVEN_CONFIG_ID}"
) {
sh 'mvn clean'
}
/* Unstash installers */
unstash 'linux-pretty'
unstash 'windows-pretty'
unstash 'macos-pretty'
/* Unstash updates.xml */
dir('target/media-linux') {
unstash 'linux-pretty-updates-xml'
}
dir('target/media-windows') {
unstash 'windows-pretty-updates-xml'
}
dir('target/media-macos') {
unstash 'macos-pretty-updates-xml'
}
/* Merge all updates.xml into one */
withMaven(globalMavenSettingsConfig: "${env.MAVEN_CONFIG_ID}"
) {
sh 'mvn -P merge-installers com.sshtools:updatesxmlmerger-maven-plugin:merge'
}
/* Upload all CLI and GUI installers */
s3Upload(
consoleLogLevel: 'INFO',
dontSetBuildResultOnFailure: false,
dontWaitForConcurrentBuildCompletion: false,
entries: [[
bucket: 'sshtools-public/pretty/' + env.FULL_VERSION,
noUploadOnFailure: true,
selectedRegion: 'eu-west-1',
sourceFile: 'target/media/*',
storageClass: 'STANDARD',
useServerSideEncryption: false]],
pluginFailureResultConstraint: 'FAILURE',
profileName: 'JADAPTIVE Buckets',
userMetadata: []
)
/* Copy the merged updates.xml (for FileDrop) to the nightly directory so updates can be seen
by anyone on this channel */
s3Upload(
consoleLogLevel: 'INFO',
dontSetBuildResultOnFailure: false,
dontWaitForConcurrentBuildCompletion: false,
entries: [[
bucket: 'sshtools-public/pretty/continuous',
noUploadOnFailure: true,
selectedRegion: 'eu-west-1',
sourceFile: 'target/media/updates.xml',
storageClass: 'STANDARD',
useServerSideEncryption: false]],
pluginFailureResultConstraint: 'FAILURE',
profileName: 'JADAPTIVE Buckets',
userMetadata: []
)
}
}
}
}