[JIRA] (JENKINS-61857) Pipeline: Scope triggers in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals exception
Title: Message Title Simon Renger updated an issue Jenkins / JENKINS-61857 Pipeline: Scope triggers in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals exception Change By: Simon Renger Summary: Pipeline: Scope triggers in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals exceiption exception Add Comment This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.205720.1586446415000.8703.1586446440225%40Atlassian.JIRA.
[JIRA] (JENKINS-61857) Pipeline: Scope triggers in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals exceiption
Title: Message Title Simon Renger created an issue Jenkins / JENKINS-61857 Pipeline: Scope triggers in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals exceiption Issue Type: Bug Assignee: Unassigned Components: pipeline Created: 2020-04-09 15:33 Environment: Jenkins: 2.228 Windows Priority: Minor Reporter: Simon Renger Side Note: I do not have access to install plugins etc this is why I am using pipeline scripts etc extensive which might not be optimal. I am just a user of our school's build server. The following code part of my shared library. Situation: I have a global function p4c.withSwarm(credentials,p4Port,client,mapping,Closure body) Implementation: def withSwarmUrl(credentials,client,mapping,Closure body){ withCredentials([usernamePassword(credentialsId: credentials, passwordVariable: 'p4USERPASS', usernameVariable: 'p4USER' )]) { def url = swarmUrl(credentials,client,mapping) body(url,env.p4User,env.p4USERPASS) } } def withSwarm(credentials,p4Port,client,mapping,Closure body){ withSwarmUrl(env.P4USER,env.P4CLIENT,env.P4MAPPING) { url,user-> def p4Ticket = ticket(credentials,p4Port) body(user,p4Ticket,url) } }
[JIRA] (JENKINS-61857) Pipeline: Scope triggers in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals exception
Title: Message Title Simon Renger updated an issue Jenkins / JENKINS-61857 Pipeline: Scope triggers in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals exception Change By: Simon Renger _Side Note:_ I do not have access to install plugins etc this is why I am using pipeline scripts etc extensive which might not be optimal. I am just a user of our school's build server. The following code part of my shared library.*Situation:*I have a global function {code:java}p4c.withSwarm(credentials,p4Port,client,mapping,Closure body){code} _Implementation:_{code:java}def withSwarmUrl(credentials,client,mapping,Closure body){withCredentials([usernamePassword(credentialsId: credentials, passwordVariable: 'p4USERPASS', usernameVariable: 'p4USER' )]) {def url = swarmUrl(credentials,client,mapping)body(url,env.p4User,env.p4USERPASS)}}def withSwarm(credentials,p4Port,client,mapping,Closure body){withSwarmUrl(env.P4USER,env.P4CLIENT,env.P4MAPPING){ url,user->def p4Ticket = ticket(credentials,p4Port)body(user,p4Ticket,url)}}{code} Which I am using like this in my Jenkinsfile in a step: {code:java}p4c.withSwarm(env.P4USER,env.P4HOST,env.P4CLIENT,env.P4MAPPING,{user,ticket,swarmUrl ->swarm.setup(user,ticket,swarmUrl)def reviewObject = swarm.reviewInfo(reviewId)msg = swarmReviewToMessage(reviewObject)msg = discord.mentionUser(msg)}){code}The mention function is implemented as follows: {code:java}def mentionUser(message,filterFile="discord_filter.json"){if(!fileExists(filterFile)){error("Could not find ${filterFile}")return null;}def content = ""script {content = readFile file: filterFile}def jsonSlurper = new JsonSlurper()def filterObject = jsonSlurper.parseText(content)filterObject.discord_users.each{ key, value -> message = message.replace("${key}","<@${value}>")}return message}{code}Whenever I am using this setup I end up with the following exception:{code:java}an exception which occurred: in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@fcafd7 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@13817e5 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@220483 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@f8c2f3 in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@60419e in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@aea904 in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@18f41ab in field com.cloudbees.groovy.cps.impl.CallEnv.caller in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@11b98b6 in f
[JIRA] (JENKINS-61857) Pipeline: Scope triggers in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals exception
Title: Message Title Simon Renger closed an issue as Not A Defect Jenkins / JENKINS-61857 Pipeline: Scope triggers in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals exception Change By: Simon Renger Status: Open Closed Resolution: Not A Defect Add Comment This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.205720.1586446415000.8716.1586449320097%40Atlassian.JIRA.