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

Check the versionSelection before install/update #4222

Merged
merged 6 commits into from
Feb 8, 2022

Conversation

antgamdia
Copy link
Contributor

@antgamdia antgamdia commented Feb 2, 2022

Description of the change

I've noticed I've been having some issues when installing some carvel packages: they got "installed" but never reconcillied.
The problem was that we were requesting a version that should not be selected. For instance, a prerelease when they are disabled by default.
Idem when updating: nothing prevents one from selecting a previous version, regardless of the default config.

Benefits

The version will be checked before installing, this way the user will get a friendly message.

Possible drawbacks

Although IMO, this assertion belongs in the backend world, we should ensure we only display "valid" versions in the user-faced UI selectors.

Applicable issues

Additional information

Marked as a draft as tests are still missing.

image

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
}

// Ensure the selected version can be, actually installed to let the user know before installing
elegibleVersion, err := versions.HighestConstrainedVersion([]string{pkgVersion}, vendirversions.VersionSelection{Semver: versionSelection})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is how kapp-ctrl is actually doing that; which makes me wonder: should we use vendir from carvel instead of other semver dependencies?

Copy link
Contributor

Choose a reason for hiding this comment

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

If it suits our needs, sure.

@antgamdia antgamdia marked this pull request as ready for review February 4, 2022 00:02
Copy link
Contributor

@absoludity absoludity left a comment

Choose a reason for hiding this comment

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

Although IMO, this assertion belongs in the backend world, we should ensure we only display "valid" versions in the user-faced UI selectors.

I agree (that we should only present the valid versions for upgrading), but that wouldn't obviate the need for this change would it? (given that it's an API, so a request could come in to install an invalid version regardless of what we present in the UX).

}

// Ensure the selected version can be, actually installed to let the user know before installing
elegibleVersion, err := versions.HighestConstrainedVersion([]string{pkgVersion}, vendirversions.VersionSelection{Semver: versionSelection})
Copy link
Contributor

Choose a reason for hiding this comment

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

If it suits our needs, sure.

@antgamdia antgamdia merged commit 567d288 into vmware-tanzu:main Feb 8, 2022
@antgamdia antgamdia deleted the elegibleVersions branch February 8, 2022 15:28
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.

None yet

2 participants