Skip to content

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

Merged
joaopapereira merged 1 commit into
carvel-dev:masterfrom
mamachanko:topic/mamachanko/master/x-in-prerelease
Apr 2, 2024
Merged

Don't treat x in pre-release and build metadata identifiers as a wild…#4
joaopapereira merged 1 commit into
carvel-dev:masterfrom
mamachanko:topic/mamachanko/master/x-in-prerelease

Conversation

@mamachanko

@mamachanko mamachanko commented Mar 28, 2024

Copy link
Copy Markdown

…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
Copy Markdown
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
Comment thread v4/range.go Outdated
@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
Copy Markdown
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
Copy Markdown
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

…card

Signed-off-by: Max Brauer <mbrauer@vmware.com>
@mamachanko mamachanko force-pushed the topic/mamachanko/master/x-in-prerelease branch from ecd11d2 to e1ecfdc Compare April 2, 2024 11:08
@mamachanko

mamachanko commented Apr 2, 2024

Copy link
Copy Markdown
Author

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

@Zebradil Zebradil left a comment

Copy link
Copy Markdown
Member

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

@joaopapereira joaopapereira left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@joaopapereira

Copy link
Copy Markdown
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
@Zebradil

Zebradil commented Apr 2, 2024

Copy link
Copy Markdown
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.

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