From 0924e0dbc22b580cb39d5901b63093e6b8b7ed91 Mon Sep 17 00:00:00 2001 From: "AO Industries, Inc" Date: Sun, 8 Oct 2023 01:43:30 +0000 Subject: [PATCH] Base nice value off params.BuildPriority This will help user-prioritized builds complete first. --- Jenkinsfile | 10 ++++++---- book/Jenkinsfile | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9cfd82e..2bb60e1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -113,8 +113,8 @@ def upstreamProjects = [ * 10 + buildPriority * 2 * * * * nice The nice level to run the build processes or 0 for none. * - * Default depends on buildPriority: * - * min(19, buildPriority - 1) * + * Default depends on params.BuildPriority: * + * min(19, params.BuildPriority - 1) * * * * maven The Maven tool to use. * * Defaults to 'maven-3' * @@ -438,8 +438,9 @@ if (!binding.hasVariable('quietPeriod')) { binding.setVariable('quietPeriod', 10 + buildPriority * 2) } if (!binding.hasVariable('nice')) { - def nice = buildPriority - 1; - if (nice > 19) nice = 19; + def nice = (params.BuildPriority as Integer) - 1; + if (nice < 0) nice = 0; + else if (nice > 19) nice = 19; binding.setVariable('nice', nice) } if (!binding.hasVariable('maven')) { @@ -592,6 +593,7 @@ pipeline { name: 'BuildPriority', defaultValue: "$buildPriority", description: """Specify the priority of this build. +Must be between 1 and 30, with lower values built first. Defaults to project's depth in the upstream project graph.""" ) booleanParam( diff --git a/book/Jenkinsfile b/book/Jenkinsfile index a625429..0766df9 100644 --- a/book/Jenkinsfile +++ b/book/Jenkinsfile @@ -117,8 +117,8 @@ def upstreamProjects = [ * 10 + buildPriority * 2 * * * * nice The nice level to run the build processes or 0 for none. * - * Default depends on buildPriority: * - * min(19, buildPriority - 1) * + * Default depends on params.BuildPriority: * + * min(19, params.BuildPriority - 1) * * * * maven The Maven tool to use. * * Defaults to 'maven-3' * @@ -442,8 +442,9 @@ if (!binding.hasVariable('quietPeriod')) { binding.setVariable('quietPeriod', 10 + buildPriority * 2) } if (!binding.hasVariable('nice')) { - def nice = buildPriority - 1; - if (nice > 19) nice = 19; + def nice = (params.BuildPriority as Integer) - 1; + if (nice < 0) nice = 0; + else if (nice > 19) nice = 19; binding.setVariable('nice', nice) } if (!binding.hasVariable('maven')) { @@ -596,6 +597,7 @@ pipeline { name: 'BuildPriority', defaultValue: "$buildPriority", description: """Specify the priority of this build. +Must be between 1 and 30, with lower values built first. Defaults to project's depth in the upstream project graph.""" ) booleanParam(