Skip to content

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

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

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

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

Copy link
Member Author

Choose a reason for hiding this comment

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

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?

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

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

Copy link
Member Author

Choose a reason for hiding this comment

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

done

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, extended logic, so if we provide anything over cli, second argument should be present

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

Copy link
Member Author

@nuclearcat nuclearcat Mar 10, 2026

Choose a reason for hiding this comment

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

Done

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


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)

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@nuclearcat nuclearcat marked this pull request as ready for review March 10, 2026 11:27
@nuclearcat nuclearcat force-pushed the submit-cmd branch 3 times, most recently from c565ab3 to bcdfe5e Compare March 10, 2026 11:55
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>
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