From 986b4550ba498dd40c638a6d00934fb3e16b19fd Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Sat, 21 Jun 2025 12:34:56 +0200 Subject: [PATCH] [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. --- .../Releng/prepareNextDevCycle.jenkinsfile | 44 +++++++++++++++++-- RELEASE.md | 1 - scripts/updateProductVersion.sh | 21 --------- 3 files changed, 40 insertions(+), 26 deletions(-) delete mode 100755 scripts/updateProductVersion.sh diff --git a/JenkinsJobs/Releng/prepareNextDevCycle.jenkinsfile b/JenkinsJobs/Releng/prepareNextDevCycle.jenkinsfile index c51a55d36fd..ac5bae8b0d8 100644 --- a/JenkinsJobs/Releng/prepareNextDevCycle.jenkinsfile +++ b/JenkinsJobs/Releng/prepareNextDevCycle.jenkinsfile @@ -110,9 +110,6 @@ pipeline { replaceInFile('production/testScripts/configuration/streamSpecific.properties', [ "for ${PREVIOUS_RELEASE_VERSION}.0 builds" : "for ${NEXT_RELEASE_VERSION}.0 builds", ]) - replaceAllInFile('scripts/updateProductVersion.sh', [ - 's/\\d+.\\d+.0/\\d+.\\d+.0/g' : "g|s/${PREVIOUS_RELEASE_VERSION}.0/${NEXT_RELEASE_VERSION}.0/g", - ]) commitAllChangesExcludingSubmodules("Update versions to ${NEXT_RELEASE_VERSION} in build scripts") } @@ -145,6 +142,41 @@ pipeline { commitAllChangesExcludingSubmodules("Move previous version to ${PREVIOUS_RELEASE_CANDIDATE_TAG} in build scripts") } } + stage('Validate and list changes') { + steps { + sh ''' + function printLatestGitHistory() { + git log origin/master..HEAD --patch-with-stat --summary + } + printLatestGitHistory + export -f printLatestGitHistory + git submodule foreach 'printLatestGitHistory' + ''' + // Run simple clean build to verify that at least all parent versions are updated correctly + sh 'mvn clean' + // search for leftover occurrences of the previous release version + sh '''#!/bin/bash -e + matchingFiles=$(grep --recursive --files-with-matches \ + --include pom.xml \ + --include MANIFEST.MF \ + --include feature.xml \ + --include \\*.product \ + --fixed-strings "${PREVIOUS_RELEASE_VERSION}") + # The eclipse-platform-parent/pom.xml contains the previous version in the baseline repository variable + if [[ -z "${matchingFiles}" ]] || [[ "${matchingFiles}" == 'eclipse-platform-parent/pom.xml' ]]; then + echo "No unexpected references to previous version ${PREVIOUS_RELEASE_VERSION} found:" + exit 0 + else + echo "References to previous version ${PREVIOUS_RELEASE_VERSION} found:" + for f in ${matchingFiles}; do + echo "In file ${f}" + grep "${PREVIOUS_RELEASE_VERSION}" "${f}" + done + exit 1 + fi + ''' + } + } stage ('Create and update Stream Repos') { when { not { expression { params.DRY_RUN } } @@ -318,7 +350,11 @@ def replaceInFile(String filePath, Map replacements) { def replaceAllInFile(String filePath, Map replacements) { def content = readFile(filePath) for (entry in replacements) { - content = content.replaceAll(entry.key, entry.value) + def newContent = content.replaceAll(entry.key, entry.value) + if (newContent == content && !(content =~ entry.key)) { // pattern matches, but the replacement is equal to the current content + error("Pattern not found in file '${filePath}': ${entry.key}") + } + content = newContent } writeFile(file:filePath, text: content) } diff --git a/RELEASE.md b/RELEASE.md index 78cd0425358..7b3605ee457 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -183,7 +183,6 @@ Previously they were created in ther own job: #### **Version Updates:** - 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. 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: - 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. 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. - **Update version number in mac's Eclipse.app** - 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` diff --git a/scripts/updateProductVersion.sh b/scripts/updateProductVersion.sh deleted file mode 100755 index ac2c92c38c8..00000000000 --- a/scripts/updateProductVersion.sh +++ /dev/null @@ -1,21 +0,0 @@ -#############################README################################################################################## -#Before running this script configure the source and target POM versions correctly, follow detailed steps below: -# 1. Update "updateProductVersion.sh" script with proper source and target version properly for all 4 mentioned files. -# 2. From Shell command prompt go to "eclipse.platform.releng.aggregator" directory -# 3. Then we should run the script using command: ./scripts/updateProductVersion.sh -# 4. Above script will take around less than a minute max to update the complete Eclipse sources. -# 5. Make sure to create the gerrit for for "eclipse.platform.releng.aggregator" in first place: -# 6. gerrit build will fail for this change, you can commit without gerrit validation -# 7. After committing above change, you need to deploy the POM for the new Eclipse version 4.16 -# 8. e.g. For new Eclipse release 4.16 [Note: version value will change depending on the release] run below jobs: -# https://ci.eclipse.org/releng/job/deploy-eclipse-platform-parent-pom/ -# https://ci.eclipse.org/releng/job/deploy-eclipse-sdk-target-pom/ -# 9. Now create the gerrit patches for all sub-modules which should pass. -#10. Finally commit all the modified files in each of the individual submodules of Releng. - -script_location=$( (cd $(dirname $0) && pwd) ) - -find $script_location/.. -name pom.xml -exec sed -i 'g|s/4.36.0/4.37.0/g' {} \; -find $script_location/.. -name MANIFEST.MF -exec sed -i 'g|s/4.36.0/4.37.0/g' {} \; -find $script_location/.. -type f -name *.product -exec sed -i 'g|s/4.36.0/4.37.0/g' {} \; -find $script_location/.. -name feature.xml -exec sed -i 'g|s/4.36.0/4.37.0/g' {} \; \ No newline at end of file