Skip to content

feat: added jobservice pools, workers, jobs subcommand#796

Open
NishchayRajput wants to merge 4 commits into
goharbor:mainfrom
NishchayRajput:feat/jobservice-workers-pools-jobs-subcommand
Open

feat: added jobservice pools, workers, jobs subcommand#796
NishchayRajput wants to merge 4 commits into
goharbor:mainfrom
NishchayRajput:feat/jobservice-workers-pools-jobs-subcommand

Conversation

@NishchayRajput
Copy link
Copy Markdown

Description

Briefly describe what this pull request does and why the change is needed.

This PR adds the remaining jobservice subcommands under harbor jobservice for workers, worker pools, and job logs.
It improves CLI parity with the Harbor Job Service dashboard by exposing worker pool listing, worker listing with pagination, and job log viewing from the CLI.

Type of Change

Please select the relevant type.

  • Bug fix
  • New feature
  • Documentation update
  • Refactor
  • Chore / maintenance

Changes

  • Added worker pool command group support: pools list.
  • Added worker command group support: workers list, workers free, workers free-all.
  • Added job log command support: jobs log.
  • Added jobservice API handlers and rendering helpers for pools, workers, and job logs.

Command and Flag Behavior

Commands added

  • harbor jobservice pools list
  • harbor jobservice workers list
  • harbor jobservice workers free
  • harbor jobservice workers free-all
  • harbor jobservice jobs log

Supported flags by command

  • harbor jobservice pools list

    • no pools-specific flags
    • supports global --output-format json|yaml
  • harbor jobservice workers list

    • --pool <pool-id|all>
    • --all
    • --pool-all (compatibility alias)
    • --page
    • --page-size
    • supports a positional [POOL_ID] for backward compatibility
    • supports global --output-format json|yaml
  • harbor jobservice workers free

    • --job-id (required)
  • harbor jobservice workers free-all

    • no workers-specific flags
  • harbor jobservice jobs log

    • --job-id (required)

Default behavior

  • workers list defaults to all pools when no pool selector is provided.
  • workers list defaults to page 1 and page-size 20.
  • workers list paginates in the CLI because the backend API only accepts pool_id.
  • workers free stops the single job identified by --job-id.
  • workers free-all stops all running jobs to free busy workers.
  • jobs log prints the selected job log and returns a clear empty-state message when no log content is available.

@NucleoFusion
Copy link
Copy Markdown
Contributor

Can you convert this to a draft, since this would cause conflicts with the other PR #795
And we can wait till the other gets merged

@qcserestipy qcserestipy self-requested a review April 7, 2026 16:22
Copy link
Copy Markdown
Collaborator

@qcserestipy qcserestipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle LGTM, the commands however should be only accessible for admins. Please make sure that a user needs elevated priviledges.

@qcserestipy qcserestipy added the Changes Requesed feedback that must be addressed before merging. label Apr 7, 2026
@NishchayRajput NishchayRajput force-pushed the feat/jobservice-workers-pools-jobs-subcommand branch from c46608b to 15e145e Compare April 14, 2026 14:38
@NishchayRajput NishchayRajput force-pushed the feat/jobservice-workers-pools-jobs-subcommand branch from 15e145e to 20a261e Compare April 21, 2026 16:48
@qcserestipy qcserestipy self-requested a review April 28, 2026 07:26
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

❌ Patch coverage is 37.17949% with 196 lines in your changes missing coverage. Please review.
✅ Project coverage is 9.42%. Comparing base (60ad0bd) to head (b668590).
⚠️ Report is 163 commits behind head on main.

Files with missing lines Patch % Lines
pkg/api/jobservice_handler.go 0.00% 44 Missing ⚠️
cmd/harbor/root/jobservice/workers/cmd.go 0.00% 23 Missing ⚠️
cmd/harbor/root/jobservice/workers/list.go 53.06% 22 Missing and 1 partial ⚠️
pkg/utils/jobservice/errors.go 0.00% 22 Missing ⚠️
cmd/harbor/root/jobservice/cmd.go 0.00% 18 Missing ⚠️
cmd/harbor/root/jobservice/workers/free.go 0.00% 17 Missing ⚠️
cmd/harbor/root/jobservice/jobs/log.go 50.00% 14 Missing and 2 partials ⚠️
cmd/harbor/root/jobservice/workers/free_all.go 0.00% 13 Missing ⚠️
cmd/harbor/root/jobservice/pools/list.go 36.84% 11 Missing and 1 partial ⚠️
pkg/views/jobservice/workers/view.go 81.81% 3 Missing and 3 partials ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff            @@
##             main    #796      +/-   ##
=========================================
- Coverage   10.99%   9.42%   -1.57%     
=========================================
  Files         173     293     +120     
  Lines        8671   14277    +5606     
=========================================
+ Hits          953    1346     +393     
- Misses       7612   12806    +5194     
- Partials      106     125      +19     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Collaborator

@qcserestipy qcserestipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I added several nit picks here and there.

Comment thread cmd/harbor/root/jobservice/cmd.go
Comment thread cmd/harbor/root/jobservice/jobs/log.go Outdated
Comment thread cmd/harbor/root/jobservice/jobs/log.go Outdated
Comment thread cmd/harbor/root/jobservice/jobs/log.go
Comment thread cmd/harbor/root/jobservice/pools/list.go Outdated
Comment thread cmd/harbor/root/jobservice/workers/free.go
Comment thread cmd/harbor/root/jobservice/workers/list.go Outdated
Comment thread cmd/harbor/root/jobservice/workers/list.go Outdated
@NishchayRajput
Copy link
Copy Markdown
Author

Thank you for your contribution! I added several nit picks here and there.

Thanks for reviewing. Will do the required changes by today.

Signed-off-by: Nishchay Rajput <nishchayr@iitbhilai.ac.in>
Signed-off-by: Nishchay Rajput <nishchayr@iitbhilai.ac.in>
Signed-off-by: Nishchay Rajput <nishchayr@iitbhilai.ac.in>
@NishchayRajput NishchayRajput force-pushed the feat/jobservice-workers-pools-jobs-subcommand branch from 626d445 to 524cc93 Compare May 10, 2026 11:16
Signed-off-by: Nishchay Rajput <nishchayr@iitbhilai.ac.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changes Requesed feedback that must be addressed before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature]: Implementing Jobservice Dashboard in CLI

4 participants