Skip to content

Commit 7e60810

Browse files
[Tooling] Use Release Version from ReleasesV2 in Code Freeze (#24929)
* Add release version validation during code freeze * Use the version passed to the lane as the source of truth * Update code freeze lane documentation * Add improvements based on PR comments --------- Co-authored-by: Olivier Halligon <[email protected]>
1 parent bc6887f commit 7e60810

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

.buildkite/release-pipelines/code-freeze.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ steps:
2222
bundle exec fastlane run configure_apply
2323
2424
echo '--- :shipit: Run code freeze'
25-
bundle exec fastlane code_freeze skip_confirm:true
25+
bundle exec fastlane code_freeze version:"${RELEASE_VERSION}" skip_confirm:true
2626
retry:
2727
manual:
2828
# If those jobs fail, one should always prefer re-triggering a new build from ReleaseV2 rather than retrying the individual job from Buildkite

fastlane/lanes/release.rb

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,33 @@
99
# - Extracts the Release Notes
1010
# - Freezes the GitHub milestone and enables the GitHub branch protection for the new branch
1111
#
12-
# @option [Boolean] skip_confirm (default: false) If true, avoids any interactive prompt
12+
# @param [Boolean] skip_confirm (default: false) If true, avoids any interactive prompt
13+
# @param [String] version (optional) The version to use for the new release version to code freeze for.
14+
# Typically auto-provided by ReleasesV2. If nil, computes the new version based on current one.
1315
#
14-
desc 'Executes the initial steps needed during code freeze'
15-
lane :code_freeze do |options|
16+
lane :code_freeze do |skip_confirm: false, version: nil|
1617
ensure_git_status_clean
1718

1819
# Check out the up-to-date default branch, the designated starting point for the code freeze
1920
Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH)
2021

21-
release_branch_name = compute_release_branch_name(options: options, version: release_version_next)
22+
# Use provided version from release tool, or fall back to computed version
23+
computed_version = release_version_next
24+
provided_version = version
25+
new_version = provided_version || computed_version
26+
27+
# Warn if provided version differs from computed version
28+
if provided_version && provided_version != computed_version
29+
warning_message = <<~WARNING
30+
⚠️ Version mismatch: The explicitly-provided version was '#{provided_version}' while new computed version would have been '#{computed_version}'.
31+
If this is unexpected, you might want to investigate the discrepency.
32+
Continuing with the explicitly-provided verison '#{provided_version}'.
33+
WARNING
34+
UI.important(warning_message)
35+
buildkite_annotate(style: 'warning', context: 'code-freeze-version-mismatch', message: warning_message) if is_ci
36+
end
37+
38+
release_branch_name = compute_release_branch_name(options: { version: version, skip_confirm: skip_confirm }, version: new_version)
2239
ensure_branch_does_not_exist!(release_branch_name)
2340

2441
# The `release_version_next` is used as the `new internal release version` value because the external and internal
@@ -28,14 +45,12 @@
2845
• New release branch from #{DEFAULT_BRANCH}: #{release_branch_name}
2946
3047
• Current release version and build code: #{release_version_current} (#{build_code_current}).
31-
• New release version and build code: #{release_version_next} (#{build_code_code_freeze}).
48+
• New release version and build code: #{new_version} (#{build_code_code_freeze}).
3249
MESSAGE
3350

3451
UI.important(message)
3552

36-
skip_user_confirmation = options[:skip_confirm]
37-
38-
UI.user_error!('Aborted by user request') unless skip_user_confirmation || UI.confirm('Do you want to continue?')
53+
UI.user_error!('Aborted by user request') unless skip_confirm || UI.confirm('Do you want to continue?')
3954

4055
UI.message 'Creating release branch...'
4156
Fastlane::Helper::GitHelper.create_branch(release_branch_name, from: DEFAULT_BRANCH)
@@ -51,8 +66,6 @@
5166

5267
commit_version_and_build_files
5368

54-
new_version = release_version_current
55-
5669
release_notes_source_path = File.join(PROJECT_ROOT_FOLDER, 'RELEASE-NOTES.txt')
5770
extract_release_notes_for_version(
5871
version: new_version,

0 commit comments

Comments
 (0)