Fixes issue that all Jobs always belongs to all JobGroups
The returned priority must be in the allowed range.
Merge remote-tracking branch 'choose_remote_name/master' into DealWithMatrixBuilds-(JENKINS-8597)
[JENKINS-8597] Deal with matrix builds better