Skip to content

chore(ci): update merge script to match b0 beta suffix coming from main - #11499

Merged
kryoseu merged 2 commits into
thunderbird:mainfrom
kryoseu:main
Sep 4, 2026
Merged

chore(ci): update merge script to match b0 beta suffix coming from main#11499
kryoseu merged 2 commits into
thunderbird:mainfrom
kryoseu:main

Conversation

@kryoseu

@kryoseu kryoseu commented Sep 3, 2026

Copy link
Copy Markdown
Member

Fixes: #11500

Problem

The beta path of merge_gradle.py searched theirs (main's app-thunderbird/build.gradle.kts) for versionNameSuffix = "b[1-9]". Since main carries b0, which b[1-9] never matches, so the search failed and the path raised SystemExit, causing git to mark the file as conflicted, so every main -> beta merge 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 to b0 for both apps. The "Bump version suffix" step in shippable_builds.yml bumps the suffix per Thunderbird beta release, so the merge result has to start at b0 for the first beta release to produce b1. 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_SUFFIX and MAIN_SUFFIX.

Three details:

  • The search now targets ours rather than theirs. shutil.copyfile(theirs, ours) runs first, so the two are identical in content, but ours is the file being patched and the one whose final state matters.
  • SystemExit is now reserved for the case where the searched suffix line doesn't exist at all: a1 on the app-k9mail path, b\d+ on app-thunderbird.
  • The release path uses b\d+ too, replacing b[1-9], so it no longer breaks once a cycle reaches b10.

Testing

Ran the driver directly against the pre-merge branch tips:

ours (beta) theirs (main) result
app-thunderbird 23.0 / code 58 / b1 24.0 / code 4 / b0 24.0 / code 58 / b0
app-k9mail 23.0 / code 39021 / b1 24.0 / code 39004 / a1 24.0 / code 39021 / b0

@kryoseu
kryoseu requested a review from a team as a code owner September 3, 2026 18:36
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Validation Passed: All report and feature-flag labels are correctly set.

@coreycb coreycb added the report: exclude Exclude changes from user-facing reports (internal, minor, or not relevant to users). label Sep 3, 2026
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".
@kryoseu kryoseu changed the title fix(ci): update merge script to match b0 beta suffix coming from main chore(ci): update merge script to match b0 beta suffix coming from main Sep 3, 2026
Comment thread scripts/ci/merges/merge_gradle.py Outdated
@@ -63,16 +63,23 @@ def replace_matching_line(file_path, search_term, new_line):

if branch == "beta":
if is_k9:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will update the script to re-use more of the code though.

Comment thread scripts/ci/merges/merge_gradle.py Outdated
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+\""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine. I was just thinking it might be too much because we'll never have a b000009. Should be fine though.

Comment thread scripts/ci/merges/merge_gradle.py Outdated
Comment thread scripts/ci/merges/merge_gradle.py Outdated
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.

@coreycb coreycb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you

@kryoseu
kryoseu merged commit 05392dd into thunderbird:main Sep 4, 2026
18 checks passed
@thunderbird-botmobile thunderbird-botmobile Bot added this to the Thunderbird 25 milestone Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

report: exclude Exclude changes from user-facing reports (internal, minor, or not relevant to users).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

merge_gradle.py script always flags app-thunderbird/build.gradle.kts as a conflict due to versionNameSuffix mismatch during main <> beta merges

2 participants