Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tooling] Fix hotfix lanes #16880

Merged
merged 4 commits into from
Jul 20, 2021
Merged

[Tooling] Fix hotfix lanes #16880

merged 4 commits into from
Jul 20, 2021

Conversation

AliSoftware
Copy link
Contributor

@AliSoftware AliSoftware commented Jul 16, 2021

Part of the paaHJt-1WQ-p2 project.

To test

  • Checkout this branch, run bundle install
  • Run bundle exec fastlane new_hotfix_release version:17.6.1 (⚠️ don't use 17.7.1, there's already one pending for this one – pbArwn-2uE-p2)
  • Verify that it cut a release/17.6.1 branch from the 17.6 tag
  • Verify that it bumped the version in Version.internal.xcconfig, Version.public.xcconfig and fastlane/Deliverfile (*)
  • cherry-pick all the commits from this PR on top of the release/17.6.1 branch. This is because we are gonna test the updated finalize lanes, and need to be on the hotfix release branch to test them. You might get conflicts, keep left (commits from this PR) every time.
  • Open the CircleCI page for WPiOS in advance, to be ready to cancel the release build
  • Run bundle exec fastlane finalize_release (reply no when it suggests to update release toolkit). You should get an error telling you that you should use finalize_hotfix_release for hotfix branches instead.
  • Run bundle exec fastlane finalize_hotfix_release and verify that it triggered a release build, and that is is building it from the release/7.0.1 17.6.1 hotfix branch. Cancel the CI build immediately (NB: 231 is a version code that already exists so in case you fail to cancel it, the build should fail to upload to playstore anyway)
  • Delete the release/17.6.1 branch (from both local and remote)

(*) @mokagio you might want to make sure that your changes about getting rid of Deliverfile in the repos won't be impacted by those version bumps btw. This test scenario, since it was exerced on the codebase from back in 17.6, still found a Deliverfile back then, so that worked, but not sure about the impact of your changes there in other lanes. Especially, even the new_beta_release and new_hotfix_release might benefit from the similar change that you seem to have done on the code_freeze lane which adds skip_deliver: true to the version bump action call. So you may want to replicate that change you did to all places, not just code freeze.

…ad redirect to dedicated finalize_hotfix_release lane
…es doc

For consistency with how other app's Fastfiles are organized
@AliSoftware AliSoftware added [Status] DO NOT MERGE Tooling Build, Release, and Validation Tools labels Jul 16, 2021
@AliSoftware AliSoftware added this to the 17.9 milestone Jul 16, 2021
@AliSoftware AliSoftware requested a review from a team July 16, 2021 18:13
@AliSoftware AliSoftware self-assigned this Jul 16, 2021
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jul 16, 2021

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jul 16, 2021

You can trigger an installable build for these changes by visiting CircleCI here.

Comment on lines -115 to +119
extract_release_notes_for_version(version: new_version,
release_notes_file_path: File.join(ENV["PROJECT_ROOT_FOLDER"], 'RELEASE-NOTES.txt'),
extracted_notes_file_path: File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'Resources', 'release_notes.txt'))
extract_release_notes_for_version(
version: new_version,
release_notes_file_path: File.join(PROJECT_ROOT_FOLDER, 'RELEASE-NOTES.txt'),
extracted_notes_file_path: File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'Resources', 'release_notes.txt')
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just formatting and unrelated to the change, sorry for the noise. My IDE kept correcting it so I figured I'd leave it there.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is the right kind of formatting. Thank you for tracking it so future users won't have to 👍

@@ -263,30 +283,33 @@ platform :ios do
#####################################################################################
desc 'Trigger the final release build on CI'
lane :finalize_release do |options|
UI.user_error!('To finalize a hotfix, please use the finalize_hotfix_release lane instead') if ios_current_branch_is_hotfix

ios_finalize_prechecks(options)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only change in the lines below this one is that when the unless ios_current_branch_is_hotfix test was removed, the rest of the code got un-indented. You might want to review those lines with "ignore whitespaces" turned on for ease of review.

Comment on lines -352 to -369
#####################################################################################
# finalize_hotfix_release
# -----------------------------------------------------------------------------------
# This lane finalizes the hotfix branch.
# -----------------------------------------------------------------------------------
# Usage:
# bundle exec fastlane finalize_hotfix_release [skip_confirm:<skip confirm>]
#
# Example:
# bundle exec fastlane finalize_hotfix_release skip_confirm:true
#####################################################################################
desc 'Performs the final checks and tags the hotfix in the current branch'
lane :finalize_hotfix_release do |options|
ios_finalize_prechecks(options)
version = ios_get_app_version
trigger_release_build(branch_to_build: "release/#{version}")
end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved to lines 253-270 above so it gets closer to the related new_hotfix_release lane and is following the same lane order than in other app's Fastfiles for consistency.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea. Spatial locality ++

@AliSoftware
Copy link
Contributor Author

