feat(ci): add project runner cache clear command

Adds glab ci cache clear to invalidate CI/CD runner caches for the selected project. The command uses the factory's configured GitLab client and the shared GraphQL implementation, with the mutation and response handling in an API sub-package. GitLab and mutation errors fail the command instead of reporting success.

The command follows the standard NewCmd/options.run(ctx) structure. Tests cover repository selection through the parent --repo flag, repository/client/project failures, context propagation, request and GraphQL errors, and missing mutation results. Cache-size statistics are outside this change.

Closes #8747.

Validation on d78f3231: pre-push build, lint, 214 affected/reverse-dependency tests, generated documentation/code and comment checks passed. Also passed 392 CI/root-command tests and targeted race tests; the cache command/API packages have 100% statement coverage. Optional Markdown/prose tools were unavailable locally. No live project's cache was cleared. CI pipeline 3082766188 passed on d78f3231.

Follow-up on 4e9aba71: renamed the command to glab ci cache clear, documented the project Developer prerequisite, regenerated CLI docs, and passed go test ./internal/commands/ci ./internal/commands/ci/cache/....

Prepared with AI assistance.

Command output from local validation

Ran the same command against the CI command sources from the main merge base (3653cc69) and the MR (5237c713). The local harness used a temporary Git repository and a mock GitLab API.

Main

$ glab ci cache clear
Manages CI/CD pipelines and jobs in your GitLab project.

Usage:
  glab ci <command> [flags]
  glab ci [command]

The command printed the parent ci help. The available commands did not include cache, and the mock API received zero requests.

MR

$ glab ci cache clear
Cleared CI/CD runner cache for demo/upstream.

The mock API received GET /api/v4/projects/demo/upstream and POST /api/graphql. It returned a successful runnerCacheClear payload, and the command exited with status 0. All requests stayed on the local fixture.

AI assistance was used to prepare and verify this example.

Edited by Himanshu Jha

Merge request reports

Loading
Loading