brewkit icon indicating copy to clipboard operation
brewkit copied to clipboard

semver `<` doesn't seem to work correctly

Open jhheider opened this issue 1 year ago • 2 comments

trying to exclude a test for a specific version of jenkins.io; this should work:

    - run: jenkins-lts --version | grep {{version}}
      if: '<2.426.3 || >2.426.3'

but doesn't. indeed, even this doesn't work:

    - run: jenkins-lts --version | grep {{version}}
      if: '<2.426.3 || >2.426.4'

but this does:

    - run: jenkins-lts --version | grep {{version}}
      if: '<2.426.3 || >=2.426.4'

so, there's something up with the handling of the > operator.

jhheider avatar Jan 24 '24 15:01 jhheider

we don’t support > since it is ambiguous what the user means.

eg. > 1.2.3 will allow 1.2.3.1 but you probably mean 1.2.4 and above

Probably the error message should state that or we should just allow 1.2.3.1 and it's your own fault. What you think?

mxcl avatar Jan 24 '24 16:01 mxcl

well, i personally think its the latter. i don't consider 1.2.3.1 > 1.2.3 ambiguous (since "1.2.4 and above" is expressly >=1.2.4), but i agree it'll catch someone by surprise.

i suppose the other option would be to get fancy and support something like:

  - if: next_patch(1.2.3)
  - if: next_major(1.2.3)

that's what github would do.

edited to add: i was using > specifically because i wasn't in a >=2.426.4 situation trying to exclude a single version. perhaps a negation operation would have been simpler, but yuck.

jhheider avatar Jan 24 '24 16:01 jhheider