The priorities defined in JCasC are not set correctly in Jenkins

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

XMLWordPrintable

      Reproduction steps

      1. Set the following config for priority-sorter

      priorityConfiguration:
        jobGroups:
          - jobGroupStrategy: "allJobs"
            priority: -1
            priorityStrategies:
              - buildParameterStrategy:
                  parameterName: "PRIORITY"
              - userIdCauseStrategy:
                  priority: 4
            usePriorityStrategies: true
      prioritySorterConfiguration:
        onlyAdminsMayEditPriorityConfiguration: true
        strategy:
          absoluteStrategy:
            defaultPriority: 5
            numberOfPriorities: 7
      

      2. Start Jenkins with the above configuration

      Observed result

      The actual value of the userIdCausePriority is 3 as can be shown by extracting the configuration of the plugin from the instance of Jenkins.

      priorityStrategy:
        userIdCauseStrategy:
          priority: 3
      

      Expected result

      The expected value of the userIdCausePriority is 4 as defined in the input configuration file.

      priorityStrategy:
        userIdCauseStrategy:
          priority: 4
      

      Root cause

      The 'scale' method in PriorityCalculationsUtil seems to be called when the JCasC configuration is being applied. The method returns distorted results due to numerical anomalies - apparently the actual float values are a little smaller/bigger than expected ones (e.g. 0.3(9) instead of 0.4) so the used 'floor' and 'ceil' functions may lead to wrong results.

            Assignee:
            Unassigned
            Reporter:
            Jan
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: