From 0610a7cace65396f3a63e91ae3e020fe9d1cef02 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Thu, 25 Aug 2022 15:25:33 -0400 Subject: [PATCH] jenkins: add workaround for groovy script & Java 11+ The Matrix Groovy Execution Strategy plugin appears to have an issue on Java 11+ where string parameters are appearing as byte arrays instead of strings. Use the new String() constructor instead of toString() to ensure we get string repesentation of the parameter. Refs: https://github.com/jenkinsci/matrix-groovy-execution-strategy-plugin/issues/20 --- jenkins/scripts/VersionSelectorScript.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkins/scripts/VersionSelectorScript.groovy b/jenkins/scripts/VersionSelectorScript.groovy index 6cf51a284..a3eb96c4e 100644 --- a/jenkins/scripts/VersionSelectorScript.groovy +++ b/jenkins/scripts/VersionSelectorScript.groovy @@ -158,9 +158,9 @@ def canBuild = { nodeVersion, builderLabel, buildType -> int nodeMajorVersion = -1 if (parameters['NODEJS_MAJOR_VERSION']) - nodeMajorVersion = parameters['NODEJS_MAJOR_VERSION'].toString().toInteger() + nodeMajorVersion = new String(parameters['NODEJS_MAJOR_VERSION']).toInteger() println "Node.js major version: $nodeMajorVersion" -println "Node.js version: ${parameters['NODEJS_VERSION']}" +println "Node.js version: ${new String(parameters['NODEJS_VERSION'])}" // NOTE: this assumes that the default "Slaves"->"Name" in the Configuration // Matrix is left as "nodes", if it's changed then `it.nodes` below won't work