From 075255fe3bc050520e757375562656829f611621 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Wed, 8 Oct 2025 21:22:09 +0200 Subject: [PATCH 1/4] Add release version validation during code freeze --- .buildkite/release-pipelines/start-code-freeze.yml | 2 +- fastlane/Fastfile | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.buildkite/release-pipelines/start-code-freeze.yml b/.buildkite/release-pipelines/start-code-freeze.yml index 3f0924c60489..ed09af470ca0 100644 --- a/.buildkite/release-pipelines/start-code-freeze.yml +++ b/.buildkite/release-pipelines/start-code-freeze.yml @@ -12,7 +12,7 @@ steps: install_gems echo '--- :snowflake: Start Code Freeze' - bundle exec fastlane start_code_freeze skip_confirm:true + bundle exec fastlane start_code_freeze version:"${RELEASE_VERSION}" skip_confirm:true agents: queue: "tumblr-metal" retry: diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 1c99e7952cb4..09cd7c1e4cae 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -113,16 +113,23 @@ platform :android do # @example Running the lane # bundle exec fastlane start_code_freeze skip_confirm:true # - lane :start_code_freeze do |skip_confirm: false| + lane :start_code_freeze do |version: nil, skip_confirm: false| ensure_git_status_clean # Check out the up-to-date default branch, the designated starting point for the code freeze Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH) + # Validate provided version matches the calculated version + expected_version = release_version_next + if version && version != expected_version + UI.user_error!("Version mismatch: Provided version '#{version}' does not match calculated version '#{expected_version}'. Please check the release scenario version matches the project version.") + end + UI.success("✓ Version validation passed: Version (#{version || expected_version}) matches calculated version") if version + message = <<-MESSAGE Code Freeze: - • New release branch from #{DEFAULT_BRANCH}: release/#{release_version_next} + • New release branch from #{DEFAULT_BRANCH}: release/#{expected_version} • Current release version and build code: #{release_version_current} (#{build_code_current}). • New beta version and build code: #{beta_version_first} (#{build_code_next}). From c2d2e2b670054129bfe9c01d3818253f6a5c2146 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 9 Oct 2025 17:16:31 +0200 Subject: [PATCH 2/4] Use the version passed to the lane as the source of truth --- fastlane/Fastfile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 09cd7c1e4cae..1f3edeebc6f8 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -119,17 +119,21 @@ platform :android do # Check out the up-to-date default branch, the designated starting point for the code freeze Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH) - # Validate provided version matches the calculated version - expected_version = release_version_next - if version && version != expected_version - UI.user_error!("Version mismatch: Provided version '#{version}' does not match calculated version '#{expected_version}'. Please check the release scenario version matches the project version.") + # Use provided version from release tool, or fall back to calculated version + calculated_version = release_version_next + release_version = version || calculated_version + + # Warn if provided version differs from calculated version + if version && version != calculated_version + warning_message = "⚠️ Version mismatch: Release tool version is '#{version}' but calculated version is '#{calculated_version}'. Using '#{version}' from release tool." + UI.important(warning_message) + buildkite_annotate(style: 'warning', context: 'start-code-freeze-version-mismatch', message: warning_message) if is_ci end - UI.success("✓ Version validation passed: Version (#{version || expected_version}) matches calculated version") if version message = <<-MESSAGE Code Freeze: - • New release branch from #{DEFAULT_BRANCH}: release/#{expected_version} + • New release branch from #{DEFAULT_BRANCH}: release/#{release_version} • Current release version and build code: #{release_version_current} (#{build_code_current}). • New beta version and build code: #{beta_version_first} (#{build_code_next}). @@ -139,7 +143,7 @@ platform :android do 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?') # Create the release branch - new_release_branch = "release/#{release_version_next}" + new_release_branch = "release/#{release_version}" ensure_branch_does_not_exist!(new_release_branch) UI.message 'Creating release branch...' From 0f676bf480628d34f2f3b455f0f01b654b63817e Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 9 Oct 2025 18:02:36 +0200 Subject: [PATCH 3/4] Update code freeze lane documentation --- fastlane/Fastfile | 1 + 1 file changed, 1 insertion(+) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 1f3edeebc6f8..f8f5a6e5328e 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -108,6 +108,7 @@ platform :android do # This lane executes the steps planned on code freeze, creating a new release branch from the current trunk. # + # @param [String] version (optional) The version number for the release from the release tool. If not provided, uses the calculated version. # @param [Boolean] skip_confirm (default: false) If set, will skip the confirmation prompt before running the rest of the lane # # @example Running the lane From 6780ab01b7063055cb98b9801e64879dce323b34 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Fri, 10 Oct 2025 13:47:37 +0200 Subject: [PATCH 4/4] Add improvements based on PR comments --- fastlane/Fastfile | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index f8f5a6e5328e..c1db8cffd81e 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -108,7 +108,8 @@ platform :android do # This lane executes the steps planned on code freeze, creating a new release branch from the current trunk. # - # @param [String] version (optional) The version number for the release from the release tool. If not provided, uses the calculated version. + # @param [String] version (optional) The version to use for the new release version to code freeze for. + # Typically auto-provided by ReleasesV2. If nil, computes the new version based on current one. # @param [Boolean] skip_confirm (default: false) If set, will skip the confirmation prompt before running the rest of the lane # # @example Running the lane @@ -120,13 +121,17 @@ platform :android do # Check out the up-to-date default branch, the designated starting point for the code freeze Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH) - # Use provided version from release tool, or fall back to calculated version - calculated_version = release_version_next - release_version = version || calculated_version - - # Warn if provided version differs from calculated version - if version && version != calculated_version - warning_message = "⚠️ Version mismatch: Release tool version is '#{version}' but calculated version is '#{calculated_version}'. Using '#{version}' from release tool." + # Use provided version from release tool, or fall back to computed version + computed_version = release_version_next + new_version = version || computed_version + + # Warn if provided version differs from computed version + if version && version != computed_version + warning_message = <<~WARNING + ⚠️ Version mismatch: The explicitly-provided version was '#{version}' while new computed version would have been '#{computed_version}'. + If this is unexpected, you might want to investigate the discrepency. + Continuing with the explicitly-provided verison '#{version}'. + WARNING UI.important(warning_message) buildkite_annotate(style: 'warning', context: 'start-code-freeze-version-mismatch', message: warning_message) if is_ci end @@ -134,7 +139,7 @@ platform :android do message = <<-MESSAGE Code Freeze: - • New release branch from #{DEFAULT_BRANCH}: release/#{release_version} + • New release branch from #{DEFAULT_BRANCH}: release/#{new_version} • Current release version and build code: #{release_version_current} (#{build_code_current}). • New beta version and build code: #{beta_version_first} (#{build_code_next}). @@ -144,7 +149,7 @@ platform :android do 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?') # Create the release branch - new_release_branch = "release/#{release_version}" + new_release_branch = "release/#{new_version}" ensure_branch_does_not_exist!(new_release_branch) UI.message 'Creating release branch...' @@ -160,8 +165,6 @@ platform :android do commit_version_bump UI.success("Done! New Beta Version: #{version_name_current}. New Build Code: #{build_code_current}") - new_version = release_version_current - # Extract dev release notes to `fastlane/metadata/android/en-US/changelogs/default.txt` extract_release_notes_for_version( version: new_version,