-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor
-
Component/s: prioritysorter-plugin
-
None
-
Environment: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.