Deleting a pipeline does not remove job artifacts
Summary
Ci::DestroyPipelineService
class calls pipeline.destroy!
to remove the pipeline record and it cascades the job artifacts removal through database logic which does not update the project statistics and it does not remove the job artifacts from the object storage.
Steps to reproduce
https://gitlab.com/gitlab-org/gitlab/-/issues/223034#note_364552012
Possible fixes
Extract the part which removes expired artifacts into a new service that accepts an array of job artifacts like specified in #223793 (closed) and use it here to move ci_job_artifacts
records into ci_deleted_objects
.
This must also work for parent-child pipelines.
Edited by Marius Bobin