Skip to content

Commit 420133c

Browse files
authored
Merge pull request #14731 from woocommerce/iangmaia/add-release-version-validation
[Tooling] Use Release Version from ReleasesV2 in Code Freeze
2 parents 01217d7 + c2b4454 commit 420133c

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ steps:
1212
install_gems
1313
1414
echo '--- :snowflake: Start Code Freeze'
15-
bundle exec fastlane start_code_freeze skip_confirm:true
15+
bundle exec fastlane start_code_freeze version:"${RELEASE_VERSION}" skip_confirm:true
1616
agents:
1717
queue: "tumblr-metal"
1818
retry:

fastlane/Fastfile

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,38 @@ platform :android do
108108

109109
# This lane executes the steps planned on code freeze, creating a new release branch from the current trunk.
110110
#
111+
# @param [String] version (optional) The version to use for the new release version to code freeze for.
112+
# Typically auto-provided by ReleasesV2. If nil, computes the new version based on current one.
111113
# @param [Boolean] skip_confirm (default: false) If set, will skip the confirmation prompt before running the rest of the lane
112114
#
113115
# @example Running the lane
114116
# bundle exec fastlane start_code_freeze skip_confirm:true
115117
#
116-
lane :start_code_freeze do |skip_confirm: false|
118+
lane :start_code_freeze do |version: nil, skip_confirm: false|
117119
ensure_git_status_clean
118120

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

124+
# Use provided version from release tool, or fall back to computed version
125+
computed_version = release_version_next
126+
new_version = version || computed_version
127+
128+
# Warn if provided version differs from computed version
129+
if version && version != computed_version
130+
warning_message = <<~WARNING
131+
⚠️ Version mismatch: The explicitly-provided version was '#{version}' while new computed version would have been '#{computed_version}'.
132+
If this is unexpected, you might want to investigate the discrepency.
133+
Continuing with the explicitly-provided verison '#{version}'.
134+
WARNING
135+
UI.important(warning_message)
136+
buildkite_annotate(style: 'warning', context: 'start-code-freeze-version-mismatch', message: warning_message) if is_ci
137+
end
138+
122139
message = <<-MESSAGE
123140
124141
Code Freeze:
125-
• New release branch from #{DEFAULT_BRANCH}: release/#{release_version_next}
142+
• New release branch from #{DEFAULT_BRANCH}: release/#{new_version}
126143
• Current release version and build code: #{release_version_current} (#{build_code_current}).
127144
• New beta version and build code: #{beta_version_first} (#{build_code_next}).
128145
@@ -132,7 +149,7 @@ platform :android do
132149
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?')
133150

134151
# Create the release branch
135-
new_release_branch = "release/#{release_version_next}"
152+
new_release_branch = "release/#{new_version}"
136153
ensure_branch_does_not_exist!(new_release_branch)
137154

138155
UI.message 'Creating release branch...'
@@ -148,8 +165,6 @@ platform :android do
148165
commit_version_bump
149166
UI.success("Done! New Beta Version: #{version_name_current}. New Build Code: #{build_code_current}")
150167

151-
new_version = release_version_current
152-
153168
# Extract dev release notes to `fastlane/metadata/android/en-US/changelogs/default.txt`
154169
extract_release_notes_for_version(
155170
version: new_version,

0 commit comments

Comments
 (0)