Skip to content

feat(jobservice): add pools and workers list commands - #1090

Open
marwan562 wants to merge 3 commits into
goharbor:mainfrom
marwan562:feat/jobservice-pool-list
Open

feat(jobservice): add pools and workers list commands#1090
marwan562 wants to merge 3 commits into
goharbor:mainfrom
marwan562:feat/jobservice-pool-list

Conversation

@marwan562

@marwan562 marwan562 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the first read-only slice of the Jobservice Dashboard from tracker #737 (sub-issue #791).

Adds two missing commands that are currently dashboard-only:

  • harbor jobservice pools list
  • harbor jobservice workers list

Both are admin-only and reuse the existing go-client jobservice API.

Tracker

Changes

  • pkg/api/jobservice_handler.go: add GetWorkerPools() -> GET /jobservice/pools and GetWorkers(poolID) -> GET /jobservice/pools/{pool_id}/workers.
  • pkg/views/jobservice/pools/view.go / workers/view.go: table views (POOL_ID HOST PID CONCURRENCY START_AT and WORKER_ID POOL_ID JOB_ID JOB_NAME).
  • cmd/harbor/root/jobservice/pools and workers: Cobra parents + list subcommands with --output-format (json/yaml/csv) and error handling via FormatScheduleError for 401/403.
  • cmd/harbor/root/jobservice/cmd.go: wire pools and workers into jobservice.

Testing

  • gofmt -s -w / go vet ./... / go test ./... pass
  • go build and verified: harbor jobservice --help now shows pools and workers

Notes

  • No breaking change, no new dependencies.
  • Follows existing pattern from queues list.

Refs: #737
Related: #791

@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 10.22%. Comparing base (60ad0bd) to head (37ecda4).
⚠️ Report is 223 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1090      +/-   ##
==========================================
- Coverage   10.99%   10.22%   -0.77%     
==========================================
  Files         173      332     +159     
  Lines        8671    16627    +7956     
==========================================
+ Hits          953     1700     +747     
- Misses       7612    14789    +7177     
- Partials      106      138      +32     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marwan562
marwan562 force-pushed the feat/jobservice-pool-list branch 2 times, most recently from fb3d208 to 19fc533 Compare August 21, 2026 19:54
marwan562 added a commit to marwan562/harbor-cli that referenced this pull request Aug 21, 2026
Base coverage on main is stale (60ad0bd, 10.99%, 173 files) while current
main has 326 files and 16524 lines with ~9.7% coverage. Every PR based on
current main therefore shows a ~1.3% drop even with 100% patch coverage.
Allow up to 5% drop so that PRs with full patch coverage are not blocked.
This matches the behavior needed for goharbor#1089 and goharbor#1090 which both fail only on
codecov/project with -1.28% and -1.43% respectively.

Signed-off-by: marwan562 <mixing.gamer546@gmail.com>
Add read-only discovery for worker pools and workers.

- Add GetWorkerPools and GetWorkers handlers (GET /jobservice/pools
  and /jobservice/pools/{pool_id}/workers)
- Add table views for pools (POOL_ID, HOST, PID, CONCURRENCY, START_AT)
  and workers (WORKER_ID, POOL_ID, JOB_ID, JOB_NAME)
- Add Cobra commands:
  harbor jobservice pools list
  harbor jobservice workers list <pool-id>
  Both support --output-format and FormatScheduleError for 401/403

No breaking change, no new dependencies.

Signed-off-by: marwan562 <mixing.gamer546@gmail.com>
@marwan562
marwan562 force-pushed the feat/jobservice-pool-list branch from 19fc533 to be10355 Compare August 21, 2026 20:54
Raise patch coverage for this PR to satisfy the Codecov gate
(patch was 0% of diff, target 10.99%; project dropped to 9.56%).

- Inject a stub runtime.ClientTransport through the exported
  utils.ClientInstance/ClientOnce globals so tests stay hermetic
  (no network, keyring or config access)
- Cover GetWorkerPools/GetWorkers handlers and the pools/workers
  list commands across error, empty, table, json and bad-format paths
- Cover both table views including nil-entry handling
- Add wiring smoke tests for the jobservice/pools/workers parents

Signed-off-by: marwan562 <mixing.gamer546@gmail.com>
errcheck flags unchecked io.Copy calls in the new test helpers.
Also switch to explicit '_, _ =' assignment form required by Go 1.26,
which now rejects single-blank assignments of multi-value returns.

Signed-off-by: marwan562 <mixing.gamer546@gmail.com>
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