feat(ci): add --force flag to glab ci cancel job
Description
Add support for the --force flag (-f) in the glab ci cancel job command.
This flag maps to the force parameter in the GitLab Jobs API, allowing users to cancel jobs that run in protected environments — which was previously not possible via glab.
The implementation uses CancelJobWithOptions from the SDK v2 (with a //nolint:staticcheck comment since the method is deprecated in favor of a future v4 merge into CancelJob).
Changes
internal/commands/ci/cancel/job/job.go: Added--force/-fflag and updatedrunCancelationto callCancelJobWithOptionswhen force mode is enabled.internal/commands/ci/cancel/job/job_test.go: Added tests for normal cancel, multiple cancel, error handling, force cancel, and force cancel of multiple jobs.docs/source/ci/cancel/job.md: Auto-regenerated viamake gen-docs.
Related Issues
Resolves #8290 (closed)
How has this been tested?
Unit tests added for all new code paths:
TestCIJobCancel— single job cancelTestCIJobCancelMultiple— multiple jobs cancelTestCIJobCancelError— API error handlingTestCIJobCancelWithForce— single job force-cancelTestCIJobCancelWithForceMultiple— multiple jobs force-cancel
All tests pass: go test ./internal/commands/ci/cancel/job/...