Sorry, something went wrong.
|
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 gl = gitlab.Gitlab( ... retry_transient_errors=True) couldn't get passed the 500 errors. 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. |
Sorry, something went wrong.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ 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.
|
Sorry, something went wrong.
There was a problem hiding this comment.
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:
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| 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.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
Changes
make value an optional attribute for variable updates
When 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 None which the api rejects (400: {'value': ['is invalid']}).
add masked_and_hidden the the list of optional attributes for creating variables
When creating variables which you want to be hidden, you have to use the masked_and_hidden property.
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: