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
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
There was a problem hiding this comment.
When parameters are missing we provide client help No KCIDB credentials found. Provide --kcidb-rest-url and --kcidb-token, set KCIDB_REST env var, or configure kcidb_rest_url/kcidb_token in config file. Also i added in documentation file config_file.md.
Just curiosity, i noticed in config_file.md there is 3 spaces at end of each line, is it intentional?
kcidev/libs/kcidb.py
Outdated
| 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
There was a problem hiding this comment.
Done, extended logic, so if we provide anything over cli, second argument should be present
kcidev/libs/kcidb.py
Outdated
| 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)
c565ab3 to
bcdfe5e
Compare
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>
Added
kci-dev submit buildcommand with:Refs: #263