Skip to content

Commit 67041f2

Browse files
authored
[Tooling] Use Release Version from ReleasesV2 in Code Freeze (#16232)
2 parents 620a980 + 0425644 commit 67041f2

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ steps:
2121
bundle exec fastlane run configure_apply
2222
2323
echo '--- :snowflake: Start Code Freeze'
24-
bundle exec fastlane start_code_freeze skip_confirm:true
24+
bundle exec fastlane start_code_freeze version:"${RELEASE_VERSION}" skip_confirm:true
2525
retry:
2626
manual:
2727
# If those jobs fail, one should always prefer re-triggering a new build from ReleaseV2 rather than retrying the individual job from Buildkite

fastlane/Fastfile

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,29 +184,46 @@ platform :ios do
184184

185185
# This lane executes the steps planned on code freeze, creating a new release branch from the current trunk
186186
#
187+
# @param [String] version (optional) The version to use for the new release version to code freeze for.
188+
# Typically auto-provided by ReleasesV2. If nil, computes the new version based on current one.
187189
# @param [Boolean] skip_confirm (default: false) If set, will skip the confirmation prompt before running the rest of the lane
188190
#
189191
# @example Running the lane
190192
# bundle exec fastlane start_code_freeze skip_confirm:true
191193
#
192-
lane :start_code_freeze do |skip_confirm: false|
194+
lane :start_code_freeze do |version: nil, skip_confirm: false|
193195
ensure_git_status_clean
194196

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

200+
# Use provided version from release tool, or fall back to computed version
201+
computed_version = release_version_next
202+
new_version = version || computed_version
203+
204+
# Warn if provided version differs from computed version
205+
if version && version != computed_version
206+
warning_message = <<~WARNING
207+
⚠️ Version mismatch: The explicitly-provided version was '#{version}' while new computed version would have been '#{computed_version}'.
208+
If this is unexpected, you might want to investigate the discrepency.
209+
Continuing with the explicitly-provided verison '#{version}'.
210+
WARNING
211+
UI.important(warning_message)
212+
buildkite_annotate(style: 'warning', context: 'start-code-freeze-version-mismatch', message: warning_message) if is_ci
213+
end
214+
198215
UI.important <<-MESSAGE
199216
200217
Code Freeze:
201-
• New release branch from #{DEFAULT_BRANCH}: release/#{release_version_next}
218+
• New release branch from #{DEFAULT_BRANCH}: release/#{new_version}
202219
• Current release version and build code: #{release_version_current} (#{build_code_current}).
203-
• New release version and build code: #{release_version_next} (#{build_code_code_freeze}).
220+
• New release version and build code: #{new_version} (#{build_code_code_freeze}).
204221
205222
MESSAGE
206223
UI.user_error!("Terminating as requested. Don't forget to run the remainder of this automation manually.") unless skip_confirm || UI.confirm('Do you want to continue?')
207224

208225
# Create the release branch
209-
new_release_branch = "release/#{release_version_next}"
226+
new_release_branch = "release/#{new_version}"
210227
ensure_branch_does_not_exist!(new_release_branch)
211228

212229
UI.message('Creating release branch...')
@@ -222,8 +239,6 @@ platform :ios do
222239
commit_version_bump
223240
UI.success("Done! New Release Version: #{release_version_current}. New Build Code: #{build_code_current}")
224241

225-
new_version = release_version_current
226-
227242
extract_release_notes_for_version(
228243
version: new_version,
229244
release_notes_file_path: RELEASE_NOTES_SOURCE_PATH,

0 commit comments

Comments
 (0)