Create mutation for bulk deletion of artifacts
What does this MR do and why?
- Add a mutation that will delete more than one artifact by taking in an array of artifact IDs.
- Introduce BulkDeleteService for artifacts
Related to #33348 (closed) and frontend changes are tracked in !111389 (merged)
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
- Enable the feature flag in rails console ($rails c)
Feature.enable(:ci_job_artifact_bulk_destroy)- Navigate to the graphql explorer
http://localhost:3000/-/graphql-explorer. # can be different based on gdk config- Copy and paste and run the following query to the graphql explorer to test:
mutation {
  bulkDestroyJobArtifacts(input:{
    projectId: "gid://gitlab/Project/1123",
    ids: ["gid://gitlab/Ci::JobArtifact/1838", "gid://gitlab/Ci::JobArtifact/2957"]
  }) {
     destroyedCount
     destroyedIds
     errors
  }
}
Database Queries
EXPLAINS was executed to delete the maximum allowed batch in 50 ci_job_artifacts
executed 3 explains with reset database after each.
SQLs
explain DELETE FROM ci_job_artifacts WHERE id IN (
2962926,2962980,2963018,2963040,2963268,2963289,2963437,2963500,2963537,2963595,2963622,2963623,
2963663,2963727,2963737,2963834,2963837,2963900,2963908,2963925,2963980,2964009,2964010,2964013,
2964048,2964105,2964128,2964158,2964218,2964248,2964257,2964264,2964301,2964329,2964360,2964373,
2964405,2964425,2964427,2964452,2964460,2964465,2964501,2964503,2964506,2964522,2964537,2964563,
2964567,2964597)Time: 22.187 ms
  - planning: 9.564 ms
  - execution: 12.623 ms
    - I/O read: 2.381 ms
    - I/O write: 0.000 msTime: 39.657 ms  
  - planning: 21.172 ms  
  - execution: 18.485 ms  
    - I/O read: 2.497 ms  
    - I/O write: 0.000 ms Time: 73.996 ms  
  - planning: 13.524 ms  
  - execution: 60.472 ms  
    - I/O read: 20.852 ms  
    - I/O write: 0.000 ms  
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
- 
I have evaluated the MR acceptance checklist for this MR. 
Edited  by Dmytro Biryukov