-
Notifications
You must be signed in to change notification settings - Fork 120
Add Buildkite step to optionally trigger FAD build on trunk
#16432
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
Conversation
| key: prototype_triggered | ||
| - label: Prototype Build | ||
| depends: prototype_triggered | ||
| command: .buildkite/commands/prototype-build.sh |
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 considered splitting build from upload as part of this PR, but decided to save it log it as a nice to have for a future date instead.
Doing so would have required updating the existing prototype build step and I didn't want to grow the scope.
| plugins: [$CI_TOOLKIT] | ||
| notify: | ||
| - github_commit_status: | ||
| context: Prototype Build From Trunk |
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.
Notice the different name for the check, just in case the same commit already run from a PR (impossible with merge commits and squashes, but one never knows... rebase and merge? cherry pick and force push bypassing checks?) and also to keep things tidy.
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 wonder if it actually makes sense to have this notify at all. Given this step will only run on trunk, and not on PRs—while the github_commit_status are mostly (only?) used to report the status of CI steps on GitHub PRs' UI, right?
So maybe we might as well remove that notify attribute altogether on that one?
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 think there's marginal value in keeping this. GitHub shows the commit checks outside PRs, too.
Here's from example in the repo's landing page:
If clicked, it shows:
It might be useful at some point to have the check -> CI job link accessible this way.
But... I don't feel strongly about it. Happy to delete if this doesn't sound like a strong enough reason.
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.
Ah good point, completely forgot about that UI in GitHub to show checks on any commit even outside PRs 👍
fastlane/Fastfile
Outdated
| release_notes = <<~NOTES | ||
| Pull Request: ##{pull_request_number || 'N/A'} | ||
| Branch: `#{ENV.fetch('BUILDKITE_BRANCH', 'N/A')}` | ||
| Commit: #{ENV.fetch('BUILDKITE_COMMIT', 'N/A')[0...7]} | ||
| NOTES | ||
| release_notes += "Pull Request: ##{PULL_REQUEST_NUMBER}" unless PULL_REQUEST_NUMBER.nil? |
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.
Let me know what you think, but if we have builds from trunk which definitely won't have a PR, it would seem noisy to read "Pull Request: N/A" in the release notes, especially at the top.
fastlane/Fastfile
Outdated
| pr_num == 'false' ? nil : Integer(pr_num) | ||
| end | ||
| # Buildkite sets this env var to the PR number if on a PR, but to 'false' (and not nil) if not on a PR | ||
| PULL_REQUEST_NUMBER = ENV['BUILDKITE_PULL_REQUEST']&.then { |n| n == 'false' ? nil : Integer(n) } |
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.
A micro-optimization for sure, but it seemed unnecessary to read a constant value from the env a number of times when we could have stored it in a Ruby constant.
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 am on two minds about this tbh.
I see your point of not recomputing the value multiple times, but OTOH, making it a constant (in the strict sense of the term, i.e. with all-uppercase syntax and all) feels a bit wrong to me conceptually, because it's not a value that is fixed and never changing across all runs (like e.g. FIREBASE_APP_ID or IOS_LOCALES or SIMULATOR_VERSION are), but instead something that will have a different value depending on the PR. I think that's the main rationale as to why that was exposed as a helper function rather than a Ruby constant in the first place.
My two cents:
- Either rename the variable to lowercase (
pull_request_number = …)—to not technically make it a Ruby constant. Then move its declaration to the top of the Fastfile. - Or keep it as a
def pull_request_numberhelper, but add memoization to avoid recomputing the value (not worth it imho)
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.
Fair point.
@copilot address this comment by renaming PULL_REQUEST_NUMBER to pull_request_number
46780f7 to
52f78e1
Compare
No need to read every time
52f78e1 to
0a28f5e
Compare
|
|
fastlane/Fastfile
Outdated
| Branch: `#{ENV.fetch('BUILDKITE_BRANCH', 'N/A')}` | ||
| Commit: #{ENV.fetch('BUILDKITE_COMMIT', 'N/A')[0...7]} | ||
| NOTES | ||
| release_notes += "Pull Request: ##{PULL_REQUEST_NUMBER}" unless PULL_REQUEST_NUMBER.nil? |
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.
Should there be a newline there?
| release_notes += "Pull Request: ##{PULL_REQUEST_NUMBER}" unless PULL_REQUEST_NUMBER.nil? | |
| release_notes += "\nPull Request: ##{PULL_REQUEST_NUMBER}" unless PULL_REQUEST_NUMBER.nil? |
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.
Tested this quickly in irb, and seems the heredoc syntax already includes a trailing \n:

So no need for an extra one at the start there (but one could argue we might need one at the end, for consistency of always ending the release_notes string with a newline?)
| release_notes += "Pull Request: ##{PULL_REQUEST_NUMBER}" unless PULL_REQUEST_NUMBER.nil? | |
| release_notes += "Pull Request: ##{PULL_REQUEST_NUMBER}\n" unless PULL_REQUEST_NUMBER.nil? |
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.
but one could argue we might need one at the end, for consistency of always ending the
release_notesstring with a newline?
It wouldn't hurt, but for what is worth, not having the new line does not affect how Firebase renders the release notes. They look the same with (via old version using one heredoc) or without (via this branch's implementation)
| plugins: [$CI_TOOLKIT] | ||
| notify: | ||
| - github_commit_status: | ||
| context: Prototype Build From Trunk |
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 wonder if it actually makes sense to have this notify at all. Given this step will only run on trunk, and not on PRs—while the github_commit_status are mostly (only?) used to report the status of CI steps on GitHub PRs' UI, right?
So maybe we might as well remove that notify attribute altogether on that one?
fastlane/Fastfile
Outdated
| pr_num == 'false' ? nil : Integer(pr_num) | ||
| end | ||
| # Buildkite sets this env var to the PR number if on a PR, but to 'false' (and not nil) if not on a PR | ||
| PULL_REQUEST_NUMBER = ENV['BUILDKITE_PULL_REQUEST']&.then { |n| n == 'false' ? nil : Integer(n) } |
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 am on two minds about this tbh.
I see your point of not recomputing the value multiple times, but OTOH, making it a constant (in the strict sense of the term, i.e. with all-uppercase syntax and all) feels a bit wrong to me conceptually, because it's not a value that is fixed and never changing across all runs (like e.g. FIREBASE_APP_ID or IOS_LOCALES or SIMULATOR_VERSION are), but instead something that will have a different value depending on the PR. I think that's the main rationale as to why that was exposed as a helper function rather than a Ruby constant in the first place.
My two cents:
- Either rename the variable to lowercase (
pull_request_number = …)—to not technically make it a Ruby constant. Then move its declaration to the top of the Fastfile. - Or keep it as a
def pull_request_numberhelper, but add memoization to avoid recomputing the value (not worth it imho)
Co-authored-by: Olivier Halligon <[email protected]>
Co-authored-by: mokagio <[email protected]>
Co-authored-by: mokagio <[email protected]>
|
@AliSoftware @twstokes I should have implemented or commented on all your feedback. Thanks. |

Closes AINFRA-1614.
Description
Similar to woocommerce/woocommerce-android#15027, this PR adds an optional step that will appear on CI builds from
trunkto deploy to Firebase App Distribution.Test Steps
Given the step will appear only on
trunkwe can only test once this is merged... However, you can see an hacked version here #16431Screenshots
fad.mov
RELEASE-NOTES.txtif necessary. - N.A.