Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable CreateDataSource and UpdateDataSource API calls to complete #5101

Merged
merged 3 commits into from
Dec 2, 2024

Conversation

puerco
Copy link
Contributor

@puerco puerco commented Dec 2, 2024

Summary

This PR introduces two changes to allow the CreateDataSource() and UpdateDataSource() API calls to run their handlers. Currently, they fail early because 1) the proto validation is looking for the data source UUID (when it does not exist yet) and 2) the context cannot be extracted from the request, for example:

minder apply -f datasource.yaml 
WARNING: Running against a test environment (127.0.0.1) and may not be stable
Message: error applying data source from datasource.yaml
Details: error creating data source from datasource.yaml: rpc error: code = InvalidArgument desc = Validation failed:
- Field 'data_source.id': value is empty, which is not a valid UUID
exit status 3

This fixes the proto validation and the error Error extracting context from request by:

  1. Addinf the IGNORE_IF_DEFAULT_VALUE to the data source proto definition in 44c23bb
  2. Adding GetContext() methods to the update/create data source request payload types to satisfy and allow the payloads to work with getProjectIDFromContext() (in 1d90076)

Change Type

Mark the type of change your PR introduces:

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

This adds the IGNORE_IF_DEFAULT_VALUE ignore flag to the data source
definition to avoid it to fail in create requests.

Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
This commit adds methods to implement HasProtoContextV2 in the data
source create and update request types.

Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
@puerco puerco requested a review from a team as a code owner December 2, 2024 02:39
@puerco puerco force-pushed the HasProtoContextV2 branch from bbdc42b to 35d6f0a Compare December 2, 2024 02:39
@coveralls
Copy link

coveralls commented Dec 2, 2024

Coverage Status

coverage: 55.16% (+0.007%) from 55.153%
when pulling 35d6f0a on puerco:HasProtoContextV2
into 76bb3a6 on mindersec:main.

@JAORMX JAORMX merged commit c7b6f8d into mindersec:main Dec 2, 2024
27 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.

3 participants