Skip to content

Add JobArtifactsDestroy GraphQL mutation

Lee Tickett requested to merge 33418-add-delete-job-artifacts-mutation into master

What does this MR do and why?

This MR adds a GraphQL mutation to allow deleting of all artifacts for a job, in order to support delivering #33418 (closed)

How to set up and validate locally

Use a GraphQL query like this to find some jobs/artifacts:

query getJobArtifacts {
  project(fullPath: "gnuwget/wget2") {
    jobs(statuses: [SUCCESS, FAILED]) {
      nodes {
        id
        pipeline {
          id
        }
        artifacts {
          nodes {
            name
          }
        }
      }
    }
  }
}

Then use one of those job ids to delete all artifacts:

mutation {
  jobArtifactsDestroy(input:{
    id: "gid://gitlab/Ci::Build/987"
  }) {
    job {
      name
    }
    destroyedArtifactsCount
    errors
  }
}

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 Lee Tickett

Merge request reports