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

Make dirty versions SLS-orderable #318

Open
rshkv opened this issue Mar 2, 2020 · 3 comments
Open

Make dirty versions SLS-orderable #318

rshkv opened this issue Mar 2, 2020 · 3 comments

Comments

@rshkv
Copy link

rshkv commented Mar 2, 2020

What happened?

Dirty versions cause errors where version strings are expected to be orderable according to SLS spec.

Caused by: com.palantir.logsafe.exceptions.SafeIllegalArgumentException: Not an orderable version: {value}: {value=1.203.1-8-ge437d05.dirty}
    at com.palantir.logsafe.Preconditions.checkArgument(Preconditions.java:64)
    at com.palantir.sls.versions.OrderableSlsVersion.valueOf(OrderableSlsVersion.java:48)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    ...

Validation is failing in OrderableSlsVersion.java.

What did you want to happen?

Unsure.

  1. Maybe make dirty versions orderable according to SLS (Github), though there's probably not much you can do with the .dirty bit.
  2. Add sth. like gitOrderableVersion() which returns the version without .dirty.
@rshkv
Copy link
Author

rshkv commented Mar 2, 2020

Oh, I noticed #50 and palantir/sls-packaging#202. It looks like sls-packing allows .dirty already, but sls-version-java doesn't.

@iamdanfox
Copy link
Contributor

I think it a sensible outcome that when an orderable version is required, .dirty is rejected because they are not orderable. We specifically made sls-packaging lenient to avoid this problem. Pasted from the sls-spec:

Non-orderable version strings
Version strings follow the non-orderable format if they match the follow regular expression:
^[0-9]+.[0-9]+.[0-9]+(-[a-z0-9-]+)?(.dirty)?$
For example, 1.0.0.dirty, 0.0.1-custom-description-42, and 2.0.0-1-gaaaaaa.dirty are valid but non-orderable version strings, whereas 5.0, 1.1.2.3-foo, 1.1.2.3 and 1.0.0-FOO are not valid version strings under this spec.

There are no ordering guarantees for a pair of non-orderable versions, or between an orderable and a non-orderable version string.

@rshkv
Copy link
Author

rshkv commented Jan 13, 2021

I see, if that's the spec that makes sense. Perhaps you'd take a gitVersionClean() that will not add .dirty?

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

No branches or pull requests

2 participants