-
Bug
-
Resolution: Not A Defect
-
Major
-
None
-
Jenkins 2.150.2
Credentials binding plugin 1.17
I have a pipeline that uses "withCredentials" to retrieve a secret file and a secret text, like the following:
pipeline { agent none (...) stages { (...) stage('Electron builder (win)') { agent { docker { image 'electronuserland/builder:wine' args '-u 0:0' } } steps { script { (...) withCredentials([file(credentialsId: 'code-signing-cert', variable: 'CSC_LINK'), string(credentialsId: 'code-signing-cert-pwd', variable: 'CSC_KEY_PASSWORD')]) { sh "npm run build -- ${environment}" } (...) } } } (...) } }
It was working for maybe 2 or 3 builds, then stopped working with the following error:
Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object (org.codehaus.groovy.runtime.GStringImpl call java.util.LinkedHashMap)
I noticed this appeared under Manage Jenkins > In-process Script Approval
I tried to approve it there, and then the "withCredentials" starts failing with the following error:
groovy.lang.MissingMethodException: No signature of method: java.lang.String.call() is applicable for argument types: (java.util.LinkedHashMap) values: [[credentialsId:code-signing-cert, variable:CSC_LINK]] Possible solutions: wait(), any(), wait(long), take(int), each(groovy.lang.Closure), any(groovy.lang.Closure)
I'm not sure what I'm doing wrong here and since the exact same piece of code worked before, it looks like a bug to me.