docs: add project documentation
All checks were successful
CI / Lint & Check (push) Successful in 11s
All checks were successful
CI / Lint & Check (push) Successful in 11s
This commit is contained in:
104
README.md
Normal file
104
README.md
Normal file
@@ -0,0 +1,104 @@
|
||||
# harbor-ctl
|
||||
|
||||
CLI utility for interacting with Harbor container registry API.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
# 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
|
||||
|
||||
```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
|
||||
Reference in New Issue
Block a user