feat(submit): add KCIDB build submission subcommand and payload helpers#266
feat(submit): add KCIDB build submission subcommand and payload helpers#266nuclearcat wants to merge 1 commit intokernelci:mainfrom
Conversation
Added `kci-dev submit build` command with: - KCIDB payload ID generation and construction helpers - JSON dry-run support and full payload submission to KCIDB REST - credential resolution precedence: CLI > KCIDB_REST env var > config file (to make it partially compatible with existing KCIDB CLI usage patterns) - submit option grouping + CLI registration - tests for deterministic IDs, payload builders, config resolution, and help output Refs: kernelci#263 Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
86bd395 to
77a073e
Compare
| api="https://staging.kernelci.org:9000/" | ||
| token="example" | ||
| kcidb_rest_url="https://staging.kcidb.kernelci.org/submit" | ||
| kcidb_token="your-kcidb-token-here" |
There was a problem hiding this comment.
document the following added parameters in the client help or raise error when this parameters are missing
| kci_err(f"KCIDB API connection error: {e}") | ||
| raise click.Abort() | ||
|
|
||
| if response.status_code == 200: |
There was a problem hiding this comment.
consider other 2xx return status code (example 201 created), accepting all 2xx status code as success would be more robust
| build_build_payload, | ||
| build_checkout_payload, |
There was a problem hiding this comment.
build_build_payload,
build_checkout_payload,
Are referring to the same identical JSON field
simplify to a list of allowed keys and directly checking if kwargs.get(key) is not None would make the code shorter
| def resolve_kcidb_config(cfg, instance, cli_rest_url, cli_token): | ||
| """ | ||
| Resolve KCIDB REST URL and token. Priority: | ||
| 1. CLI flags (--kcidb-rest-url, --kcidb-token) |
There was a problem hiding this comment.
raise a error if user specify only one of them
| raise click.Abort() | ||
|
|
||
| if response.status_code == 200: | ||
| return response.text |
There was a problem hiding this comment.
would be better to return structured data like response.json() when available
| # --------------------- | ||
|
|
||
|
|
||
| class TestGenerateCheckoutId: |
There was a problem hiding this comment.
test also for negative behavior
(invalid json, missed required argument)
Added
kci-dev submit buildcommand with:Refs: #263