Skip to content

Commit bf02f34

Browse files
authored
Update ci for + releases (flutter#12419)
Updates the `enabled_branches` regex patterns in `.ci.yaml` to support SemVer release branch names with optional pre-release tags (e.g., `-dev.1`) and build metadata suffixes (e.g., `+1`). Previously, `enabled_branches` used the strict pattern `release-<package>-\d+\.\d+\.\d+`. When release branches were created with build metadata suffixes (e.g., `release-material_ui-0.0.3+1`), Cocoon CI failed validation with: > `release-material_ui-0.0.3+1 is not enabled for this .ci.yaml. Add it to run tests against this PR.` Blocked PRs: - flutter/packages#12412 - flutter/packages#12410 Updated the regex for release branches to `release-<package>-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?`, allowing valid SemVer pre-release and build metadata identifiers while maintaining strict matching against non-version branch names. ### Pattern Verification Examples | Branch Name | Match Result | Status | | --- | --- | --- | | `release-material_ui-0.0.3` | **Match** | ✅ Standard SemVer | | `release-material_ui-0.0.3+1` | **Match** | ✅ Build metadata suffix | | `release-material_ui-0.0.3-dev.1+2` | **Match** | ✅ Pre-release & build metadata | | `release-material_ui-invalid-branch` | **No Match** | ❌ Rejected | ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 19a9f91 commit bf02f34

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

‎.ci.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
# * https://github.com/flutter/cocoon/blob/main/CI_YAML.md
88
enabled_branches:
99
- main
10-
- release-go_router-\d+\.\d+\.\d+
11-
- release-cupertino_ui-\d+\.\d+\.\d+
12-
- release-material_ui-\d+\.\d+\.\d+
10+
- release-go_router-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?
11+
- release-cupertino_ui-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?
12+
- release-material_ui-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?
1313

1414
platform_properties:
1515
linux:

‎script/tool/lib/src/validators/repo_info_validator.dart‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,18 +403,20 @@ class RepoInfoValidator {
403403
final enabledBranches = yaml['enabled_branches'] as YamlList?;
404404
final bool hasBranchPattern =
405405
enabledBranches != null &&
406-
enabledBranches.contains(r'release-' + packageName + r'-\d+\.\d+\.\d+');
406+
enabledBranches.contains(
407+
r'release-' + packageName + r'-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?',
408+
);
407409

408410
if (isBatchRelease && !hasBranchPattern) {
409411
printError(
410-
'${_indentation}Missing release branch pattern release-$packageName-\\d+\\.\\d+\\.\\d+ '
412+
'${_indentation}Missing release branch pattern release-$packageName-\\d+\\.\\d+\\.\\d+(?:-[\\w.]+)?(?:\\+[\\w.]+)? '
411413
'in enabled_branches in .ci.yaml\n'
412414
'${_indentation}See https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/README.md#batch-release',
413415
);
414416
errors.add('Unexpected branch handling in .ci.yaml');
415417
} else if (!isBatchRelease && hasBranchPattern) {
416418
printError(
417-
'${_indentation}Unexpected release branch pattern release-$packageName-\\d+\\.\\d+\\.\\d+ '
419+
'${_indentation}Unexpected release branch pattern release-$packageName-\\d+\\.\\d+\\.\\d+(?:-[\\w.]+)?(?:\\+[\\w.]+)? '
418420
'in enabled_branches in .ci.yaml',
419421
);
420422
errors.add('Unexpected branch handling in .ci.yaml');

‎script/tool/test/validate_command_repo_info_test.dart‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ release:
696696
root.childFile('.ci.yaml').writeAsStringSync(r'''
697697
enabled_branches:
698698
- main
699-
- release-a_package-\d+\.\d+\.\d+
699+
- release-a_package-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?
700700
''');
701701
}
702702
}
@@ -991,7 +991,7 @@ enabled_branches:
991991
output,
992992
contains(
993993
contains(
994-
r'Missing release branch pattern release-a_package-\d+\.\d+\.\d+ in enabled_branches in .ci.yaml',
994+
r'Missing release branch pattern release-a_package-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)? in enabled_branches in .ci.yaml',
995995
),
996996
),
997997
);
@@ -1006,7 +1006,7 @@ enabled_branches:
10061006
root.childFile('.ci.yaml').writeAsStringSync(r'''
10071007
enabled_branches:
10081008
- main
1009-
- release-a_package-\d+\.\d+\.\d+
1009+
- release-a_package-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?
10101010
''');
10111011

10121012
Error? commandError;
@@ -1023,7 +1023,7 @@ enabled_branches:
10231023
output,
10241024
contains(
10251025
contains(
1026-
r'Unexpected release branch pattern release-a_package-\d+\.\d+\.\d+ in enabled_branches in .ci.yaml',
1026+
r'Unexpected release branch pattern release-a_package-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)? in enabled_branches in .ci.yaml',
10271027
),
10281028
),
10291029
);

0 commit comments

Comments
 (0)