Skip to content

feat(submit): add KCIDB build submission subcommand and payload helpers#266

Draft
nuclearcat wants to merge 1 commit intokernelci:mainfrom
nuclearcat:submit-cmd
Draft

feat(submit): add KCIDB build submission subcommand and payload helpers#266
nuclearcat wants to merge 1 commit intokernelci:mainfrom
nuclearcat:submit-cmd

Conversation

@nuclearcat
Copy link
Member

@nuclearcat nuclearcat commented Feb 25, 2026

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 (legacy) usage patterns)
  • submit option grouping + CLI registration
  • tests for deterministic IDs, payload builders, config resolution, and help output

Refs: #263

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>
api="https://staging.kernelci.org:9000/"
token="example"
kcidb_rest_url="https://staging.kcidb.kernelci.org/submit"
kcidb_token="your-kcidb-token-here"
Copy link
Member

@aliceinwire aliceinwire Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Member

@aliceinwire aliceinwire Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider other 2xx return status code (example 201 created), accepting all 2xx status code as success would be more robust

Comment on lines +11 to +12
build_build_payload,
build_checkout_payload,
Copy link
Member

@aliceinwire aliceinwire Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raise a error if user specify only one of them

raise click.Abort()

if response.status_code == 200:
return response.text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be better to return structured data like response.json() when available

# ---------------------


class TestGenerateCheckoutId:
Copy link
Member

@aliceinwire aliceinwire Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test also for negative behavior
(invalid json, missed required argument)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants