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

fix: use imager incoming version for extension validation #9696

Conversation

frezbo
Copy link
Member

@frezbo frezbo commented Nov 11, 2024

Use the version coming from imager to validate extension constraints.

Part of : #9694

func (ext *Extension) Validate() error {
if err := ext.validateConstraints(); err != nil {
func (ext *Extension) Validate(talosVersion semver.Version) error {
if err := ext.validateConstraints(talosVersion); err != nil {
return err
}

return ext.validateContents()
Copy link
Member

Choose a reason for hiding this comment

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

how about validateContents() - as it's different for different versions of Talos, it might still break?

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess then we need have something similar to quirks for extension allowed paths

Copy link
Member

Choose a reason for hiding this comment

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

yep, either that, or a way to disable it in Validate() - e.g. Image Factory works on actually approved/shipped versions, so contents should be fine?

@frezbo frezbo force-pushed the fix/use-imager-version-for-extension-validation branch from 2ba26a8 to e2116d7 Compare November 11, 2024 17:58
@@ -24,6 +24,8 @@ type Builder struct {
Arch string
// ExtensionTreePath is a path to the extracted extension tree.
ExtensionTreePath string
// ExtensionValidateContents enables validation of the extension contents.
ExtensionValidateContents bool
Copy link
Member Author

Choose a reason for hiding this comment

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

I can drop this since we only use it for the deprecated .machine.install.extensions https://github.com/siderolabs/talos/pull/9696/files#diff-9adbdc7691682c62b382f9040db20e4e0d54e5be12c74378bef14a586a4adf20R22

if constraint != "" {
talosVersion, err := semver.ParseTolerant(version.Tag)
// Validate the extension: compatibility, contents, etc.
func (ext *Extension) Validate(opts ...ValidationOption) error {
Copy link
Member Author

Choose a reason for hiding this comment

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

did this, so Validate is backword compatible, I could also negate the options, so Validate works as is

@frezbo frezbo force-pushed the fix/use-imager-version-for-extension-validation branch from e2116d7 to 0fb8078 Compare November 12, 2024 09:53
Use the version coming from imager to validate extension constraints.

Part of : siderolabs#9694

Signed-off-by: Noel Georgi <git@frezbo.dev>
@frezbo frezbo force-pushed the fix/use-imager-version-for-extension-validation branch from 0fb8078 to 682718d Compare November 12, 2024 09:57
@frezbo
Copy link
Member Author

frezbo commented Nov 12, 2024

/m

@talos-bot talos-bot merged commit 682718d into siderolabs:main Nov 12, 2024
50 checks passed
@frezbo frezbo deleted the fix/use-imager-version-for-extension-validation branch November 12, 2024 11:05
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