Skip to content

Comments

Add initial REST support#646

Merged
nuclearcat merged 1 commit intokernelci:mainfrom
nuclearcat:add-rest-support
May 7, 2025
Merged

Add initial REST support#646
nuclearcat merged 1 commit intokernelci:mainfrom
nuclearcat:add-rest-support

Conversation

@nuclearcat
Copy link
Member

As we implemented kcidb-rest interface on server side, we need to make optional (for now) support for it in client library.

@nuclearcat nuclearcat marked this pull request as draft April 21, 2025 19:32
@nuclearcat nuclearcat force-pushed the add-rest-support branch 13 times, most recently from e03d4ed to df8a3a1 Compare April 23, 2025 08:38
@nuclearcat nuclearcat marked this pull request as ready for review May 6, 2025 19:42
@nuclearcat nuclearcat requested a review from Copilot May 6, 2025 19:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds initial support for submitting reports over a REST API in the client library, making the REST functionality optional based on an environment variable.

  • Added REST URI validation using a regex pattern
  • Implemented a new rest_submit() function for REST-based submissions and updated submit() and future_submit() to support REST
  • Early return in init() when KCIDB_REST is set, bypassing the traditional database and MQ setup
Comments suppressed due to low confidence (1)

kcidb/init.py:156

  • LOGGER is used but not defined in this file; please initialize a logger or use logging.getLogger to properly log errors.
LOGGER.error("Error submitting report: %s", e)

@nuclearcat nuclearcat requested a review from Copilot May 6, 2025 19:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds optional REST support to the client library, enabling report submissions over a REST API if the environment variable KCIDB_REST is present.

  • Introduces required imports for REST support (os, re, requests).
  • Adds a REST URI validation regex, validate_rest_uri, and rest_submit method to handle REST submissions.
  • Updates the init, submit, and future_submit methods to conditionally use REST over the traditional MQ publishing.

@nuclearcat nuclearcat force-pushed the add-rest-support branch 2 times, most recently from 8796391 to 567ba6a Compare May 6, 2025 20:06
@nuclearcat nuclearcat requested a review from Copilot May 6, 2025 20:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces initial support for REST submissions in the client library by leveraging a new environment variable (KCIDB_REST) to enable an alternative submission path. Key changes include:

  • Importing and using new modules (os, re, and requests) for REST functionality.
  • Adding new methods for validating REST URIs and submitting reports over a REST API.
  • Modifying the submit and future_submit methods to prioritize REST submission when available.
Comments suppressed due to low confidence (1)

kcidb/init.py:134

  • [nitpick] The variable name 'vre' is ambiguous; consider renaming it to something more descriptive (e.g., 'regex_match' or 'rest_regex').
vre = self.REST_REGEX

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
@nuclearcat nuclearcat merged commit 8fb83c0 into kernelci:main May 7, 2025
5 of 6 checks passed
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.

1 participant