- Notifications
You must be signed in to change notification settings - Fork675
feat: Add support for Protected Environments#2084
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
calve commentedJun 21, 2022
more specically, I guess all crud operation are inherited from the CRUD mixin but we should ideally implement |
codecov-commenter commentedJun 21, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## main #2084 +/- ##==========================================+ Coverage 85.62% 94.64% +9.02%========================================== Files 78 78 Lines 5007 5020 +13 ==========================================+ Hits 4287 4751 +464+ Misses 720 269 -451
Flags with carried forward coverage won't be shown.Click here to find out more.
|
JohnVillalovos left a comment
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.
Thanks for the PR!
Overall looks good. In addition to the one thing I mentioned, would also be good to create a unit test for this.
Uh oh!
There was an error while loading.Please reload this page.
5ca5390 to28a689cComparenejch commentedJun 22, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
To answer your question:
BTW: There is also a group-level protected environments endpoint:https://docs.gitlab.com/ee/api/group_protected_environments.html Edit: ah, looking at your PR now, we're actually fine - create/delete from CRUDMixin already cover protecting and unprotecting the environment. But we should maybe document that I'll also add a note in the docs for our protected branches/tags that create/delete does protect/unprotect. |
Uh oh!
There was an error while loading.Please reload this page.
nejch commentedJun 22, 2022
Thanks for the great PR and quick rework@calve. It'd be cool if you could add a tiny bit of docs for this (see protected branches) if you have the time & energy as well :) |
calve commentedJun 22, 2022
Thanks both of you for the quick review.
I'm inclined to let the implementation to a future reader ?
And globally on the create/delete/protect/unprotect behavior, I have to say I did not have those usages right now and so haven't actually tested anything related to other operation than list/get. I just realised the documentation isn't autogenerated as I initially thought, I'm going to amend the commit to add a specific pages. |
nejch commentedJun 22, 2022
Thanks for the quick reply@calve. We auto-generate the API reference but add some prose docs with examples usually, as some people find that easier to grok. Sounds good, the rest can be a follow-up :) |
calve commentedJun 22, 2022
I amended the commit to
please let me know for any other changes or information :) |
aa19c34 to01abc64Comparenejch commentedJun 22, 2022
Thanks! Just a few more typos/nitpicks from me, then we should be good to go. Our handling of IDs is a bit different from how GitLab documents them, because we create objects to manipulate, so I've added some comments. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
calve commentedJun 22, 2022
Updated with your suggestions, thanks for the review. for reference here are my manual tests In [12]:p.protected_environments.create({"name":"testenv","deploy_access_levels": [{"access_level":40}]})Out[12]:<ProjectProtectedEnvironmentname:testenv>In [13]:print(p.protected_environments.get("testenv"))<class'gitlab.v4.objects.environments.ProjectProtectedEnvironment'>=> {'name':'testenv','deploy_access_levels': [{'access_level':40,'access_level_description':'Maintainers','user_id':None,'group_id':None,'group_inheritance_type':0}],'required_approval_count':0,'approval_rules': []}In [14]:print(p.protected_environments.list()[0])<class'gitlab.v4.objects.environments.ProjectProtectedEnvironment'>=> {'name':'testenv','deploy_access_levels': [{'access_level':40,'access_level_description':'Maintainers','user_id':None,'group_id':None,'group_inheritance_type':0}],'required_approval_count':0,'approval_rules': []}In [15]:print(p.protected_environments.list()[0].delete())NoneIn [16]:print(p.protected_environments.get("testenv")) |
-https://docs.gitlab.com/ee/api/protected_environments.html-python-gitlab#1130no write operation are implemented yet as I have no use case right nowand am not sure how it should be done
nejch commentedJun 22, 2022
Thanks for the super quick reactions@calve. LGTM now, this should make it into the next scheduled release on the 28th. |
calve commentedJun 23, 2022
Thanks for your time, the super review and velocity 🤝 |
no write operation are implemented yet as I have no use case right now
and am not sure how it should be done