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 support for Merge queue on github. #1481

Open
1 task done
bhargavms opened this issue Jan 12, 2023 · 33 comments · May be fixed by #2380
Open
1 task done

[FEAT]: Add support for Merge queue on github. #1481

bhargavms opened this issue Jan 12, 2023 · 33 comments · May be fixed by #2380
Labels
Status: Blocked Some technical or requirement is blocking the issue Type: Feature New feature or request

Comments

@bhargavms
Copy link

Describe the need

Github has come up with this new feature called merge queues I don't see any configuration support for this from the terraform provider. Please add this into the terraform provider for github.

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@bhargavms bhargavms added Status: Triage This is being looked at and prioritized Type: Feature New feature or request labels Jan 12, 2023
@nickfloyd nickfloyd added the Status: Up for grabs Issues that are ready to be worked on by anyone label Jan 12, 2023
@nickfloyd nickfloyd moved this from 🆕 Triage to 🔖 Ready in 🧰 Octokit Active Jan 12, 2023
@nickfloyd nickfloyd moved this from 🔖 Ready to 🔥 Backlog in 🧰 Octokit Active Jan 12, 2023
@kfcampbell
Copy link
Member

@bhargavms is there an associated API you could link?

@zepeng811
Copy link
Contributor

merge queue is now in public beta, it would be great if our provider can support this feature.

@morremeyer
Copy link
Contributor

The API documentation does not contain any information about merge queues yet: https://docs.github.com/en/rest/branches/branch-protection?apiVersion=2022-11-28#update-branch-protection
However, the go module seems to have some form of support? https://github.com/google/go-github/blob/ab8b241add175a45ea24db294e035f2580e55853/github/repos.go#L881

@dzmitry-lahoda
Copy link

I do not see parameters in Go code to fine tune queue, only to enable kind of. If that works, I am fully happy with default parameters it sets to queue. It is already works little better than Mergify and we switched. Will donate equivalent of 42 USD in crypto for feature which enable/disable queue.

@nikwotton
Copy link
Contributor

Merge queue is now officially released, though I don't see an update to the API documentation yet unfortunately.

@kfcampbell kfcampbell added Priority: Normal Status: Blocked Some technical or requirement is blocking the issue and removed Status: Up for grabs Issues that are ready to be worked on by anyone Status: Triage This is being looked at and prioritized labels Jul 13, 2023
@StephenWithPH
Copy link

I think this is the API doc to watch for the non v3 / non REST Terraform resource: https://docs.github.com/en/graphql/reference/objects#branchprotectionrule , assuming that merge queue is indeed a feature of branch protection per https://github.blog/2023-07-12-github-merge-queue-is-generally-available/ .

github/roadmap#370 does not have any commentary about GraphQL changes.

https://docs.github.com/en/graphql/overview/changelog shows that there were some API changes regarding merge queues, but nothing on the branch protection resource.

@StephenWithPH
Copy link

@kfcampbell ... do you have internal visibility regarding upcoming GraphQL changes that would enable terraforming this?

@reedloden
Copy link
Contributor

https://docs.github.com/en/graphql/reference/objects#mergequeueconfiguration seems like it would be where such configuration would go, but I'm not seeing it listed under https://docs.github.com/en/graphql/reference/objects#branchprotectionrule yet. However, this is still probably enough to get a rough draft of the code written.

@kfcampbell
Copy link
Member

do you have internal visibility regarding upcoming GraphQL changes that would enable terraforming this?

I don't, sorry. A good way to request changes is by starting a discussion here.

@morremeyer
Copy link
Contributor

This is already tracked in https://github.com/orgs/community/discussions/50893.

I've also contacted our account rep since we're a GitHub customer. I'll keep you all updated if I get to know anything.

@kfcampbell
Copy link
Member

@morremeyer thank you for doing that!

@jstuart-ut
Copy link

jstuart-ut commented Aug 4, 2023

@morremeyer any word on the outlook for this config update ?

We're looking to make some selective use of 'merge queue' as well, would love to see it surfaced (and captured) as a top-level configuration option for repos, if possible 😁

@morremeyer
Copy link
Contributor

Nothing yet, I'll update here as soon as I know more.

@mering
Copy link

mering commented Aug 7, 2023

GitHub has GraphQL support planned (but no REST support). I guess this would be sufficient as other parts are already using the GraphQL API via https://github.com/shurcooL/githubv4?

@fitz-res
Copy link

fitz-res commented Aug 8, 2023

@mering what roadmap issue are you referring to?

@mering
Copy link

mering commented Aug 8, 2023

@fitz-res our GitHub account rep told me. Unfortunately nothing public to follow and no ETA yet.

@scruplelesswizard
Copy link

scruplelesswizard commented Aug 24, 2023

Looks like Github has exposed the relevant resources on the GraphQL API now:
MergeQueue
MergeQueueConfiguration
MergeQueueEntry
MergeQueueEntryConnection
MergeQueueEntryEdge
AddedToMergeQueuEvent
RemovedFromMergeQueueEvent

@kfcampbell
Copy link
Member

That's awesome news! Pull requests are very welcome for this feature.

@zhpeng811
Copy link

I'm trying to implement this feature for the provider since above comment mentioned the merge queue resources was added to the GraphQL API, but came to a realization that the CreateBranchProtectionRuleInput and UpdateBranchProtectionRuleInput input objects currently does not support merge queue configurations.

