Backend: Refactor Collection#Item
Summary
Follow up of !117113 (comment 1412905869).
Gitlab::Ci::Variables::Collection::Item is getting more complex and it's hard to understand what's happening. We should look into a way to make this more maintainable.
@mbobin suggested to use a new data structure to simplify this class business logic.
Proposal
-
Extract configuration at a higher level
# config/ci/variables/project_predefined.yml
name: project_predefined_variables
public: true
scope: project
masked: false
user_debug: true
help: https://doc.gitlab.com/ci/variables/...
# Then change Item.new to
.append(definition: Gitlab::CiL::Variables::PROJECT_PREDEFINED, key: 'CI_PROJECT_PATH', value: full_path)
Additional details
Some relevant technical details, if applicable, such as:
- Does this need a feature flag? Yes as this is a sensitive area.
- Does there need to be an associated instrumentation issue created related to this work? No.
- Is there an example response showing the data structure that should be returned (new endpoints only)?
- What permissions should be used?
- Is this EE or CE?
-
EE -
CE
-
- Additional comments:
Implementation Table
Group | Issue Link |
---|---|
backend |
|
Links/References
cc @gitlab-com/pipeline-security-group/backend @mbobin
Edited by Max Orefice