Skip to content

feat(cli): Validate plugins gRPC protocol version#3657

Closed
erezrokah wants to merge 4 commits intocloudquery:mainfrom
erezrokah:feat/validate_protocols
Closed

feat(cli): Validate plugins gRPC protocol version#3657
erezrokah wants to merge 4 commits intocloudquery:mainfrom
erezrokah:feat/validate_protocols

Conversation

@erezrokah
Copy link
Copy Markdown
Member

@erezrokah erezrokah commented Nov 6, 2022

Summary

Fixes #3628

Examples:
image

image

@cq-bot cq-bot added the cli label Nov 6, 2022
if err != nil {
return fmt.Errorf("failed to get protocol version from destination %q: %w", destPluginName+"@"+destPluginVersion, err)
}
if destProtocolVersion != expectedProtocolVersion {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Initially I thought about trying to be more specific (e.g. telling the user to update only the destination or only the source), but that probably has a ton of edge cases. For example what if we have protocol version 3, then we need to start to check ranges 🙃

Copy link
Copy Markdown
Contributor

@yevgenypats yevgenypats left a comment

Choose a reason for hiding this comment

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

I think let's wait with that. it should be done on the server side where there are still few culprits before we can take care of that.

Mostly we need to start versioning SDK with v1, v2 and making protobuf versioned as well (the package name in prtobouf) - this way v1 will never be able to connect to an uncompatible version.

@erezrokah
Copy link
Copy Markdown
Member Author

I think let's wait with that. it should be done on the server side where there are still few culprits before we can take care of that.

Mostly we need to start versioning SDK with v1, v2 and making protobuf versioned as well (the package name in prtobouf) - this way v1 will never be able to connect to an uncompatible version.

We can always remove this logic when we have server side validation. This is mostly needed for users updating to the latest CLI version with the type system changes (we've seen reports on Discord with the error mentioned in the bug)

@erezrokah
Copy link
Copy Markdown
Member Author

Also the tests are blocked by cloudquery/plugin-sdk#351 but we can comment them

@erezrokah
Copy link
Copy Markdown
Member Author

PR to fix the Windows bug cloudquery/plugin-sdk#352

@yevgenypats
Copy link
Copy Markdown
Contributor

Im just working on this atm in my sdk pr cloudquery/plugin-sdk#348 so this will create more work for me reviewing and then removing the logic. let's hold off

yevgenypats added a commit to cloudquery/plugin-sdk that referenced this pull request Nov 7, 2022
This is a split of this PR
#348 so it will be easier
to review.

Also, Im going to push the move to v2 maybe another week as we dont
really have anything that requires protocol changes for now. even though
it is the right way to do it and will make the cli much easier including
the need to things like that -
cloudquery/cloudquery#3657 as it will be all
handles on protobuf and go versioning side.

This current PR just moves cqtypes to schema and removes enumerating all
types in different locations to make sure when we add a new type tests
will catch if a type is not added to the right place and or not
connected to `TypeValue`.

Also this removes `TimeInterval` which 1) wasn't used 2) it is incorrect
because it used `time.Duration` as `TimeInterval` but it's not a
TimeInterval it's just a duration which is uint64 so there no need for a
special type for that. In PostgreSQL TimeInterval is actually completely
different type that contains timezones and it is not go `time.Duration`
@erezrokah erezrokah force-pushed the feat/validate_protocols branch from 818e5eb to c91c301 Compare November 13, 2022 12:20
@erezrokah erezrokah force-pushed the feat/validate_protocols branch from 5469ddd to 57ae8b3 Compare November 13, 2022 12:40
@erezrokah erezrokah force-pushed the feat/validate_protocols branch from b79226c to 376012c Compare November 15, 2022 09:28
@erezrokah erezrokah force-pushed the feat/validate_protocols branch from 376012c to f2db71d Compare November 15, 2022 09:29
@yevgenypats
Copy link
Copy Markdown
Contributor

Let's close this?

@erezrokah
Copy link
Copy Markdown
Member Author

erezrokah commented Nov 16, 2022

Let's close this?

I think it's not solved yet, but will be in the gRPC breaking change? But we can close for now

@erezrokah erezrokah closed this Nov 16, 2022
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.

feat(CLI): The CLI should verify all plugins use the same gRPC protocol version

4 participants