Skip to content

semver < doesn't seem to work correctly #287

Description

@jhheider

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.

Activity

  1. mxcl commented on Jan 24, 2024

    @mxcl
    Contributor

    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?

  2. jhheider commented on Jan 24, 2024

    @jhheider
    ContributorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions