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

Don't treat x in pre-release and build metadata identifiers as a wild… #4

Conversation

mamachanko
Copy link

@mamachanko mamachanko commented Mar 28, 2024

…card

I don't think we would want to extend logic to wildcards inside pre-release and build metadata identifiers.

Would need flow up through vendir into kapp-controller.

refs:

@mamachanko mamachanko force-pushed the topic/mamachanko/master/x-in-prerelease branch from 1426926 to 6d25636 Compare March 28, 2024 12:28
@mamachanko
Copy link
Author

In the absence of CI

pushd v4 && go test -v ./... && popd

passes ✅

@mamachanko mamachanko marked this pull request as ready for review March 28, 2024 12:29
@mamachanko mamachanko force-pushed the topic/mamachanko/master/x-in-prerelease branch from 6d25636 to ecd11d2 Compare March 28, 2024 13:55
@mamachanko mamachanko requested a review from Zebradil March 28, 2024 13:55
@praveenrewar
Copy link
Member

I am not an expert at semver, however the changes looks good to me.
Out of curiosity, any reason not to use the changes from original PR in blang/semver?

@Zebradil
Copy link
Member

In the upstream PR this test fails:

?       github.com/blang/semver/v4/examples [no test files]
--- FAIL: TestParseRange (0.00s)
    range_test.go:511: Invalid for case "1.2.3+experimental.2" matching "1.2.3+experimental.1": Expected false, got: true
    range_test.go:511: Invalid for case "1.2.3+experimental.2" matching "1.2.3+experimental.3": Expected false, got: true
FAIL
FAIL    github.com/blang/semver/v4  0.002s
FAIL

@mamachanko mamachanko force-pushed the topic/mamachanko/master/x-in-prerelease branch from ecd11d2 to e1ecfdc Compare April 2, 2024 11:08
@mamachanko
Copy link
Author

mamachanko commented Apr 2, 2024

In the upstream PR this test fails:

?       github.com/blang/semver/v4/examples [no test files]
--- FAIL: TestParseRange (0.00s)
    range_test.go:511: Invalid for case "1.2.3+experimental.2" matching "1.2.3+experimental.1": Expected false, got: true
    range_test.go:511: Invalid for case "1.2.3+experimental.2" matching "1.2.3+experimental.3": Expected false, got: true
FAIL
FAIL    github.com/blang/semver/v4  0.002s
FAIL

Thank you for bringing that up, @Zebradil! I wasn't aware of the pending (since 3y! 😆) blang#76. However, after studying it I partially incorporated the suggested changes here.

The test for .x as suggested by blang#76 is nice and simple, but the pre-release and build metadata identifiers need to be trimmed first. That's because either may contain .x. I've added tests for those scenarios and refactored things a little.

@Zebradil @praveenrewar ready for review! 🙇🏻

Fwiw, I don't think we really consider github.com/blang/semver "upstream upstream" anymore since it is no longer maintained and github.com/carvel-dev/semver is ahead by one or two fixes and features. I may be wrong here.

@mamachanko mamachanko requested a review from Zebradil April 2, 2024 11:15
Copy link
Member

@Zebradil Zebradil left a comment

Choose a reason for hiding this comment

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

LGTM

By the way, I think it worth considering switching to a more popular and better maintained semver library, for example this one: https://github.com/Masterminds/semver

Copy link
Member

@joaopapereira joaopapereira left a comment

Choose a reason for hiding this comment

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

LGTM

@joaopapereira
Copy link
Member

@Zebradil I would tend to agree but we would have to ensure that the features that exist in this repo also exist in that semver library, so some work needs to be done to ensure it.

@joaopapereira joaopapereira merged commit beb83fb into carvel-dev:master Apr 2, 2024
1 check passed
@Zebradil
Copy link
Member

Zebradil commented Apr 2, 2024

@Zebradil I would tend to agree but we would have to ensure that the features that exist in this repo also exist in that semver library, so some work needs to be done to ensure it.

Agree, it'd probably require a lot of effort without immediate benefits.

@mamachanko mamachanko deleted the topic/mamachanko/master/x-in-prerelease branch April 3, 2024 06:35
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.

4 participants