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

[featuregate] Validate arguments to Register #8766

Merged
merged 13 commits into from
Nov 7, 2023

Conversation

mx-psi
Copy link
Member

@mx-psi mx-psi commented Oct 27, 2023

Description:

  • Validate Gate IDs: ids must be alphanumeric with dots. At a minimum we have to disallow , to avoid ambiguity in the CLI, but I am being intentionally more restrictive here
  • Validate URLs: we check that a valid URL can be built from it using the net/url stdlib package
  • Validate versions: we check that a valid version is passed to the To/FromVersion options using hashicorp's libraries and also that the implicit version range, when defined, is not empty.

This does not change the public API types, it only adds validation.

Relates to #8220

@mx-psi mx-psi changed the title mx psi/featuregate validation [featuregate] Validate arguments to Register Oct 27, 2023
@mx-psi mx-psi marked this pull request as ready for review October 27, 2023 11:52
@mx-psi mx-psi requested review from a team and dmitryax October 27, 2023 11:52
@mx-psi mx-psi mentioned this pull request Oct 27, 2023
@codecov
Copy link

codecov bot commented Oct 27, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
featuregate/gate.go 100.00% <100.00%> (ø)
featuregate/registry.go 100.00% <100.00%> (+4.59%) ⬆️

... and 3 files with indirect coverage changes

📢 Thoughts on this report? Let us know!

featuregate/registry.go Outdated Show resolved Hide resolved
@mx-psi mx-psi requested a review from bogdandrutu October 30, 2023 16:53
featuregate/registry.go Show resolved Hide resolved
featuregate/registry.go Show resolved Hide resolved
featuregate/registry.go Show resolved Hide resolved
featuregate/registry.go Show resolved Hide resolved
featuregate/registry.go Show resolved Hide resolved
@mx-psi
Copy link
Member Author

mx-psi commented Nov 2, 2023

Can you take one (hopefully) final look @bogdandrutu ?

Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

Would be good to have the same setup in core like https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/.gitattributes to not expand all the sum files.

featuregate/registry.go Outdated Show resolved Hide resolved
@mx-psi
Copy link
Member Author

mx-psi commented Nov 7, 2023

Would be good to have the same setup in core like https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/.gitattributes to not expand all the sum files.

See #8810

@mx-psi mx-psi merged commit 8bea0d3 into open-telemetry:main Nov 7, 2023
32 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.

5 participants