Skip to content

Conversation

@iangmaia
Copy link
Contributor

@iangmaia iangmaia commented Oct 30, 2025

See AINFRA-1478

Description

This PR enhances the version handling added in the previous iteration to assume the version received by the code freeze lane as the source of truth, ignoring potential mismatches between the ReleasesV2 version and the project's computed version.

Testing

You can make sure the calculated release branch, current version and the next version are correctly shown in the "Continue" prompt. Just remember to answer N when asked to continue, to cancel the actual code freeze.

To avoid unexpected results, comment out the lines doing ensure_git_status_clean and Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH) at the beginning of the lane.

You can run the code_freeze lane, with and without the version parameters:

  • Run bundle exec fastlane code_freeze
  • Run bundle exec fastlane code_freeze version:30.6

This will be fully tested in the next release cycle during code freeze.

@iangmaia iangmaia self-assigned this Oct 31, 2025
@iangmaia iangmaia added this to the 26.5 milestone Oct 31, 2025
@iangmaia iangmaia added the Tooling Build, Release, and Validation Tools label Oct 31, 2025
@iangmaia iangmaia force-pushed the iangmaia/fail-when-code-freeze-version-mismatch branch from f49417e to 7eb63f5 Compare October 31, 2025 22:22
@iangmaia iangmaia marked this pull request as ready for review October 31, 2025 22:22
@iangmaia iangmaia force-pushed the iangmaia/fail-when-code-freeze-version-mismatch branch from 7eb63f5 to 99bf62b Compare November 7, 2025 15:16
@dangermattic
Copy link
Collaborator

dangermattic commented Nov 7, 2025

1 Warning
⚠️ This PR is assigned to the milestone 26.5. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.

Generated by 🚫 Danger

@iangmaia iangmaia force-pushed the iangmaia/fail-when-code-freeze-version-mismatch branch 2 times, most recently from e068039 to a1febfc Compare November 7, 2025 21:31
@iangmaia iangmaia changed the title [Tooling] Fail on Version Mismatch Between ReleasesV2 and Project [Tooling] Use ReleasesV2 version as the source of truth during Code Freeze Nov 7, 2025
@iangmaia iangmaia force-pushed the iangmaia/fail-when-code-freeze-version-mismatch branch from a1febfc to aeab5a8 Compare November 7, 2025 21:41
@twstokes
Copy link
Contributor

I applied the following patch:

diff --git a/fastlane/lanes/release.rb b/fastlane/lanes/release.rb
index 2355027881..126b389c5d 100644
--- a/fastlane/lanes/release.rb
+++ b/fastlane/lanes/release.rb
@@ -14,10 +14,10 @@ platform :ios do
   #                 Typically auto-provided by ReleasesV2. If nil, computes the new version based on current one.
   #
   lane :code_freeze do |skip_confirm: false, version: nil|
-    ensure_git_status_clean
+    #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)
+    #Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH)
 
     # If a new version is passed, use it as source of truth from now on
     new_version = version || release_version_next

and ran bundle exec fastlane code_freeze and got:

Code Freeze:
• New release branch from trunk: release/26.5

• Current release version and build code: 26.4 (26.4.0.3).
• New release version and build code: 26.5 (26.5.0.0).

Running bundle exec fastlane code_freeze version:30.6 gave me:

Code Freeze:
• New release branch from trunk: release/30.6

• Current release version and build code: 26.4 (26.4.0.3).
• New release version and build code: 30.6 (30.6.0.0).

Copy link
Contributor

@mokagio mokagio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Did not test locally because @twstokes already did that.

In reviewing this PR, I realized that one of the ones I reviewed earlier had kept the UI warning about the version mismatch:

image

When I run into it, I felt it was useful. However, I can see how it takes up space for something that should occur rarely.

Comment on lines 132 to 133
version_short ||= PUBLIC_VERSION_FILE.read_release_version
# Read the current build code from the .xcconfig file and parse it into an AppVersion object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to https://github.com/woocommerce/woocommerce-ios/pull/16296/files#r2512589279. We could move the comment back where the read happens:

Suggested change
version_short ||= PUBLIC_VERSION_FILE.read_release_version
# Read the current build code from the .xcconfig file and parse it into an AppVersion object
# Read the current build code from the .xcconfig file and parse it into an AppVersion object,
# unless already given.
version_short ||= PUBLIC_VERSION_FILE.read_release_version

or just do without:

Suggested change
version_short ||= PUBLIC_VERSION_FILE.read_release_version
# Read the current build code from the .xcconfig file and parse it into an AppVersion object
version_short ||= PUBLIC_VERSION_FILE.read_release_version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, good point on making it more readable (the terminology "build code", "version" was looking a bit confusing). I've tried to improve all the comments for this method, ded4343.

@iangmaia iangmaia enabled auto-merge November 11, 2025 18:30
@sonarqubecloud
Copy link

@iangmaia iangmaia added this pull request to the merge queue Nov 11, 2025
Merged via the queue into trunk with commit d34c401 Nov 11, 2025
30 of 32 checks passed
@iangmaia iangmaia deleted the iangmaia/fail-when-code-freeze-version-mismatch branch November 11, 2025 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tooling Build, Release, and Validation Tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants