Skip to content

Expanded job token links to accept multiple link types

What does this MR do and why?

This MR expands the table ci_job_token_project_scope_links to use polymorphic attributes for target_project and source_project. With these changes, we will later be able to create project->group, group->project, and group->group ci_job_token links. This is the groundwork to better implement !121750 (closed) and aims to build a solution for issues #342842 and #415519 (closed).

Rubocop discourages polymorphic associations however it seems most appropriate in this case as we perform largely the same operations on each variable object. The alternative of creating separate tables for each link type will lead to four tables and models, all doing very similar work.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Markus Ferrell

Merge request reports