Skip to content

feat: Implement list and discard for workerpools queue#412

Open
jchanam wants to merge 2 commits intospacelift-io:mainfrom
jchanam:add-workerpools-queue-list-and-discard
Open

feat: Implement list and discard for workerpools queue#412
jchanam wants to merge 2 commits intospacelift-io:mainfrom
jchanam:add-workerpools-queue-list-and-discard

Conversation

@jchanam
Copy link
Copy Markdown

@jchanam jchanam commented Apr 8, 2026

Description

Adds workerpool worker queue command to manage runs in a worker pool’s schedulable queue from the CLI:

  • queue list shows queued runs (table or JSON).
  • queue discard supports a single run via --stack and --run, or bulk discard with the same filters as list plus --yes to confirm.

Uses searchSchedulableRuns on publicWorkerPool (no --pool-id) or workerPool(id: …) for a private pool, and runDiscard(stack:, run:) for discard. API search predicates include isPrioritized, state, and type; --stack, --drift-detection, and --commit are applied client-side after paging results so --limit still applies for bulk discard when those filters are used.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Changes Made

  • New subcommands: spacectl workerpool worker queue list and spacectl workerpool worker queue discard
  • internal/cmd/workerpools/queue.go — GraphQL queries, list/discard actions, collectSchedulableRuns (pagination + client-side filters), API-only predicates in buildAPISchedulableRunPredicates
  • internal/cmd/workerpools/cmd.go — command registration
  • internal/cmd/workerpools/flags.go — queue-related flags and help text

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All existing tests pass (go test ./...)

Screenshots (if applicable)

N/A (CLI only).

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code where necessary
  • My changes generate no new warnings

Related Issues

Closes #
Fixes #
Related to https://feedback.spacelift.io/p/allow-manage-runs-with-spacectl

jchanam added 2 commits April 8, 2026 12:01
Signed-off-by: Julio Chana <julio.chana@lokalise.com>
Signed-off-by: Julio Chana <julio.chana@lokalise.com>
@jchanam jchanam requested a review from a team as a code owner April 8, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant