Skip to content

Commit 7a79e2d

Browse files
committed
[RelEng] Add basic validation for release preparation pipeline
- Verify that all Maven parent versions are properly updated by running a simple 'mvn clean' build - search for leftover occurrences of old version in relevant files - This allows to remove the 'updateProductVersion.sh' script, which cannot apply a change anymore. - Make replacements more robust by checking if it was really applied.
1 parent f0ce8ec commit 7a79e2d

File tree

3 files changed

+40
-26
lines changed

3 files changed

+40
-26
lines changed

JenkinsJobs/Releng/prepareNextDevCycle.jenkinsfile

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ pipeline {
120120
replaceInFile('production/testScripts/configuration/streamSpecific.properties', [
121121
"for ${PREVIOUS_RELEASE_VERSION}.0 builds" : "for ${NEXT_RELEASE_VERSION}.0 builds",
122122
])
123-
replaceAllInFile('scripts/updateProductVersion.sh', [
124-
's/\\d+.\\d+.0/\\d+.\\d+.0/g' : "g|s/${PREVIOUS_RELEASE_VERSION}.0/${NEXT_RELEASE_VERSION}.0/g",
125-
])
126123

127124
commitAllChangesExcludingSubmodules("Update versions to ${NEXT_RELEASE_VERSION} in build scripts")
128125
}
@@ -155,6 +152,41 @@ pipeline {
155152
commitAllChangesExcludingSubmodules("Move previous version to ${PREVIOUS_RELEASE_CANDIDATE_TAG} in build scripts")
156153
}
157154
}
155+
stage('Validate and list changes') {
156+
steps {
157+
sh '''
158+
function printLatestGitHistory() {
159+
git log origin/master..HEAD --patch-with-stat --summary
160+
}
161+
printLatestGitHistory
162+
export -f printLatestGitHistory
163+
git submodule foreach 'printLatestGitHistory'
164+
'''
165+
// Run simple clean build to verify that at least all parent versions are updated correctly
166+
sh 'mvn clean'
167+
// search for leftover occurrences of the previous release version
168+
sh '''#!/bin/bash -e
169+
matchingFiles=$(grep --recursive --files-with-matches \
170+
--include pom.xml \
171+
--include MANIFEST.MF \
172+
--include feature.xml \
173+
--include \\*.product \
174+
--fixed-strings "${PREVIOUS_RELEASE_VERSION}")
175+
# The eclipse-platform-parent/pom.xml contains the previous version in the baseline repository variable
176+
if [[ -z "${matchingFiles}" ]] || [[ "${matchingFiles}" == 'eclipse-platform-parent/pom.xml' ]]; then
177+
echo "No unexpected references to previous version ${PREVIOUS_RELEASE_VERSION} found:"
178+
exit 0
179+
else
180+
echo "References to previous version ${PREVIOUS_RELEASE_VERSION} found:"
181+
for f in ${matchingFiles}; do
182+
echo "In file ${f}"
183+
grep "${PREVIOUS_RELEASE_VERSION}" "${f}"
184+
done
185+
exit 1
186+
fi
187+
'''
188+
}
189+
}
158190
stage ('Create and update Stream Repos') {
159191
when {
160192
not { expression { params.DRY_RUN } }
@@ -328,7 +360,11 @@ def replaceInFile(String filePath, Map<String,String> replacements) {
328360
def replaceAllInFile(String filePath, Map<String,String> replacements) {
329361
def content = readFile(filePath)
330362
for (entry in replacements) {
331-
content = content.replaceAll(entry.key, entry.value)
363+
def newContent = content.replaceAll(entry.key, entry.value)
364+
if (newContent == content && !(content =~ entry.key)) { // pattern matches, but the replacement is equal to the current content
365+
error("Pattern not found in file '${filePath}': ${entry.key}")
366+
}
367+
content = newContent
332368
}
333369
writeFile(file:filePath, text: content)
334370
}

RELEASE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ Previously they were created in ther own job:
183183
#### **Version Updates:**
184184
- Running the [`Prepare Next Development Cycle`](https://ci.eclipse.org/releng/job/Releng/job/prepareNextDevCycle/) job will update pom and product versions for the Eclipse repositories and submit pull requests for the changes.
185185
This is still a work in progress so if there are any issues or a repo gets missed you can fall back to the old process below:
186-
If you cloned eclipse.platform.releng.aggregator's submodules you can fix the set version and run [updateProductVersion.sh](scripts/updateProductVersion.sh) to update most of the versions.
187186
Once that's done it's easiest to just grep for the previous release version or stream number to find the remaining instances that need to be updated, then commit the changes in a new branch for each repo.
188187
- **Update version number in mac's Eclipse.app**
189188
- In [eclipse-equinox/equinox](https://github.com/eclipse-equinox/equinox) update the versions in the Info.plist for both architectures under `eclipse-equinox/equinox/features/org.eclipse.equinox.executable.feature/bin/cocoa/macosx`

scripts/updateProductVersion.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)