Skip to content
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

feat: add merge group handler in support of github merge queues #554

Merged
merged 8 commits into from
Mar 27, 2023

Conversation

devinburnette
Copy link
Contributor

Closes #548

Adds support for github merge queues by unconditionally posting a successful status check on the merge group branch when policy bot sees a merge_group github webhook event.

Worked together with @btrautmann to get this done. Let us know if something like this is what you had in mind as a solution for this.

Config: fetchedConfig,
}

_, err = evalCtx.ParseConfig(ctx, common.TriggerStatic)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

might have to make a new method for validating the policy since ParseConfig doesn't return an evaluator for static trigger, so as written this will post a status even if there's no policy file, and i don't think that's what we want

Copy link
Member

Choose a reason for hiding this comment

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

We might not need to parse the configuration at all. I think it would be enough to only check fetchedConfig to determine if a policy file exists, since the main goal is to not post status checks in repositories that don't enable Policy Bot. If a PR is added to the merge queue, presumably the policy existed and was valid at the time of merge, so I think it could actually be confusing if the policy was changed to be invalid while the PR was in the queue and it led to a failed status.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, sounds good to me, will make that change

Copy link
Member

@bluekeyes bluekeyes left a comment

Choose a reason for hiding this comment

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

Thanks for adding this, the implementation looks good to me as a starting point. I imagine we might need to make adjustments as people gain experience with merge queues, but this should be a safe way to unblock testing. One minor code issue and then this should be good to merge.

Comment on lines 51 to 57
if err != nil {
return err
}

if err != nil {
return errors.Wrap(err, "failed to create evaluation context")
}
Copy link
Member

Choose a reason for hiding this comment

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

Looks like there's a double error check here

Copy link
Member

@bluekeyes bluekeyes left a comment

Choose a reason for hiding this comment

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

Thanks!

@bluekeyes bluekeyes merged commit b9ea8a5 into palantir:develop Mar 27, 2023
@devinburnette devinburnette deleted the merge-queue-support branch March 27, 2023 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Merge queue compatibility
2 participants