From 622820cddacda392cc58adb2b60f5a44f3ac6bbe Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 24 Oct 2024 19:44:41 +0200 Subject: [PATCH 1/6] Update pipelines to use `use-bot-for-git` script for running git operations with write access --- ...elease-management.sh => configure-for-release.sh} | 10 +++++++++- .../release-pipelines/complete-code-freeze.yml | 2 +- .buildkite/release-pipelines/new-beta-release.yml | 8 +++++--- .buildkite/release-pipelines/start-code-freeze.yml | 12 ++++++++---- .xcode-version | 2 +- 5 files changed, 24 insertions(+), 10 deletions(-) rename .buildkite/commands/{configure-git-for-release-management.sh => configure-for-release.sh} (58%) diff --git a/.buildkite/commands/configure-git-for-release-management.sh b/.buildkite/commands/configure-for-release.sh similarity index 58% rename from .buildkite/commands/configure-git-for-release-management.sh rename to .buildkite/commands/configure-for-release.sh index 6aeae2b3b..b7211fd0b 100755 --- a/.buildkite/commands/configure-git-for-release-management.sh +++ b/.buildkite/commands/configure-for-release.sh @@ -1,8 +1,16 @@ #!/bin/bash -eu +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + echo "This script must be 'source'd (instead of being called directly as an executable) to work properly" + exit 1 +fi + # The Git command line client is not configured in Buildkite. -# At the moment, steps that need Git access can configure it on deman using this script. +# At the moment, steps that need Git access can configure it on demand using this script. # Later on, we should be able to configure it on the agent instead. add_host_to_ssh_known_hosts github.com git config --global user.email "mobile+wpmobilebot@automattic.com" git config --global user.name "Automattic Release Bot" + +echo '--- :robot_face: Use bot for git operations' +source use-bot-for-git diff --git a/.buildkite/release-pipelines/complete-code-freeze.yml b/.buildkite/release-pipelines/complete-code-freeze.yml index 4a5990cf1..18be74c0c 100644 --- a/.buildkite/release-pipelines/complete-code-freeze.yml +++ b/.buildkite/release-pipelines/complete-code-freeze.yml @@ -16,7 +16,7 @@ steps: plugins: [$CI_TOOLKIT_PLUGIN] command: | echo '--- :git: Configure Git for Release Management' - .buildkite/commands/configure-git-for-release-management.sh + source .buildkite/commands/configure-for-release.sh echo '--- :git: Checkout release branch' .buildkite/commands/checkout-release-branch.sh diff --git a/.buildkite/release-pipelines/new-beta-release.yml b/.buildkite/release-pipelines/new-beta-release.yml index b4c37a32b..49c98df79 100644 --- a/.buildkite/release-pipelines/new-beta-release.yml +++ b/.buildkite/release-pipelines/new-beta-release.yml @@ -1,8 +1,7 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json --- -agents: - queue: mac +# Variables used in this pipeline are defined in `shared-pipeline-vars`, which is `source`'d before calling `buildkite-agent pipeline upload` # The new beta workflow needs to run on macOS because it uses SwiftGen under the hood. # @@ -11,12 +10,15 @@ agents: env: IMAGE_ID: $IMAGE_ID +agents: + queue: mac + steps: - label: New Beta Release plugins: [$CI_TOOLKIT_PLUGIN] command: | echo '--- :git: Configure Git for Release Management' - .buildkite/commands/configure-git-for-release-management.sh + source .buildkite/commands/configure-for-release.sh echo '--- :git: Checkout Release Branch' .buildkite/commands/checkout-release-branch.sh diff --git a/.buildkite/release-pipelines/start-code-freeze.yml b/.buildkite/release-pipelines/start-code-freeze.yml index 49fabdaf4..baa9e6231 100644 --- a/.buildkite/release-pipelines/start-code-freeze.yml +++ b/.buildkite/release-pipelines/start-code-freeze.yml @@ -3,15 +3,19 @@ # Variables used in this pipeline are defined in `shared-pipeline-vars`, which is `source`'d before calling `buildkite-agent pipeline upload` +env: + IMAGE_ID: $IMAGE_ID + +agents: + queue: mac + steps: - label: Start Code Freeze plugins: - $CI_TOOLKIT_PLUGIN - agents: - queue: tumblr-metal command: | - echo '--- :robot_face: Use bot for Git operations' - source use-bot-for-git wpmobilebot + echo '--- :git: Configure Git for Release Management' + source .buildkite/commands/configure-for-release.sh echo '--- :ruby: Setup Ruby Tools' install_gems diff --git a/.xcode-version b/.xcode-version index 232a7fc1a..5cc8594da 100644 --- a/.xcode-version +++ b/.xcode-version @@ -1 +1 @@ -15.4 +16.1-rc.1 From b6124dbea87b826d8831697a8fcfa28a654b9c8b Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 24 Oct 2024 21:49:59 +0200 Subject: [PATCH 2/6] [TO REVERT] Comment out side effects to `start_code_freeze` lane, keeping only version bump --- fastlane/lanes/release.rb | 101 +++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/fastlane/lanes/release.rb b/fastlane/lanes/release.rb index 676fc8f58..7697a5061 100644 --- a/fastlane/lanes/release.rb +++ b/fastlane/lanes/release.rb @@ -6,25 +6,26 @@ lane :start_code_freeze do |skip_confirm: false| ensure_git_status_clean - Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH) + # Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH) + Fastlane::Helper::GitHelper.checkout_and_pull('iangmaia/use-trusted-mac-agents-for-releases') - computed_release_branch_name = release_branch_name(release_version: release_version_next) + # computed_release_branch_name = release_branch_name(release_version: release_version_next) - message = <<~MESSAGE - Code Freeze: - - New release branch from #{DEFAULT_BRANCH}: #{computed_release_branch_name} + # message = <<~MESSAGE + # Code Freeze: + # - New release branch from #{DEFAULT_BRANCH}: #{computed_release_branch_name} - - 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}). - MESSAGE + # - 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}). + # MESSAGE - UI.important(message) + # UI.important(message) - UI.user_error!('Aborted by user request') unless skip_confirm || UI.confirm('Do you want to continue?') + # UI.user_error!('Aborted by user request') unless skip_confirm || UI.confirm('Do you want to continue?') - UI.message 'Creating release branch...' - Fastlane::Helper::GitHelper.create_branch(computed_release_branch_name, from: DEFAULT_BRANCH) - UI.success "Done! New release branch is: #{git_branch}" + # UI.message 'Creating release branch...' + # Fastlane::Helper::GitHelper.create_branch(computed_release_branch_name, from: DEFAULT_BRANCH) + # UI.success "Done! New release branch is: #{git_branch}" UI.message 'Bumping release version and build code...' PUBLIC_VERSION_FILE.write( @@ -35,58 +36,58 @@ commit_version_and_build_files - new_version = release_version_current + # new_version = release_version_current - # Delete all release notes metadata, including the source of truth. - # We'll generate a new source of truth next, and the localized versions will be re-downloaded once translated on GlotPress. - # It's important we delete them, otherwise we risk using old release notes for locales that won't get translated in time for the release finalization. - delete_all_metadata_release_notes + # # Delete all release notes metadata, including the source of truth. + # # We'll generate a new source of truth next, and the localized versions will be re-downloaded once translated on GlotPress. + # # It's important we delete them, otherwise we risk using old release notes for locales that won't get translated in time for the release finalization. + # delete_all_metadata_release_notes - changelog_path = File.join(PROJECT_ROOT_FOLDER, 'RELEASE-NOTES.txt') - extract_release_notes_for_version( - version: new_version, - release_notes_file_path: changelog_path, - extracted_notes_file_path: RELEASE_NOTES_SOURCE_PATH - ) - # Add a new section to the changelog for the version _after_ the one we are code freezing - ios_update_release_notes( - new_version: new_version, - release_notes_file_path: changelog_path - ) + # changelog_path = File.join(PROJECT_ROOT_FOLDER, 'RELEASE-NOTES.txt') + # extract_release_notes_for_version( + # version: new_version, + # release_notes_file_path: changelog_path, + # extracted_notes_file_path: RELEASE_NOTES_SOURCE_PATH + # ) + # # Add a new section to the changelog for the version _after_ the one we are code freezing + # ios_update_release_notes( + # new_version: new_version, + # release_notes_file_path: changelog_path + # ) - UI.important('Pushing changes to remote, configuring the release on GitHub, and triggering the beta build...') - 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?') + # UI.important('Pushing changes to remote, configuring the release on GitHub, and triggering the beta build...') + # 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?') push_to_git_remote( tags: false, set_upstream: is_ci == false # only set upstream when running locally, useless in transient CI builds ) - copy_branch_protection( - repository: GITHUB_REPO, - from_branch: DEFAULT_BRANCH, - to_branch: computed_release_branch_name - ) + # copy_branch_protection( + # repository: GITHUB_REPO, + # from_branch: DEFAULT_BRANCH, + # to_branch: computed_release_branch_name + # ) - freeze_milestone_and_move_assigned_prs_to_next_milestone( - milestone_to_freeze: new_version, - next_milestone: release_version_next - ) + # freeze_milestone_and_move_assigned_prs_to_next_milestone( + # milestone_to_freeze: new_version, + # next_milestone: release_version_next + # ) - check_pods_references + # check_pods_references - next unless is_ci + # next unless is_ci - message = <<~MESSAGE - Code freeze started successfully. + # message = <<~MESSAGE + # Code freeze started successfully. - Next steps: + # Next steps: - - Checkout `#{release_branch_name}` branch locally - - Update Pods and release notes if needed - - Finalize the code freeze - MESSAGE - buildkite_annotate(context: 'code-freeze-success', style: 'success', message: message) + # - Checkout `#{release_branch_name}` branch locally + # - Update Pods and release notes if needed + # - Finalize the code freeze + # MESSAGE + # buildkite_annotate(context: 'code-freeze-success', style: 'success', message: message) end lane :complete_code_freeze do |skip_confirm: false| From bc3a0a3739dcc1a942a5b62fd0d2f24b11449360 Mon Sep 17 00:00:00 2001 From: Automattic Release Bot Date: Thu, 24 Oct 2024 12:56:39 -0700 Subject: [PATCH 3/6] Bump version number --- config/Version.Public.xcconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/Version.Public.xcconfig b/config/Version.Public.xcconfig index 48aa834d9..b4a587414 100644 --- a/config/Version.Public.xcconfig +++ b/config/Version.Public.xcconfig @@ -1,2 +1,2 @@ -VERSION_LONG = 4.54.0.1 -VERSION_SHORT = 4.54 +VERSION_LONG = 4.55.0.0 +VERSION_SHORT = 4.55 From 85146a7ec00c64c949ea9d9d1765e5df04d2dd61 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 24 Oct 2024 21:57:39 +0200 Subject: [PATCH 4/6] Revert "[TO REVERT] Comment out side effects to `start_code_freeze` lane, keeping only version bump" This reverts commit b6124dbea87b826d8831697a8fcfa28a654b9c8b. --- fastlane/lanes/release.rb | 101 +++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 51 deletions(-) diff --git a/fastlane/lanes/release.rb b/fastlane/lanes/release.rb index 7697a5061..676fc8f58 100644 --- a/fastlane/lanes/release.rb +++ b/fastlane/lanes/release.rb @@ -6,26 +6,25 @@ lane :start_code_freeze do |skip_confirm: false| ensure_git_status_clean - # Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH) - Fastlane::Helper::GitHelper.checkout_and_pull('iangmaia/use-trusted-mac-agents-for-releases') + Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH) - # computed_release_branch_name = release_branch_name(release_version: release_version_next) + computed_release_branch_name = release_branch_name(release_version: release_version_next) - # message = <<~MESSAGE - # Code Freeze: - # - New release branch from #{DEFAULT_BRANCH}: #{computed_release_branch_name} + message = <<~MESSAGE + Code Freeze: + - New release branch from #{DEFAULT_BRANCH}: #{computed_release_branch_name} - # - 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}). - # MESSAGE + - 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}). + MESSAGE - # UI.important(message) + UI.important(message) - # UI.user_error!('Aborted by user request') unless skip_confirm || UI.confirm('Do you want to continue?') + UI.user_error!('Aborted by user request') unless skip_confirm || UI.confirm('Do you want to continue?') - # UI.message 'Creating release branch...' - # Fastlane::Helper::GitHelper.create_branch(computed_release_branch_name, from: DEFAULT_BRANCH) - # UI.success "Done! New release branch is: #{git_branch}" + UI.message 'Creating release branch...' + Fastlane::Helper::GitHelper.create_branch(computed_release_branch_name, from: DEFAULT_BRANCH) + UI.success "Done! New release branch is: #{git_branch}" UI.message 'Bumping release version and build code...' PUBLIC_VERSION_FILE.write( @@ -36,58 +35,58 @@ commit_version_and_build_files - # new_version = release_version_current + new_version = release_version_current - # # Delete all release notes metadata, including the source of truth. - # # We'll generate a new source of truth next, and the localized versions will be re-downloaded once translated on GlotPress. - # # It's important we delete them, otherwise we risk using old release notes for locales that won't get translated in time for the release finalization. - # delete_all_metadata_release_notes + # Delete all release notes metadata, including the source of truth. + # We'll generate a new source of truth next, and the localized versions will be re-downloaded once translated on GlotPress. + # It's important we delete them, otherwise we risk using old release notes for locales that won't get translated in time for the release finalization. + delete_all_metadata_release_notes - # changelog_path = File.join(PROJECT_ROOT_FOLDER, 'RELEASE-NOTES.txt') - # extract_release_notes_for_version( - # version: new_version, - # release_notes_file_path: changelog_path, - # extracted_notes_file_path: RELEASE_NOTES_SOURCE_PATH - # ) - # # Add a new section to the changelog for the version _after_ the one we are code freezing - # ios_update_release_notes( - # new_version: new_version, - # release_notes_file_path: changelog_path - # ) + changelog_path = File.join(PROJECT_ROOT_FOLDER, 'RELEASE-NOTES.txt') + extract_release_notes_for_version( + version: new_version, + release_notes_file_path: changelog_path, + extracted_notes_file_path: RELEASE_NOTES_SOURCE_PATH + ) + # Add a new section to the changelog for the version _after_ the one we are code freezing + ios_update_release_notes( + new_version: new_version, + release_notes_file_path: changelog_path + ) - # UI.important('Pushing changes to remote, configuring the release on GitHub, and triggering the beta build...') - # 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?') + UI.important('Pushing changes to remote, configuring the release on GitHub, and triggering the beta build...') + 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?') push_to_git_remote( tags: false, set_upstream: is_ci == false # only set upstream when running locally, useless in transient CI builds ) - # copy_branch_protection( - # repository: GITHUB_REPO, - # from_branch: DEFAULT_BRANCH, - # to_branch: computed_release_branch_name - # ) + copy_branch_protection( + repository: GITHUB_REPO, + from_branch: DEFAULT_BRANCH, + to_branch: computed_release_branch_name + ) - # freeze_milestone_and_move_assigned_prs_to_next_milestone( - # milestone_to_freeze: new_version, - # next_milestone: release_version_next - # ) + freeze_milestone_and_move_assigned_prs_to_next_milestone( + milestone_to_freeze: new_version, + next_milestone: release_version_next + ) - # check_pods_references + check_pods_references - # next unless is_ci + next unless is_ci - # message = <<~MESSAGE - # Code freeze started successfully. + message = <<~MESSAGE + Code freeze started successfully. - # Next steps: + Next steps: - # - Checkout `#{release_branch_name}` branch locally - # - Update Pods and release notes if needed - # - Finalize the code freeze - # MESSAGE - # buildkite_annotate(context: 'code-freeze-success', style: 'success', message: message) + - Checkout `#{release_branch_name}` branch locally + - Update Pods and release notes if needed + - Finalize the code freeze + MESSAGE + buildkite_annotate(context: 'code-freeze-success', style: 'success', message: message) end lane :complete_code_freeze do |skip_confirm: false| From 18bb195ca3f98f84b1bd2060635bc18727433762 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Thu, 24 Oct 2024 21:57:45 +0200 Subject: [PATCH 5/6] Revert "Bump version number" This reverts commit bc3a0a3739dcc1a942a5b62fd0d2f24b11449360. --- config/Version.Public.xcconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/Version.Public.xcconfig b/config/Version.Public.xcconfig index b4a587414..48aa834d9 100644 --- a/config/Version.Public.xcconfig +++ b/config/Version.Public.xcconfig @@ -1,2 +1,2 @@ -VERSION_LONG = 4.55.0.0 -VERSION_SHORT = 4.55 +VERSION_LONG = 4.54.0.1 +VERSION_SHORT = 4.54 From 62607e911fadfcde781b3e9215d33e0de72c0649 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Fri, 25 Oct 2024 15:22:22 +0200 Subject: [PATCH 6/6] Set runtime flags separately instead of via the shebang --- .buildkite/commands/configure-for-release.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.buildkite/commands/configure-for-release.sh b/.buildkite/commands/configure-for-release.sh index b7211fd0b..61fc4ee74 100755 --- a/.buildkite/commands/configure-for-release.sh +++ b/.buildkite/commands/configure-for-release.sh @@ -1,14 +1,17 @@ -#!/bin/bash -eu +#!/bin/bash if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then echo "This script must be 'source'd (instead of being called directly as an executable) to work properly" exit 1 fi +# Note: Set the flags separately (instead of via the shebang), because that script will be `source`'d and not run directly +set -e +set -u + # The Git command line client is not configured in Buildkite. # At the moment, steps that need Git access can configure it on demand using this script. # Later on, we should be able to configure it on the agent instead. -add_host_to_ssh_known_hosts github.com git config --global user.email "mobile+wpmobilebot@automattic.com" git config --global user.name "Automattic Release Bot"