# harbor-ctl CLI utility for interacting with Harbor container registry API. ## Installation ```sh # Run directly from source PYTHONPATH=src python3 -m harbor # Or install in development mode pip install -e . # Or use the legacy single-file script ./harbor-ctl.py ``` ## Usage ``` python -m harbor [options] ``` ## Commands | Command | Description | |---------|-------------| | `projects` | List all projects | | `repos ` | List repositories in a project | | `artifacts ` | List artifacts in a repository | | `info ` | Show artifact details | | `vulns ` | List vulnerabilities | | `scan ` | Trigger vulnerability scan | | `tags ` | List or manage tags | | `sbom ` | Get SBOM for artifact | | `delete ` | Delete artifact or tag | | `config ` | 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 ```sh # 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