Skip to content

Allow for discriminating between beta and stable when building releases on Buildkite #17893

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

Merged
merged 8 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .buildkite/commands/release-build-jetpack.sh
100644 → 100755
Empty file.
Empty file modified .buildkite/commands/release-build-wordpress-internal.sh
100644 → 100755
Empty file.
5 changes: 4 additions & 1 deletion .buildkite/commands/release-build-wordpress.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ 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 \
beta_release:${1:-true} # use first call param, default to true for safety
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 alternative could be to make $1 required and check for it at the start of the script.

This seemed more concise, and I didn't feel we needed refined input validation given these scripts are only meant to run via CI.

2 changes: 1 addition & 1 deletion .buildkite/release-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
39 changes: 24 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
65 changes: 12 additions & 53 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -467,47 +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:<skip confirm>]
# [create_gh_release:<create release on GH>]
#
# 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
# -----------------------------------------------------------------------------------
# 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:<skip confirm>]
# [create_gh_release:<create release on GH>]
#
# 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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These above were just unused lanes from the CircleCI implementation that I noticed while looking around the file.

#####################################################################################
# build_and_upload_app_store_connect
# -----------------------------------------------------------------------------------
Expand Down Expand Up @@ -817,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], beta: true)
end

#####################################################################################
Expand All @@ -835,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], beta: false)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also considered ditching the two lanes for a single one with a beta parameter. I decided to keep them because it can happen to have to start one such build from the terminal and in that case it's handy to have dedicated lanes and tab complete between the two.

end

########################################################################
Expand Down Expand Up @@ -1019,6 +968,16 @@ def generate_installable_build_number
end
end

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

# Application-agnostic settings for the `upload_to_app_store` action, also
# known as `deliver`.
UPLOAD_TO_APP_STORE_COMMON_PARAMS = {
Expand Down
4 changes: 2 additions & 2 deletions fastlane/Pluginfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Comment on lines -10 to +11
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before merging this (or #17891) we ought to ship a new version of the release toolkit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

v3.0.0 (wordpress-mobile/release-toolkit#334) is almost ready to go

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's land this, then update #17891 to use the new version of the toolkit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SGTM 👍


gem 'fastlane-plugin-sentry'
gem 'fastlane-plugin-appcenter', '~> 1.8'