Update and fix variable _create_attrs and _update_attrs#3379
Update and fix variable _create_attrs and _update_attrs#3379JohnVillalovos merged 5 commits intopython-gitlab:mainfrom
Conversation
|
I tried running the suite of functional tests but was unable to. I got the docker containers up but they were so unstable that even adding I was able to run the variable tests against a live gitlab instance to demonstrate to myself the tests failed before my changes and passed after. |
f968e2c to
0659a92
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3379 +/- ##
=======================================
Coverage 95.75% 95.75%
=======================================
Files 100 100
Lines 6125 6125
=======================================
Hits 5865 5865
Misses 260 260
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
fix(api): make 'value' an optional variable update attr
0659a92 to
7f31242
Compare
There was a problem hiding this comment.
Pull request overview
Adjusts CI/CD variable attribute handling to support updating “masked and hidden” variables when the API doesn’t return their value, and adds functional coverage for hidden variables.
Changes:
- Make
valueoptional for variable updates by changing_update_attrsto require onlykey. - Allow
masked_and_hiddenduring variable creation across instance/group/project managers. - Add functional tests for creating and updating hidden variables; ignore
.mypy_cache/.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
gitlab/v4/objects/variables.py |
Updates create/update attribute definitions to support masked_and_hidden on create and omit value as a required update field. |
tests/functional/api/test_variables.py |
Adds functional tests for hidden variables across instance/group/project scopes. |
.gitignore |
Adds .mypy_cache/ to ignored files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…eate attrs remove hidden_and_masked from admin vars api
…eate attrs add missing optional attributes
Remove instance test becasue it does not support masked_and_hidden
Changes
make
valuean optional attribute for variable updatesWhen updating a CI/CD variable that has been marked "Masked and hidden", you likely do not have the value when updating. In this case, the value is
Nonewhich the api rejects (400: {'value': ['is invalid']}).add
masked_and_hiddenthe the list of optional attributes for creating variablesWhen creating variables which you want to be hidden, you have to use the
masked_and_hiddenproperty.I don't think this was causing problems but for the sake completion and documentation I think it makes sense to include.
Documentation and testing
Please consider whether this PR needs documentation and tests. This is not required, but highly appreciated:
Documentation in the matching docs section