chore(ci): update merge script to match b0 beta suffix coming from main - #11499
Conversation
|
✅ Validation Passed: All report and feature-flag labels are correctly set. |
Fixes: thunderbird#11500 `merge_gradle.py` searched main's `app-thunderbird/build.gradle.kts` for `versionNameSuffix = "b[1-9]"`, but main sends `"b0"`, so the search never matched and the beta path raised `SystemExit`, which causes git to treat it as a conflict. Search for `"b\d+"` so main's value matches, and normalize it to `"b0"`: the "Bump version suffix" step in `shippable_builds.yml` increments the suffix per beta release, so the merge result has to start at "b0".
| @@ -63,16 +63,23 @@ def replace_matching_line(file_path, search_term, new_line): | |||
|
|
|||
| if branch == "beta": | |||
| if is_k9: | |||
There was a problem hiding this comment.
We might actually be able to remove the is_k9 code block since we don't release beta for k9. Or if you want to keep it you can probably re-use more of the code across k9/thunderbird paths below.
There was a problem hiding this comment.
If we remove the is_k9 code block, beta will inherit a1 from main. While that's fine for beta, it will flow into the next beta -> release merge and break the release path in the script.
There was a problem hiding this comment.
I will update the script to re-use more of the code though.
| new_line = "{}{}\n".format(found_line.split("=")[0], '= "b1"') | ||
| # beta always starts at "b0"; the shippable build workflow | ||
| # bumps the suffix per beta release. | ||
| search_term = r"versionNameSuffix = \"b\d+\"" |
There was a problem hiding this comment.
We might be able to get away with b\d since I think we generally don't get past b3 or b4. Or maybe b\d{1,2}(?!\d) if we want to include 2 digits.
There was a problem hiding this comment.
The current regex (with d+) does that:
>>> import re
>>> pat = r'versionNameSuffix = \"b\d+\"'
>>> for line in ['versionNameSuffix = "b1"', 'versionNameSuffix = "b2"', 'versionNameSuffix = "b11"', 'versionNameSuffix = "a1"']:
... print(line, '->', bool(re.search(pat, line)))
...
versionNameSuffix = "b1" -> True
versionNameSuffix = "b2" -> True
versionNameSuffix = "b11" -> True
versionNameSuffix = "a1" -> False
There was a problem hiding this comment.
That's fine. I was just thinking it might be too much because we'll never have a b000009. Should be fine though.
Extract `set_version_name_suffix()` and use it for both the `main->beta` and `beta->release` merges. The release path now uses the same b\d+ pattern as beta, so a beta past b9 no longer aborts the merge, and k9 starts at "b0" like Thunderbird instead of "b1". This should be fine since we don't release k9 beta, and the suffix gets dropped during a release for both apps.
Fixes: #11500
Problem
The beta path of
merge_gradle.pysearchedtheirs(main'sapp-thunderbird/build.gradle.kts) forversionNameSuffix = "b[1-9]". Sincemaincarriesb0, whichb[1-9]never matches, so the search failed and the path raisedSystemExit, causing git to mark the file as conflicted, so everymain -> betamerge needed manual fixing.Fix
Search for
b\d+(e.g b1, b2, b11, etc) so main's value matches whatever it is, and normalize the merge result tob0for both apps. The "Bump version suffix" step inshippable_builds.ymlbumps the suffix per Thunderbird beta release, so the merge result has to start atb0for the first beta release to produceb1. We don't ship betas for k9, and the beta suffix is dropped on a release.I've created a
set_version_name_suffix()helper to be used for both branch logic, and two new constants:BETA_SUFFIXandMAIN_SUFFIX.Three details:
oursrather thantheirs.shutil.copyfile(theirs, ours)runs first, so the two are identical in content, butoursis the file being patched and the one whose final state matters.SystemExitis now reserved for the case where the searched suffix line doesn't exist at all:a1on the app-k9mail path,b\d+on app-thunderbird.b\d+too, replacingb[1-9], so it no longer breaks once a cycle reachesb10.Testing
Ran the driver directly against the pre-merge branch tips:
b1b0b0b1a1b0