-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add WordPress and Jetpack Installable Builds #16642
Changes from 4 commits
48ef7a3
0a2328e
0fcb217
b75c98c
7e3abb5
144ff03
2f15ba1
02089a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash -eu | ||
|
||
echo "--- :rubygems: Setting up Gems" | ||
install_gems | ||
|
||
echo "--- :closed_lock_with_key: Installing Secrets" | ||
bundle exec fastlane run configure_apply | ||
|
||
echo "--- :hammer_and_wrench: Building" | ||
bundle exec fastlane build_and_upload_jetpack_installable_build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash -eu | ||
|
||
echo "--- :rubygems: Setting up Gems" | ||
install_gems | ||
|
||
echo "--- :closed_lock_with_key: Installing Secrets" | ||
bundle exec fastlane run configure_apply | ||
|
||
echo "--- :hammer_and_wrench: Building" | ||
bundle exec fastlane build_and_upload_wordpress_installable_build |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ group :screenshots, optional: true do | |
gem 'rmagick', '~> 4.1' | ||
end | ||
|
||
gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit.git', branch: 'trunk' | ||
# gem 'fastlane-plugin-wpmreleasetoolkit', '~> 4.1' | ||
#gem 'fastlane-plugin-wpmreleasetoolkit', git: 'git@github.com:wordpress-mobile/release-toolkit.git', branch: 'trunk' | ||
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 4.1' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm afraid this was an intentional breakage of our convention of always pointing to a stable release of We haven't shipped a new version of the toolkit since merging the GlotPress 429 workaround. See the current Although, thinking about it... It's conceivable that we'll have a new release out before the next beta (as we don't need to download from GlotPress during code freeze, and the release branch "correctly" points to (I'm leaving a comment about making a release instead of doing it myself because I'm at EOD and I don't want to start something else at this point) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed by releasing release-toolkit See 7e3abb5 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,6 +203,50 @@ | |
end | ||
end | ||
|
||
##################################################################################### | ||
# build_and_upload_installable_build | ||
# ----------------------------------------------------------------------------------- | ||
# Build a WordPress Installable Build and make it available for download | ||
# ----------------------------------------------------------------------------------- | ||
# Usage: | ||
# bundle exec fastlane build_and_upload_installable_build | ||
##################################################################################### | ||
desc "Build an Installable Build and make it available for download" | ||
lane :build_and_upload_wordpress_installable_build do | options | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I took the liberty to address those myself in 144ff03 |
||
|
||
UI.user_error!("'BUILDKITE_ARTIFACTS_S3_BUCKET' must be defined as an environment variable.") unless ENV['BUILDKITE_ARTIFACTS_S3_BUCKET'] | ||
|
||
gradle( | ||
task: "assemble", | ||
flavor: "WordPressJalapeno", | ||
build_type: "Debug" | ||
) | ||
|
||
upload_installable_build(product: 'WordPress') | ||
end | ||
|
||
##################################################################################### | ||
# build_and_upload_jetpack_installable_build | ||
# ----------------------------------------------------------------------------------- | ||
# Build a Jetpack Installable Build and make it available for download | ||
# ----------------------------------------------------------------------------------- | ||
# Usage: | ||
# bundle exec fastlane build_and_upload_installable_build | ||
##################################################################################### | ||
desc "Build an Installable Build and make it available for download" | ||
lane :build_and_upload_jetpack_installable_build do | options | | ||
|
||
UI.user_error!("'BUILDKITE_ARTIFACTS_S3_BUCKET' must be defined as an environment variable.") unless ENV['BUILDKITE_ARTIFACTS_S3_BUCKET'] | ||
|
||
gradle( | ||
task: "assemble", | ||
flavor: "JetpackJalapeno", | ||
build_type: "Debug" | ||
) | ||
|
||
upload_installable_build(product: 'Jetpack') | ||
end | ||
|
||
##################################################################################### | ||
# build_bundle | ||
# ----------------------------------------------------------------------------------- | ||
|
@@ -262,4 +306,44 @@ | |
end | ||
"#{build_dir}#{name}" | ||
end | ||
|
||
def upload_installable_build(product:) | ||
|
||
filename = "#{product.downcase}-installable-build-#{generate_installable_build_number}.apk" | ||
|
||
upload_path = upload_to_s3( | ||
bucket: 'a8c-apps-public-artifacts', | ||
key: filename, | ||
file: lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] | ||
) | ||
|
||
install_url = "#{INSTALLABLE_BUILD_DOMAIN}/#{upload_path}" | ||
qr_code_url = "https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl=#{URI::encode( install_url )}&choe=UTF-8" | ||
comment_body = "You can test the #{product} changes on this Pull Request by <a href='#{install_url}'>downloading an installable build (#{filename})</a>, or scanning this QR code:<br><a href='#{install_url}'><img src='#{qr_code_url}' width='250' height='250' /></a>" | ||
|
||
comment_on_pr( | ||
project: GHHELPER_REPO, | ||
pr_number: Integer(ENV['BUILDKITE_PULL_REQUEST']), | ||
reuse_identifier: "#{product.downcase}-installable-build-link", | ||
body: comment_body | ||
) unless ENV['BUILDKITE_PULL_REQUEST'].nil? | ||
end | ||
|
||
# This function is Buildkite-specific | ||
def generate_installable_build_number | ||
|
||
if ENV['BUILDKITE'] | ||
commit = ENV['BUILDKITE_COMMIT'][0,7] | ||
branch = ENV['BUILDKITE_BRANCH'].parameterize | ||
pr_num = ENV['BUILDKITE_PULL_REQUEST'] | ||
|
||
return pr_num == 'false' ? "#{branch}-#{commit}" : "pr#{pr_num}-#{commit}" | ||
else | ||
repo = Git.open(PROJECT_ROOT_FOLDER) | ||
commit = repo.current_branch.parameterize | ||
branch = repo.revparse('HEAD')[0, 7] | ||
|
||
return "#{branch}-#{commit}" | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a legacy from previous iterations? Or is there something special about this that relates with the installable builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good question – it's a legacy-ish setup. The "best practice" is to define this in the Buildkite configuration so it doesn't need to be repeated over and over in the config. That said, I can see an argument for being safer. For now, it aligns with the other projects and we can revisit it later, if needed? 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see the argument for being safer, too, but I think it's not as strong as the one for defining our steps in such a way that they can all run on the default kind of agent for the pipeline, and only specify a custom
queue
for those which do something special.