Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-72401

The priorities defined in JCasC are not set correctly in Jenkins

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • prioritysorter-plugin
    • None
    • jenkins:2.414.3-lts-alpine
      priority-sorter 5.0.0

      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.

            Unassigned Unassigned
            cytrek Jan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: