Simple cli to scan Harbor project/repo/artefact API
Project description
harbor-ls
Simple cli project/repo/artefact scanner using Harbor API
No dependency (stdlib only)
Python 3.9+
Python usage
from harbor_ls import HarborLs
scanner = HarborLs('reg.example.org', 'me', 'secret', ['myproject', 'yourproject/thisrepo'])
result_dict = scanner.ls()
CLI configuration
Set environment variables :
export HARBOR_USER=me
export HARBOR_PASSWORD=secret
export HARBOR_REGISTRY=registry.example.org
Or use command line arguments -u, -p (unsafe) and -r to set them.
CLI usage
Additional options available :
--levelfor logging levels--formatfor display format (defaults totext,jsonavailable)
You can filter the projects/repos scanned by using additional arguments in the following syntax :
projectname: this would scan all artefacts of all repos of specified projectprojectname/reponame: this would scan all artefacts of the specified project/repo- more than one filter can be provided on the command line, in which case any filter matching is done
Example (with command line options instead of environment variables) :
python3 -m harbor_ls -u me -p secret -r registry.example.org -f json myproject yourproject/thisrepo
CLI sample output
Text ouput (with logging on stderr) :
WARNING Not authorized for repo MYREPO1 : HTTP Error 403: Forbidden
WARNING Not authorized for repo MYREPO2 : HTTP Error 403: Forbidden
MYPROJECT1
MYREPO1
MYREPO2
foo
plugin-foo1
2025-03-06T16:44:12.139Z sha256:xxx...xxx 1.3.0 latest
2024-11-12T12:40:22.089Z sha256:yyy...yyy 1
plugin-foo2
2025-03-06T16:47:05.948Z sha256:zzz...zzz 1.3.0 latest
2024-11-12T12:39:52.070Z sha256:ttt...ttt
docker
foo
bar
baz
JSON output (with logging on stderr)
WARNING Not authorized for repo MYREPO1 : HTTP Error 403: Forbidden
WARNING Not authorized for repo MYREPO2 : HTTP Error 403: Forbidden
{
"MYPROJECT1": {
"MYREPO1": [],
"MYREPO2": []
},
"foo": {
"plugin-foo1": [
{
"time": "2025-03-06T16:44:12.139Z",
"digest": "sha256:xxx...xxx",
"tags": [
"latest",
"1.3.0"
]
},
{
"time": "2024-11-12T12:40:22.089Z",
"digest": "sha256:yyy...yyy",
"tags": [
"1"
]
}
],
"plugin-foo2": [
{
"time": "2025-03-06T16:47:05.948Z",
"digest": "sha256:zzz...zzz",
"tags": [
"latest",
"1.3.0"
]
},
{
"time": "2024-11-12T12:39:52.070Z",
"digest": "sha256:ttt...ttt",
"tags": []
}
]
},
"docker": {
"foo": [],
"bar": [],
"baz": []
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file harbor_ls-1.0.3.tar.gz.
File metadata
- Download URL: harbor_ls-1.0.3.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7876a210f1927c65523d10365e9efc62263f88a8d8e123f4edffcc0d406fae16
|
|
| MD5 |
f008b25dbf177892557a3d0371c8a65e
|
|
| BLAKE2b-256 |
35d765053d690be308760296ebba3542376f4573f8db161e3008ebe02e1ae0b7
|
File details
Details for the file harbor_ls-1.0.3-py3-none-any.whl.
File metadata
- Download URL: harbor_ls-1.0.3-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc8f8694de223f49c5cc4830add363a9737c0529cd73782e10d9404f63700b55
|
|
| MD5 |
7f1ea529bf5aa7ce8f6bce1dbbd7ec93
|
|
| BLAKE2b-256 |
2deb7f663cc6c763676466cf8a8db27980ef1c7305fc72dc3fa85e8584deef24
|