Just saw that since the Deliverfile was removed recently, we'd need @mokagio 's wordpress-mobile/release-toolkit#287 to be finished, undrafted and merged, then point to the future new release of the toolkit, then use it in the hotfix lane. Not sure if this should be done as part of this PR and project, or separately as part of @mokagio 's work on Deliverfile removal.

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.

  • Verify that it cut a release/17.6.1 branch from the 17.6 tag

$ git log

* 4ced324bf7 - (HEAD -> release/17.6.1, origin/release/17.6.1) Bump version number (40 seconds ago)  Gio Lodi
* 6c1ee71d91 - (tag: 17.6) Bump version number (4 weeks ago)  Gio Lodi

Verify that it bumped the version in Version.internal.xcconfig, Version.public.xcconfig and fastlane/Deliverfile

commit 4ced324bf79357cf716469cb1e4f6fc1d8881fad
Author: Gio Lodi <[email protected]>
Date:   Tue Jul 20 16:44:59 2021 +1000

    Bump version number

diff --git a/config/Version.internal.xcconfig b/config/Version.internal.xcconfig
index 1338f58a1b..403f2ec7b5 100644
--- a/config/Version.internal.xcconfig
+++ b/config/Version.internal.xcconfig
@@ -1,4 +1,4 @@
-VERSION_SHORT=17.6
+VERSION_SHORT=17.6.1
 
 // Internal long version example: VERSION_LONG=9.9.0.20180423
-VERSION_LONG=17.6.0.20210625
+VERSION_LONG=17.6.1.20210720
diff --git a/config/Version.public.xcconfig b/config/Version.public.xcconfig
index c6300f26cb..1a1e3edc7d 100644
--- a/config/Version.public.xcconfig
+++ b/config/Version.public.xcconfig
@@ -1,4 +1,4 @@
-VERSION_SHORT=17.6
+VERSION_SHORT=17.6.1
 
 // Public long version example: VERSION_LONG=9.9.0.0
-VERSION_LONG=17.6.0.5
+VERSION_LONG=17.6.1.0
diff --git a/fastlane/Deliverfile b/fastlane/Deliverfile
index fd9090571d..1c21826917 100644
--- a/fastlane/Deliverfile
+++ b/fastlane/Deliverfile
@@ -5,7 +5,7 @@ screenshots_path "./fastlane/promo-screenshots/"
 app_identifier "org.wordpress"
 
 # Make sure to update these keys for a new version
-app_version "17.6"
+app_version "17.6.1"
 
 skip_binary_upload true
 overwrite_screenshots true

Run bundle exec fastlane finalize_release (reply no when it suggests to update release toolkit). You should get an error telling you that you should use finalize_hotfix_release for hotfix branches instead.


image

Run bundle exec fastlane finalize_hotfix_release and verify that it triggered a release build, and that is is building it from the release/7.0.1 [17.6.1? – @mokagio] hotfix branch.


image

👍 Thanks @AliSoftware

The cherry-pick had conflicts, so I didn't really test the changes in this PR, but my conflict resolution of the changes against the newly create 17.6.1 branch. Still, I think that's good enough.

Comment on lines -115 to +119
extract_release_notes_for_version(version: new_version,
release_notes_file_path: File.join(ENV["PROJECT_ROOT_FOLDER"], 'RELEASE-NOTES.txt'),
extracted_notes_file_path: File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'Resources', 'release_notes.txt'))
extract_release_notes_for_version(
version: new_version,
release_notes_file_path: File.join(PROJECT_ROOT_FOLDER, 'RELEASE-NOTES.txt'),
extracted_notes_file_path: File.join(PROJECT_ROOT_FOLDER, 'WordPress', 'Resources', 'release_notes.txt')
)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the right kind of formatting. Thank you for tracking it so future users won't have to 👍

fastlane/Fastfile Outdated Show resolved Hide resolved
Comment on lines -352 to -369
#####################################################################################
# finalize_hotfix_release
# -----------------------------------------------------------------------------------
# This lane finalizes the hotfix branch.
# -----------------------------------------------------------------------------------
# Usage:
# bundle exec fastlane finalize_hotfix_release [skip_confirm:<skip confirm>]
#
# Example:
# bundle exec fastlane finalize_hotfix_release skip_confirm:true
#####################################################################################
desc 'Performs the final checks and tags the hotfix in the current branch'
lane :finalize_hotfix_release do |options|
ios_finalize_prechecks(options)
version = ios_get_app_version
trigger_release_build(branch_to_build: "release/#{version}")
end

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea. Spatial locality ++

@mokagio
Copy link
Contributor

mokagio commented Jul 20, 2021

Not sure if this should be done as part of this PR and project, or separately as part of @mokagio 's work on Deliverfile removal.

I'll take care of that in isolation. Hopefully this week. Thanks.

@mokagio
Copy link
Contributor

mokagio commented Jul 20, 2021

Since Olivier is away this week, I'll "take over" and enable auto-merge for this PR after having approved it and applied a typo fix.

@mokagio mokagio enabled auto-merge July 20, 2021 06:59
@mokagio mokagio merged commit 5100e79 into develop Jul 20, 2021
@mokagio mokagio deleted the tooling/hotfix-lanes branch July 20, 2021 07:28
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.

2 participants