When a ref is deleted it may unlock artifacts for the wrong project
Problem
This bug was introduced in !30741 (diffs, comment 399864794) as part of keeping latest artifacts for the last successful job.
When a ref is deleted (branch or tag) we lookup for the ref_path
in Ci::Ref
in order to unlock related pipelines and their artifacts. However the search of Ci::Ref
path is not scoped to a project, causing pipelines from other projects having the same ref to get pipelines unlocked and leaving artifacts locked for the ref that was actually deleted.
Solution
Scope the search of ref_path
within the given project
.