@@ -12,8 +12,6 @@ pipeline {
12
12
HIDE_SITE = 'true'
13
13
// Download Server locations (would very seldom change)
14
14
EP_ROOT = '/home/data/httpd/download.eclipse.org'
15
- EP_ECLIPSE_ROOT = "${EP_ROOT}/eclipse"
16
- EP_EQUINOX_ROOT = "${EP_ROOT}/equinox"
17
15
}
18
16
tools {
19
17
jdk 'temurin-jdk21-latest'
@@ -30,29 +28,25 @@ pipeline {
30
28
env.CHECKPOINT = readParameter('CHECKPOINT')
31
29
env.SIGNOFF_BUG = readParameter('SIGNOFF_BUG')
32
30
env.TRAIN_NAME = readParameter('TRAIN_NAME')
31
+ //TODO: record the train in buildproperties.shsource and read it here
33
32
if (!"${TRAIN_NAME}") {
34
33
error("Parameter 'TRAIN_NAME' is not specified")
35
34
}
36
35
def idMatcher = null
37
- if ((idMatcher = env.DROP_ID =~ /(?<type>I) (?<date>\d{8})-(?<time>\d{4})/).matches()) {
36
+ if ((idMatcher = env.DROP_ID =~ /I (?<date>\d{8})-(?<time>\d{4})/).matches()) {
38
37
assignEnvVariable('BUILD_LABEL', "${DROP_ID}")
39
- } else if ((idMatcher = env.DROP_ID =~ /(?<type>S) -(?<major >\d+)\.(?<minor> \d+)(?<service> \.\d+)?(( M|RC)\d+[a-z]?)? -(?<date>\d{8})(?<time>\d{4})/).matches()) {
40
- assignEnvVariable('BUILD_LABEL', idMatcher.group('major') + '.' + idMatcher.group('minor') + (idMatcher.group('service') ?: ' '))
38
+ } else if ((idMatcher = env.DROP_ID =~ /S -(?<label >\d+\. \d+( \.\d+)?(M|RC)\d+[a-z]?)-(?<date>\d{8})(?<time>\d{4})/).matches()) {
39
+ assignEnvVariable('BUILD_LABEL', idMatcher.group('label '))
41
40
if ("${CHECKPOINT}") {
42
41
error "Stable build DROP_ID=${DROP_ID} may only be promoted to release CHECKPOINT, which therefore must be empty: ${CHECKPOINT}"
43
42
}
44
43
} else {
45
44
error "DROP_ID, ${DROP_ID}, did not match any expected pattern."
46
45
}
47
- assignEnvVariable('BUILD_TYPE', idMatcher.group('type'))
48
- assignEnvVariable('REPO_BUILD_TYPE', 'I')
49
- assignEnvVariable('BUILD_TIMESTAMP', idMatcher.group('date') + idMatcher.group('time'))
46
+ def buildTimestamp = idMatcher.group('date') + idMatcher.group('time')
50
47
assignEnvVariable('REPO_ID', "I${idMatcher.group('date')}-${idMatcher.group('time')}")
51
48
idMatcher = null // release matcher as it's not serializable
52
49
53
- assignEnvVariable('BUILD_LABEL_EQ', "${BUILD_LABEL}")
54
- assignEnvVariable('DROP_ID_EQ', "${DROP_ID}")
55
-
56
50
sh 'curl -o buildproperties.shsource --fail https://download.eclipse.org/eclipse/downloads/drops4/${DROP_ID}/buildproperties.shsource'
57
51
def STREAM = sh(returnStdout: true, script: 'source ./buildproperties.shsource && echo ${STREAM}').trim()
58
52
def versionMatcher = STREAM =~ /(?<major>\d+)\.(?<minor>\d+).(?<service>\d+)/
@@ -64,81 +58,89 @@ pipeline {
64
58
assignEnvVariable('BUILD_SERVICE', versionMatcher.group('service'))
65
59
versionMatcher = null // release matcher as it's not serializable
66
60
67
- assignEnvVariable('BUILD_REPO_ORIGINAL', "${BUILD_MAJOR}.${BUILD_MINOR}-${REPO_BUILD_TYPE} -builds")
61
+ assignEnvVariable('BUILD_REPO_ORIGINAL', "${BUILD_MAJOR}.${BUILD_MINOR}-I -builds")
68
62
69
63
if ("${CHECKPOINT}" ==~ /M\d+([a-z])?/ || "${CHECKPOINT}" ==~ /RC\d+([a-z])?/) { // milestone or RC promotion
70
64
assignEnvVariable('DL_TYPE', 'S')
71
65
// REPO_SITE_SEGMENT variale not used in this case
72
- } else if(!"${CHECKPOINT}") { // release promotion
66
+ } else if (!"${CHECKPOINT}") { // release promotion
73
67
assignEnvVariable('DL_TYPE', 'R')
74
68
assignEnvVariable('REPO_SITE_SEGMENT', "${BUILD_MAJOR}.${BUILD_MINOR}")
75
69
} else {
76
70
error "CHECKPOINT, ${CHECKPOINT}, did not match any expected pattern."
77
71
}
78
- assignEnvVariable('NEWS_ID', "${BUILD_MAJOR}.${BUILD_MINOR}")
79
72
80
73
assignEnvVariable('DL_LABEL', "${BUILD_SERVICE}" == '0' // For initial releases, do not include service in label
81
74
? "${BUILD_MAJOR}.${BUILD_MINOR}${CHECKPOINT}"
82
75
: "${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_SERVICE}${CHECKPOINT}"
83
76
)
84
- assignEnvVariable('DL_LABEL_EQ', "${DL_LABEL}")
85
-
86
- // This is DL_DROP_ID for Eclipse. The one for equinox has DL_LABEL_EQ in middle.
87
- assignEnvVariable('DL_DROP_ID', "${DL_TYPE}-${DL_LABEL}-${BUILD_TIMESTAMP}")
88
- assignEnvVariable('DL_DROP_ID_EQ', "${DL_TYPE}-${DL_LABEL_EQ}-${BUILD_TIMESTAMP}")
77
+ // This is DL_DROP_ID for Eclipse and Equinox
78
+ assignEnvVariable('DL_DROP_ID', "${DL_TYPE}-${DL_LABEL}-${buildTimestamp}")
89
79
90
80
if (!env.SIGNOFF_BUG) {
91
81
echo '''\
92
82
[WARNING] SIGNOFF_BUG was not defined. That is valid if no Unit Tests failures but otherwise should be defined.
93
83
Can be added by hand to buildproperties.php in drop site, if in fact there were errors, and simply forgot to specify.
94
84
'''.stripIndent()
85
+ } else if (env.SIGNOFF_BUG ==~ '\\d+') {
86
+ assignEnvVariable('SIGNOFF_BUG', "https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/${SIGNOFF_BUG}")
95
87
}
88
+ assignEnvVariable('SIGNOFF_BUG_LABEL', env.SIGNOFF_BUG.replace('https://github.com/','').replace('/issues/','#'))
96
89
97
90
def serviceVersionSegment = (env.CHECKPOINT || env.BUILD_SERVICE != '0') ? ('_' + env.BUILD_SERVICE) : ''
98
91
assignEnvVariable('TAG', "${DL_TYPE}${BUILD_MAJOR}_${BUILD_MINOR}${serviceVersionSegment}${env.CHECKPOINT ? ('_' + env.CHECKPOINT) : ''}")
99
92
}
100
93
}
101
94
}
102
- stage('Rename and Promote') {
103
- environment {
104
- BUILDMACHINE_BASE_DL = "${EP_ECLIPSE_ROOT}/downloads/drops4"
105
- BUILDMACHINE_BASE_EQ = "${EP_EQUINOX_ROOT}/drops"
106
- // Eclipse and Equinox drop Site (final segment)
107
- ECLIPSE_DL_DROP_DIR_SEGMENT = "${DL_TYPE}-${DL_LABEL}-${BUILD_TIMESTAMP}"
108
- EQUINOX_DL_DROP_DIR_SEGMENT = "${DL_TYPE}-${DL_LABEL_EQ}-${BUILD_TIMESTAMP}"
109
- }
95
+ stage('Move and rename Pages') {
110
96
steps {
111
97
writeFile(file: "${WORKSPACE}/stage2output${TRAIN_NAME}${CHECKPOINT}/mailtemplate.txt", text: """\
112
98
We are pleased to announce that ${TRAIN_NAME} ${CHECKPOINT} is available for download and updates.
113
99
114
100
Eclipse downloads:
115
- https://download.eclipse.org/eclipse/downloads/drops4/${ECLIPSE_DL_DROP_DIR_SEGMENT }/
101
+ https://download.eclipse.org/eclipse/downloads/drops4/${DL_DROP_ID }/
116
102
117
103
New and Noteworthy:
118
- https://www.eclipse.org/eclipse/news/${NEWS_ID }/
104
+ https://www.eclipse.org/eclipse/news/${BUILD_MAJOR}.${BUILD_MINOR }/
119
105
120
106
Update existing (non-production) installs:
121
107
https://download.eclipse.org/eclipse/updates/${DL_TYPE == 'R' ? REPO_SITE_SEGMENT : BUILD_REPO_ORIGINAL}/
122
108
123
109
Specific repository good for building against:
124
- https://download.eclipse.org/eclipse/updates/${DL_TYPE == 'R' ? (REPO_SITE_SEGMENT + '/' + ECLIPSE_DL_DROP_DIR_SEGMENT ) : (BUILD_REPO_ORIGINAL + '/' + DROP_ID)}/
110
+ https://download.eclipse.org/eclipse/updates/${DL_TYPE == 'R' ? (REPO_SITE_SEGMENT + '/' + DL_DROP_ID ) : (BUILD_REPO_ORIGINAL + '/' + DROP_ID)}/
125
111
126
112
Equinox specific downloads:
127
- https://download.eclipse.org/equinox/drops/${EQUINOX_DL_DROP_DIR_SEGMENT }/
113
+ https://download.eclipse.org/equinox/drops/${DL_DROP_ID }/
128
114
129
115
Thank you to everyone who made this checkpoint possible.
130
116
""".stripIndent())
131
117
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
132
- sh '''#!/bin/bash -x
133
- curl -o promoteSites.sh https://download.eclipse.org/eclipse/relengScripts/cje-production/promotion/promoteSites.sh
134
- chmod +x promoteSites.sh
135
- ./promoteSites.sh
136
- '''
118
+
119
+ echo 'Promote Equinox'
120
+ dir("${WORKSPACE}/equinox") {
121
+ renameBuildDrop('equinox/drops', "${DROP_ID}", "${BUILD_LABEL}", "${DL_DROP_ID}", "${DL_LABEL}")
122
+ }
123
+
124
+ echo 'Promote Eclipse'
125
+ dir("${WORKSPACE}/eclipse") {
126
+ renameBuildDrop('eclipse/downloads/drops4', "${DROP_ID}", "${BUILD_LABEL}", "${DL_DROP_ID}", "${DL_LABEL}") {
127
+ sh '''
128
+ echo "\\$NEWS_ID = \\"${BUILD_MAJOR}.${BUILD_MINOR}\\";" >> 'buildproperties.php'
129
+ echo "\\$ACK_ID = \\"${BUILD_MAJOR}.${BUILD_MINOR}\\";" >> 'buildproperties.php'
130
+ echo "\\$README_ID = \\"${BUILD_MAJOR}.${BUILD_MINOR}\\";" >> 'buildproperties.php'
131
+
132
+ # SIGNOFF_BUG should not be defined if there are no JUnit failures to investigate and explain
133
+ if [[ -n "${SIGNOFF_BUG}" ]]; then
134
+ echo -e "<p>Any unit test failures below have been investigated and found to be test-related and do not affect the quality of the build.\\nSee the sign-off page <a href=\\"${SIGNOFF_BUG}\\">${SIGNOFF_BUG_LABEL}</a> for details.</p>" > 'testNotes.html'
135
+ fi
136
+ '''
137
+ }
138
+ }
137
139
}
138
140
build job: 'Releng/tagEclipseRelease', wait: true, propagate: true, parameters: [
139
141
string(name: 'tag', value: "${TAG}"),
140
142
string(name: 'buildID', value: "${DROP_ID}"),
141
- string(name: 'annotation', value: "${ params. SIGNOFF_BUG ? 'https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/' + params.SIGNOFF_BUG : '' }")
143
+ string(name: 'annotation', value: "${SIGNOFF_BUG}")
142
144
]
143
145
}
144
146
}
@@ -177,7 +179,7 @@ pipeline {
177
179
}
178
180
post {
179
181
always {
180
- archiveArtifacts '**/stage2output*/* *'
182
+ archiveArtifacts '**/*'
181
183
}
182
184
}
183
185
}
@@ -197,3 +199,78 @@ def readParameter(String name) {
197
199
}
198
200
return value
199
201
}
202
+
203
+ def renameBuildDrop(String baseDropPath, String oldDropID, String oldBuildLabel, String newDropID, String newBuildLabel, Closure extraTasks=null) {
204
+ def sourcePath="${EP_ROOT}/${baseDropPath}/${oldDropID}"
205
+ def targetPath="${EP_ROOT}/${baseDropPath}/${newDropID}"
206
+
207
+ sh """#!/bin/bash -xe
208
+
209
+ # Copy drop-directory to new location
210
+ ssh
[email protected] mkdir -p '${targetPath}'
211
+ if [[ "${HIDE_SITE}" == "true" ]]; then
212
+ # Create this marker first to ensure the page is never without
213
+ ssh
[email protected] touch '${targetPath}/buildHidden'
214
+ fi
215
+ ssh
[email protected] cp -r '${sourcePath}/.' '${targetPath}'
216
+
217
+ # Rename files
218
+ echo 'Rename files at new location from *${oldBuildLabel}* to *${newBuildLabel}*.'
219
+ # References to locally defined variables required double escaping
220
+ # because they are escaped for groovy and the bash HERE document.
221
+ # In general this section is very fragile! Only change with great caution and extensive testing!
222
+
223
+ set -xe
224
+ cd "${targetPath}"
225
+ files=\\\$(find . -mindepth 1 -maxdepth 2 -name "*${oldBuildLabel}*" -print)
226
+ echo " \\\$(echo "\\\$files" | wc -l) files found to rename."
227
+
228
+ for file in \\\${files}; do
229
+ if [[ \\\$file =~ (.*)(${oldBuildLabel})(.*) ]]; then
230
+ mv "\\\$file" "\\\${BASH_REMATCH[1]}${newBuildLabel}\\\${BASH_REMATCH[3]}"
231
+ fi
232
+ done
233
+ #DO NOT INDENT EOF!
234
+ EOF
235
+
236
+ #Update checksums to new filenames
237
+ ssh
[email protected] sed --in-place --expression 's/${oldBuildLabel}/${newBuildLabel}/g' ${targetPath}/checksum/*
238
+ """
239
+
240
+ // Update buildproperties.php to new names
241
+ def newTypeName = null
242
+ if ("${DL_TYPE}" == 'R') {
243
+ newTypeName = 'Release'
244
+ } else if (newBuildLabel.contains('RC')) {
245
+ newTypeName = 'Release Candidate'
246
+ } else if ("${DL_TYPE}" == 'S') {
247
+ newTypeName = 'Stable'
248
+ } else {
249
+ error "Unexpected DL_TYPE value, ${DL_TYPE}"
250
+ }
251
+ def newProperties = [
252
+ BUILD_ID: "${newBuildLabel}",
253
+ BUILD_TYPE: "${DL_TYPE}",
254
+ BUILD_TYPE_NAME: "${newTypeName}",
255
+ BUILD_DIR_SEG: "${newDropID}",
256
+ EQ_BUILD_DIR_SEG: "${newDropID}",
257
+ ]
258
+ def buildPropertiesPHP = sh(returnStdout: true, script: "ssh
[email protected] cat ${sourcePath}/buildproperties.php")
259
+ for (entry in newProperties) {
260
+ buildPropertiesPHP = buildPropertiesPHP.replaceFirst('\\$' + entry.key + ' = "[^"]+"', '\\$' + entry.key + ' = "' + entry.value + '"')
261
+ }
262
+ writeFile(file: 'buildproperties.php', text: buildPropertiesPHP)
263
+
264
+ if (extraTasks) {
265
+ extraTasks()
266
+ }
267
+ sh """#!/bin/bash -xe
268
+ # Copy locally modified files to the download server
269
+ scp -r .
[email protected] :${targetPath}/
270
+
271
+ if [[ '${DL_TYPE}' == 'R' ]]; then
272
+ echo 'Creating archive'
273
+ ssh
[email protected] cp -r '${targetPath}' /home/data/httpd/archive.eclipse.org/${baseDropPath}/
274
+ fi
275
+ """
276
+ }
0 commit comments