From 3eeef7f618b7a2fb9e6ab488c7a19b6853e79389 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 10:59:28 +0100 Subject: [PATCH 1/8] Point release toolkit to `trunk` to get `buildkite_trigger_build` action --- Gemfile.lock | 39 ++++++++++++++++++++++++--------------- fastlane/Pluginfile | 4 ++-- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index eea70de2c368..936daeaadd76 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,23 @@ +GIT + remote: git@github.com:wordpress-mobile/release-toolkit + revision: c198441d2050c52714d40c8791d0020bd1c4f752 + branch: trunk + specs: + fastlane-plugin-wpmreleasetoolkit (2.3.0) + activesupport (~> 5) + bigdecimal (~> 1.4) + buildkit (~> 1.4) + chroma (= 0.2.0) + diffy (~> 3.3) + git (~> 1.3) + jsonlint (~> 0.3) + nokogiri (~> 1.11) + octokit (~> 4.18) + parallel (~> 1.14) + progress_bar (~> 1.3) + rake (>= 12.3, < 14.0) + rake-compiler (~> 1.0) + GEM remote: https://rubygems.org/ specs: @@ -33,6 +53,8 @@ GEM aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) bigdecimal (1.4.4) + buildkit (1.4.5) + sawyer (>= 0.6) chroma (0.2.0) claide (1.1.0) cocoapods (1.11.2) @@ -161,19 +183,6 @@ GEM xcpretty-travis-formatter (>= 0.0.3) fastlane-plugin-appcenter (1.11.0) fastlane-plugin-sentry (1.8.1) - fastlane-plugin-wpmreleasetoolkit (2.3.0) - activesupport (~> 5) - bigdecimal (~> 1.4) - chroma (= 0.2.0) - diffy (~> 3.3) - git (~> 1.3) - jsonlint (~> 0.3) - nokogiri (~> 1.11) - octokit (~> 4.18) - parallel (~> 1.14) - progress_bar (~> 1.3) - rake (>= 12.3, < 14.0) - rake-compiler (~> 1.0) ffi (1.15.5) fourflusher (2.3.1) fuzzy_match (2.0.4) @@ -245,7 +254,7 @@ GEM nokogiri (1.13.1) mini_portile2 (~> 2.7.0) racc (~> 1.4) - octokit (4.21.0) + octokit (4.22.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) oj (3.13.11) @@ -331,7 +340,7 @@ DEPENDENCIES fastlane (~> 2.174) fastlane-plugin-appcenter (~> 1.8) fastlane-plugin-sentry - fastlane-plugin-wpmreleasetoolkit (~> 2.3) + fastlane-plugin-wpmreleasetoolkit! octokit (~> 4.0) rake rmagick (~> 3.2.0) diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile index bb5c3d1e3d20..4c78f66c4ba9 100644 --- a/fastlane/Pluginfile +++ b/fastlane/Pluginfile @@ -7,8 +7,8 @@ group :screenshots, optional: true do end # This comment avoids typing to switch to a development version for testing. -# gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit', branch: 'trunk' -gem 'fastlane-plugin-wpmreleasetoolkit', '~> 2.3' +gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit', branch: 'trunk' +# gem 'fastlane-plugin-wpmreleasetoolkit', '~> 2.3' gem 'fastlane-plugin-sentry' gem 'fastlane-plugin-appcenter', '~> 1.8' From ea7bdb7e8ec42653fe46ebe1f1b3bda255aa780f Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:04:14 +0100 Subject: [PATCH 2/8] Remove `build_and_upload_beta_release` lane, recently become unused --- fastlane/Fastfile | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 5add429f81aa..5da4e1c7329f 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -467,27 +467,6 @@ platform :ios do download_jetpack_localized_app_store_metadata end - ##################################################################################### - # build_and_upload_beta_release - # ----------------------------------------------------------------------------------- - # This lane builds a beta release of the app and optionally uploads - # it for both internal and external distribution - # ----------------------------------------------------------------------------------- - # Usage: - # bundle exec fastlane build_and_upload_beta_release [skip_confirm:] - # [create_gh_release:] - # - # Example: - # bundle exec fastlane build_and_upload_beta_release - # bundle exec fastlane build_and_upload_beta_release skip_confirm:true - # bundle exec fastlane build_and_upload_beta_release create_gh_release:true - ##################################################################################### - desc 'Builds and uploads a beta release for distribution' - lane :build_and_upload_beta_release do |options| - build_and_upload_app_center(options) - build_and_upload_app_store_connect(options) - end - ##################################################################################### # build_and_upload_stable_release # ----------------------------------------------------------------------------------- From 3c593f24f8897a3f37893507f279c2ab60ce92e2 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:05:25 +0100 Subject: [PATCH 3/8] Remove `build_and_upload_stable_release` lane, recently become unused --- fastlane/Fastfile | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 5da4e1c7329f..cd22c5f877b5 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -467,26 +467,6 @@ platform :ios do download_jetpack_localized_app_store_metadata end - ##################################################################################### - # build_and_upload_stable_release - # ----------------------------------------------------------------------------------- - # This lane builds a stable release of the app and optionally uploads - # it for distribution - # ----------------------------------------------------------------------------------- - # Usage: - # bundle exec fastlane build_and_upload_stable_release [skip_confirm:] - # [create_gh_release:] - # - # Example: - # bundle exec fastlane build_and_upload_stable_release - # bundle exec fastlane build_and_upload_stable_release skip_confirm:true - # bundle exec fastlane build_and_upload_stable_release create_gh_release:true - ##################################################################################### - desc 'Builds and uploads a stable release for distribution' - lane :build_and_upload_stable_release do |options| - build_and_upload_app_store_connect(options) - end - ##################################################################################### # build_and_upload_app_store_connect # ----------------------------------------------------------------------------------- From 7a946039f2408c1136e385b274de17f665662bcb Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:15:49 +0100 Subject: [PATCH 4/8] DRY calls to Buildkite action in `Fastfile` This will also make the addition of a parameter to differentiate between beta and stable builds cleaner. --- fastlane/Fastfile | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index cd22c5f877b5..d8be943ab1fe 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -776,12 +776,7 @@ platform :ios do # ##################################################################################### lane :trigger_beta_build do |options| - buildkite_trigger_build( - buildkite_organization: 'automattic', - buildkite_pipeline: 'wordpress-ios', - branch: options[:branch_to_build], - pipeline_file: 'release-builds.yml' - ) + trigger_buildkite_release_build(branch: options[:branch_to_build]) end ##################################################################################### @@ -794,12 +789,7 @@ platform :ios do # ##################################################################################### lane :trigger_release_build do |options| - buildkite_trigger_build( - buildkite_organization: 'automattic', - buildkite_pipeline: 'wordpress-ios', - branch: options[:branch_to_build], - pipeline_file: 'release-builds.yml' - ) + trigger_buildkite_release_build(branch: options[:branch_to_build]) end ######################################################################## @@ -978,6 +968,15 @@ def generate_installable_build_number end end +def trigger_buildkite_release_build(branch:) + buildkite_trigger_build( + buildkite_organization: 'automattic', + buildkite_pipeline: 'wordpress-ios', + branch: branch, + pipeline_file: 'release-builds.yml' + ) +end + # Application-agnostic settings for the `upload_to_app_store` action, also # known as `deliver`. UPLOAD_TO_APP_STORE_COMMON_PARAMS = { From f8087cd37d21e32820f8831fd670c29e57c45daa Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:19:13 +0100 Subject: [PATCH 5/8] Move each parameter in `release-build-wordpress.sh` to dedicate line We'll add another one next, and the line length would have gotten too long --- .buildkite/commands/release-build-wordpress.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.buildkite/commands/release-build-wordpress.sh b/.buildkite/commands/release-build-wordpress.sh index f82acbe8b2e5..2330b2bc1de3 100644 --- a/.buildkite/commands/release-build-wordpress.sh +++ b/.buildkite/commands/release-build-wordpress.sh @@ -19,4 +19,6 @@ echo "--- :closed_lock_with_key: Installing Secrets" bundle exec fastlane run configure_apply echo "--- :hammer_and_wrench: Building" -bundle exec fastlane build_and_upload_app_store_connect skip_confirm:true create_gh_release:true +bundle exec fastlane build_and_upload_app_store_connect \ + skip_confirm:true \ + create_gh_release:true From ac614d56829ea14b412ba4db7de72d6a7f92924c Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:28:56 +0100 Subject: [PATCH 6/8] Allow `release-build-wordpress.sh` to specify whether to build a beta --- .buildkite/commands/release-build-wordpress.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.buildkite/commands/release-build-wordpress.sh b/.buildkite/commands/release-build-wordpress.sh index 2330b2bc1de3..f05f86f65253 100644 --- a/.buildkite/commands/release-build-wordpress.sh +++ b/.buildkite/commands/release-build-wordpress.sh @@ -21,4 +21,5 @@ bundle exec fastlane run configure_apply echo "--- :hammer_and_wrench: Building" bundle exec fastlane build_and_upload_app_store_connect \ skip_confirm:true \ - create_gh_release:true + create_gh_release:true \ + beta_release:${1:-true} # use first call param, default to true for safety From a29811423d4b549b72299e460c7b39b7e3f7011a Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:30:48 +0100 Subject: [PATCH 7/8] Forward beta release parameter from Fastlane to Buildkite --- .buildkite/release-builds.yml | 2 +- fastlane/Fastfile | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.buildkite/release-builds.yml b/.buildkite/release-builds.yml index 0fa25a6f7742..4638aebe612c 100644 --- a/.buildkite/release-builds.yml +++ b/.buildkite/release-builds.yml @@ -15,7 +15,7 @@ common_params: steps: - label: "🛠 WordPress Release Build (App Store Connect)" - command: ".buildkite/commands/release-build-wordpress.sh" + command: ".buildkite/commands/release-build-wordpress.sh $BETA_RELEASE" env: *common_env plugins: *common_plugins notify: diff --git a/fastlane/Fastfile b/fastlane/Fastfile index d8be943ab1fe..722d469df8b1 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -776,7 +776,7 @@ platform :ios do # ##################################################################################### lane :trigger_beta_build do |options| - trigger_buildkite_release_build(branch: options[:branch_to_build]) + trigger_buildkite_release_build(branch: options[:branch_to_build], beta: true) end ##################################################################################### @@ -789,7 +789,7 @@ platform :ios do # ##################################################################################### lane :trigger_release_build do |options| - trigger_buildkite_release_build(branch: options[:branch_to_build]) + trigger_buildkite_release_build(branch: options[:branch_to_build], beta: false) end ######################################################################## @@ -968,11 +968,12 @@ def generate_installable_build_number end end -def trigger_buildkite_release_build(branch:) +def trigger_buildkite_release_build(branch:, beta:) buildkite_trigger_build( buildkite_organization: 'automattic', buildkite_pipeline: 'wordpress-ios', branch: branch, + environment: { BETA_RELEASE: beta }, pipeline_file: 'release-builds.yml' ) end From ac4208120bde29b025c3debf813e609285532bac Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 4 Feb 2022 11:38:01 +0100 Subject: [PATCH 8/8] Make `release-build-*` Buildkite scripts executable After adding a parameter to the `release-build-wordpress.sh` call, I got a permission denied error. See https://buildkite.com/automattic/wordpress-ios/builds/4907#226a7e18-7592-4e95-9064-2829b4cb7f12/381-383 I guess if the path to a script is the only value in the `command` node, then Buildkite calls it via `sh` (or maybe `$SHELL`), otherwise it runs it as an actual command within its shell, in which case if the script is not executable, it fails. --- .buildkite/commands/release-build-jetpack.sh | 0 .buildkite/commands/release-build-wordpress-internal.sh | 0 .buildkite/commands/release-build-wordpress.sh | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .buildkite/commands/release-build-jetpack.sh mode change 100644 => 100755 .buildkite/commands/release-build-wordpress-internal.sh mode change 100644 => 100755 .buildkite/commands/release-build-wordpress.sh diff --git a/.buildkite/commands/release-build-jetpack.sh b/.buildkite/commands/release-build-jetpack.sh old mode 100644 new mode 100755 diff --git a/.buildkite/commands/release-build-wordpress-internal.sh b/.buildkite/commands/release-build-wordpress-internal.sh old mode 100644 new mode 100755 diff --git a/.buildkite/commands/release-build-wordpress.sh b/.buildkite/commands/release-build-wordpress.sh old mode 100644 new mode 100755