-
Notifications
You must be signed in to change notification settings - Fork 47
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 support for pending merge refs #208
Conversation
@@ -67,24 +62,3 @@ func (c checkoutPRDiffFile) do(gitCmd git.Git, fetchOptions fetchOptions, fallba | |||
func (c checkoutPRDiffFile) getBuildTriggerRef() string { | |||
return "" | |||
} | |||
|
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.
Moved to bitriseapi
package
@@ -374,6 +374,7 @@ workflows: | |||
envman add --key TEST_DIFF_REPO_URL --value ${GIT_DIR} | |||
envman add --key TEST_DIFF_PR_REPOSITORY_URL --value ${PR_GIT_DIR} | |||
envman add --key BITRISE_BUILD_URL --value "file://${DIFF_DIR}" | |||
envman add --key BITRISE_BUILD_API_TOKEN --value "dummy token" |
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.
BITRISE_BUILD_URL
and BITRISE_BUILD_API_TOKEN
should both be defined or none of them
@@ -1,4 +1,4 @@ | |||
package gitclone | |||
package tracker |
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 had to move this to its own subpackage because I introduced an import cycle (by using the tracker not only in gitclone
, but in gitclone/bitriseapi
too)
PRHeadBranch string | ||
|
||
ResetRepository bool | ||
BuildURL string | ||
BuildAPIToken string |
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.
These are no longer needed here in the Config
struct because we have instances of bitriseapi.PatchSource
and bitriseapi.MergeRefChecker
that contain these params.
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 like it so far
} | ||
|
||
func (s apiPatchSource) GetPRPatch() (string, error) { | ||
if s.buildURL == "" { |
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.
Same as above shouldn't we do the validation in the constructor?
Checklist
step.yml
andREADME.md
is updated with the changes (if needed)Version
Requires a MAJOR/MINOR/PATCH version update
Context
Related webhook processor PR: bitrise-io/bitrise-webhooks#128
This PR adds support for handling pending merge refs, which need to be verified before using for the checkout.
Changes
pull_request_unverified_merge_branch
. This is automatically filled by the environment just likepull_request_merge_branch
.MergeRefChecker
that polls the Bitrise API a few times, which in turn asks/triggers the git provider to refresh the merge ref. If the merge ref is up-to-date, we use it for checkouts just like before. If the checker times out, or there is an error, we use the usual fallback checkout methods (most of the time it's fetching the PR source and destination branch and doing the merge manually)bitriseapi
package for Bitrise API specific stuff, such as this new merge ref checker and the PR patch file downloader.Investigation details
Decisions