diff --git a/.buildkite/release-pipelines/start-code-freeze.yml b/.buildkite/release-pipelines/start-code-freeze.yml index 9fdb85e0c10..66c712aea78 100644 --- a/.buildkite/release-pipelines/start-code-freeze.yml +++ b/.buildkite/release-pipelines/start-code-freeze.yml @@ -21,7 +21,7 @@ steps: bundle exec fastlane run configure_apply 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 retry: manual: # If those jobs fail, one should always prefer re-triggering a new build from ReleaseV2 rather than retrying the individual job from Buildkite diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 1570010acb7..dd56f41d17b 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -184,29 +184,46 @@ platform :ios 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 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 # 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) + # 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 + UI.important <<-MESSAGE Code Freeze: - • New release branch from #{DEFAULT_BRANCH}: release/#{release_version_next} + • New release branch from #{DEFAULT_BRANCH}: release/#{new_version} • Current release version and build code: #{release_version_current} (#{build_code_current}). - • New release version and build code: #{release_version_next} (#{build_code_code_freeze}). + • New release version and build code: #{new_version} (#{build_code_code_freeze}). MESSAGE 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/#{new_version}" ensure_branch_does_not_exist!(new_release_branch) UI.message('Creating release branch...') @@ -222,8 +239,6 @@ platform :ios do commit_version_bump UI.success("Done! New Release Version: #{release_version_current}. New Build Code: #{build_code_current}") - new_version = release_version_current - extract_release_notes_for_version( version: new_version, release_notes_file_path: RELEASE_NOTES_SOURCE_PATH,