Backport https://github.com/jenkinsci/jenkins/pull/5890 into 2.319.x
PR 5956 merge to stable-2.319 before