Skip to content

Commit

Permalink
jenkins: add workaround for groovy script & Java 11+ (#3019)
Browse files Browse the repository at this point in the history
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: jenkinsci/matrix-groovy-execution-strategy-plugin#20
Refs: #2984 (comment)
  • Loading branch information
richardlau authored Aug 25, 2022
1 parent 17762db commit dce00d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jenkins/scripts/VersionSelectorScript.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dce00d0

Please sign in to comment.