Forbid directly deleting non-orphaned child pipelines

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem

@fabiopitino said:

Like we don't allow jobs to be deleted in isolation we should not allow a child pipeline to be deleted while the parent pipeline remains.

  • We should not allow children with parents to be deleted.
  • Before #39503 is implemented GitLab will leave orphaned children when deleting the parents. Users should be allowed to directly delete these so that they can free space by cleaning up pipelines.

Proposal

Backend

  • Before triggering the pipeline Ci::DestroyPipelineService from any API endpoint we check for either:
  1. The pipeline is a parent pipeline
  2. the pipeline is an orphaned child (has no parent)
  • Pass to the frontend an attribute that tells if the pipeline is deletable based on the same checks we applied to the api

Frontend

Edited by 🤖 GitLab Bot 🤖