Username 17e2530da9
All checks were successful
CI / Lint & Check (push) Successful in 12s
feat: add --tag alias, improve tags output, add management commands
- add --tag alias for --digest in vulns, scan, info, sbom commands
- tags command now shows digest column for each tag
- add delete-repo, delete-project, purge, clean-all commands
- add config command for project settings
- bump version to 0.3.0
2026-01-23 16:53:26 +01:00
2026-01-18 18:32:55 +01:00

harbor-ctl

CLI utility for interacting with Harbor container registry API.

Installation

# Run directly from source
PYTHONPATH=src python3 -m harbor <command>

# Or install in development mode
pip install -e .

# Or use the legacy single-file script
./harbor-ctl.py <command>

Usage

python -m harbor <command> [options]

Commands

Command Description
projects List all projects
repos <project> List repositories in a project
artifacts <project> <repo> List artifacts in a repository
info <project> <repo> Show artifact details
vulns <project> <repo> List vulnerabilities
scan <project> <repo> Trigger vulnerability scan
tags <project> <repo> List or manage tags
sbom <project> <repo> Get SBOM for artifact
delete <project> <repo> Delete artifact or tag
config <project> View/modify project settings

Authentication

Credentials are loaded in priority order:

  1. CLI arguments (-u, -p)
  2. Secrets file (/opt/ansible/secrets/harbor/credentials.json)
  3. Environment variables (HARBOR_USER, HARBOR_PASS)

Examples

# List projects
python -m harbor projects

# List repositories in 'library' project
python -m harbor repos library

# Show latest artifact details
python -m harbor info library myapp

# Show artifact by tag
python -m harbor info library myapp -d v1.0.0

# List high severity vulnerabilities
python -m harbor vulns library myapp -s high

# Filter vulnerabilities by package
python -m harbor vulns library myapp -P openssl

# Trigger scan and wait for completion
python -m harbor scan library myapp --wait

# Add tag to artifact
python -m harbor tags library myapp -a production

# Show SBOM
python -m harbor sbom library myapp

# Show project settings
python -m harbor config library --show

# Enable auto-scan
python -m harbor config library --auto-scan true

Project Structure

src/
└── harbor/
    ├── __init__.py      Package metadata
    ├── __main__.py      Entry point (python -m harbor)
    ├── cli.py           Argument parsing, main()
    ├── client.py        API client functions
    ├── commands.py      CLI command handlers
    └── config.py        Credentials loading

Requirements

  • Python 3.10+
  • No external dependencies (stdlib only)

License

MIT

Description
No description provided
Readme 135 KiB
Languages
Python 100%