Raised a product feedback to the community at: https://github.com/orgs/community/discussions/77614
Would appreciate some upvotes to increase the awareness

@siddharthab
Copy link

@zhpeng811 At least Repository Rulesets now support merge queues (through, e.g. UpdateRepositoryRulesetInput -> RepositoryRuleInput -> RepositoryRuleType).

It seems like rulesets are being encouraged over branch protection in general. Might it make sense to only target rulesets for supporting merge queues?

Also, note the following bugs (possibly related) currently crash Terraform if we enable merge queues outside of Terraform and then continue to use Terraform.

google/go-github#3098
#2192

@zhpeng811
Copy link

zhpeng811 commented Mar 12, 2024

@siddharthab thanks for the reply (and finding the go-github bug)!

Indeed it seems like RepositoryRuleType supports merge queue as a type, but seems like RuleParametersInput don't have merge queue supported as an input. So we might be able to simply enable/disable merge queue with that but unable to change any configurations (I did not test it out so don't take my word for it), but still only for the ruleset.

Ruleset is a fairly new concept in GitHub, on GitHub's documentation page it mentioned Rulesets work alongside any branch protection rules and tag protection rules in a repository. so I think it's worth a try (pending the issue mentioned above is resolved) while we are still waiting for GitHub to generally support merge queue in both their REST and GraphQL APIs

@zepeng811
Copy link
Contributor

attaching a GitHub blog for configuring merge queue with ruleset (in public beta): https://github.blog/changelog/2024-02-27-repository-rules-configure-merge-queue-rule-public-beta/

they stated this limitation:

The merge queue rule cannot be configured via an API. This feature will be available in the near future.

cmur2 added a commit to camunda/camunda that referenced this issue Jun 7, 2024
Does not work for merge queue settings due to missing GitHub API support, see
integrations/terraform-provider-github#1481
@zepeng811
Copy link
Contributor

some updates as I've been following closely on GitHub's API updates:

repository rulesets - graphQL API have provided support for enabling/disabling merge queue: https://docs.github.com/en/graphql/reference/enums#repositoryruletype (search MERGE_QUEUE in RepositoryRuleType), but currently does not support different merge queue configurations.

repository rulesets - REST API currently still have no support for merge queue: https://docs.github.com/en/rest/repos/rules?apiVersion=2022-11-28#create-a-repository-ruleset

(REST API is currently what we use for this provider: https://github.com/integrations/terraform-provider-github/blob/main/github/resource_github_repository_ruleset.go)

@zhpeng811
Copy link

some updates as I've been following closely on GitHub's API updates:

repository rulesets - graphQL API have provided support for enabling/disabling merge queue: https://docs.github.com/en/graphql/reference/enums#repositoryruletype (search MERGE_QUEUE in RepositoryRuleType), but currently does not support different merge queue configurations.

repository rulesets - REST API currently still have no support for merge queue: https://docs.github.com/en/rest/repos/rules?apiVersion=2022-11-28#create-a-repository-ruleset

(REST API is currently what we use for this provider: https://github.com/integrations/terraform-provider-github/blob/main/github/resource_github_repository_ruleset.go)

as of Aug 5, looks like merge queue support have been added to REST API with full parameter support.
image

@icep87
Copy link

icep87 commented Sep 4, 2024

@zhpeng811 will somebody start working on this now?

@zepeng811
Copy link
Contributor

zepeng811 commented Sep 4, 2024

@icep87 I will look into the implementation soon, but this issue still considered blocked until google/go-github releases the next major version (v65) which includes the changes from google/go-github#3253

@MXfive MXfive linked a pull request Sep 6, 2024 that will close this issue
4 tasks
@MXfive
Copy link

MXfive commented Sep 6, 2024

@zepeng811 I already pulled go-github@master to get this working early for our own use, opened a PR here that I'll rebase once the SDK gets released. LMK if any other changes would be needed in addition to the rebase.

@zepeng811
Copy link
Contributor

thanks @MXfive for getting this started, I added some early comments to your PR based from what I currently have locally. Happy to discuss this further.

@MXfive
Copy link

MXfive commented Sep 8, 2024

thanks @MXfive for getting this started, I added some early comments to your PR based from what I currently have locally. Happy to discuss this further.

Addressed your comments @zepeng811, should be good to mark for review once the SDK is released now hopefully.

@zepeng811
Copy link
Contributor

zepeng811 commented Sep 16, 2024

https://github.com/google/go-github/releases/tag/v65.0.0 was released today, will put up a PR to start the upgrade process.

coordinating with the assignee of the existing upgrade for v63 -> v64 in #2358 for the upgrade.

@MXfive
Copy link

MXfive commented Sep 17, 2024

google/go-github@v65.0.0 (release) was released today, will put up a PR to start the upgrade process.

coordinating with the assignee of the existing upgrade for v63 -> v64 in #2358 for the upgrade.

Already rebased mine with v65 to check, all looks good. Will do again once #2358 merges.

@icep87
Copy link

icep87 commented Oct 16, 2024

@zepeng811 & @MXfive #2358 has been merge now. Can you continue with rebase and maybe this can get merge soon.

@zepeng811
Copy link
Contributor

still pending review from the maintainers on #2380 to close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Blocked Some technical or requirement is blocking the issue Type: Feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.