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

support default_branch_protection on group #706

Conversation

domcyrus
Copy link
Contributor

Support using default_branch_protection on group. This is implementing one part of #667

It will need a newer dependency of the "github.com/xanzy/go-gitlab" package. Currently only using github.com/xanzy/[email protected] (master) as the change of the needed default_branch_protection on group is only in master.

@domcyrus
Copy link
Contributor Author

domcyrus commented Sep 7, 2021

I've updated the PR to use go-gitlab 0.50.4 which does what #713 also tries but including the needed api changes.

@domcyrus domcyrus force-pushed the support_default_branch_protection_on_group branch from 62d2771 to 93e86d7 Compare September 7, 2021 08:08
@domcyrus
Copy link
Contributor Author

domcyrus commented Sep 7, 2021

Updated PR all tests run successfully.

@switchboardOp
Copy link

I'd love to see this merged now that the upstream dependency is released. Default branch protection is causing some issues for me. I was halfway through my own implementation when I found this PR. looks good @domcyrus!

@willianpaixao
Copy link
Collaborator

@domcyrus would you mind updating the documentation of the underlying resources as well?

@domcyrus domcyrus force-pushed the support_default_branch_protection_on_group branch from 49e81d1 to 6fde931 Compare September 9, 2021 11:23
@domcyrus
Copy link
Contributor Author

domcyrus commented Sep 9, 2021

@willianpaixao I added the missing documentation and also added unit tests.

@domcyrus
Copy link
Contributor Author

Is there anything else needed?

@willianpaixao
Copy link
Collaborator

@domcyrus thanks! LGTM.

@mkjmdski
Copy link
Contributor

Hi @domcyrus. The newest go-gitlab is already in master you should take it's go mod files and this branch should be good to go.

@domcyrus
Copy link
Contributor Author

@mkjmdski updated with upstream master.

@mkjmdski
Copy link
Contributor

@roidelapluie could you please enable pipeline in here?

@roidelapluie roidelapluie merged commit 42a38e4 into gitlabhq:master Sep 28, 2021
@roidelapluie
Copy link
Collaborator

Thanks!

@QuingKhaos
Copy link
Contributor

As a note: it could have supported string values like visibility_level which are translated internally to the int access levels to be consistent..

@roidelapluie
Copy link
Collaborator

thanks for your feedback, but I do not understand it. visibility_level is never translated to an int.

@roidelapluie
Copy link
Collaborator

terraform-provider-gitlab $ ack PrivateVisibility
gitlab/util_test.go
46:                     Level:  gitlab.PrivateVisibility,

gitlab/util.go
80:             "private":  gitlab.PrivateVisibility,

vendor/github.com/xanzy/go-gitlab/types.go
488:    PrivateVisibility  VisibilityValue = "private"

@roidelapluie
Copy link
Collaborator

I think I now understand what you mean. In terraform, the best practice is to stick to the remote API as close as possible. If the gitlab API asks for an integer, I think we should not invent our own values.

@QuingKhaos
Copy link
Contributor

QuingKhaos commented Nov 23, 2021

In terraform, the best practice is to stick to the remote API as close as possible.
I may agree.

If the gitlab API asks for an integer, I think we should not invent our own values.

It's already done with the access control level values (maintainer instead of 40) - sorry, confused them with the visibility level. Maybe not directly in the provider, but through the Go SDK. In this case I would prefer consistency with the other values and don't have to guess what does that random number mean in the terraform manifests :)

johannges pushed a commit to johannges/terraform-provider-gitlab that referenced this pull request Dec 16, 2021
* support default_branch_protection on group

Co-authored-by: Marco Cadetg <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants