compareVersions returns 2 or -2

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      According to the documentation, the possible return values of the step compareVersions are -1, 0 and 1.

      The following code snippet gives a return value of -2.

      // Scripted syntax
      node {
          stage('test') {
              String tag1 = '1.2.3'
              String tag2 = '1.2.3-myBranch-SNAPSHOT'
              def comparisonResult = compareVersions(v1: tag1, v2: tag2)
              echo comparisonResult.toString()
          }
      } 

      Inverting arguments v1 and v2 results in -2 as the return value.

      This return value is not documented.

      • Is this a bug?
      • Is the documentation incomplete?

      If the latter, what is the logic behind this return value, and how does it differ from -1 (or 1)?

            Assignee:
            rsandell
            Reporter:
            Robin Fauvel
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: