[JIRA] (JENKINS-55420) local variables in shared-library global vars being treated globally
Title: Message Title Stefan Maurer commented on JENKINS-55420 Re: local variables in shared-library global vars being treated globally Thanks Brian J Murrell. Now I understand. Indeed quiet simple Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- 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. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-55420) local variables in shared-library global vars being treated globally
Title: Message Title Brian J Murrell resolved as Not A Defect Jenkins / JENKINS-55420 local variables in shared-library global vars being treated globally Change By: Brian J Murrell Status: Open Resolved Resolution: Not A Defect Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- 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. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-55420) local variables in shared-library global vars being treated globally
Title: Message Title Brian J Murrell commented on JENKINS-55420 Re: local variables in shared-library global vars being treated globally Stefan Maurer I'm not sure that code snippets is needed. The solution is to quite simply add def in front of your variables to make them local. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- 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. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-55420) local variables in shared-library global vars being treated globally
Title: Message Title Brian J Murrell edited a comment on JENKINS-55420 Re: local variables in shared-library global vars being treated globally Not sure if what is described in the description of this ticket is the expected behaviour and if my solution is the expected solution, so I will leave this open for somebody else to decide and resolve if so.What resolved this for me was to {{def}}ine my variables in my {{provisionNodes}} "global variable" (i.e. {{vars/provisionNodes}}). That made them act local to {{provisionNodes}}. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- 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. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-55420) local variables in shared-library global vars being treated globally
Title: Message Title Stefan Maurer commented on JENKINS-55420 Re: local variables in shared-library global vars being treated globally Brian J Murrell: can you please explain your solution in more detail and/or with some code snippets? How do you define the variables? Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- 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. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-55420) local variables in shared-library global vars being treated globally
Title: Message Title Andrew Bayer updated an issue Jenkins / JENKINS-55420 local variables in shared-library global vars being treated globally Change By: Andrew Bayer Component/s: workflow-cps-global-lib-plugin Component/s: pipeline Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- 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. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-55420) local variables in shared-library global vars being treated globally
Title: Message Title Brian J Murrell commented on JENKINS-55420 Re: local variables in shared-library global vars being treated globally Not sure if what is described in the description of this ticket is the expected behaviour and if my solution is the expected solution, so I will leave this open for somebody else to decide and resolve if so. What resolved this for me was to def}}ine my variables in my {{provisionNodes "global variable" (i.e. vars/provisionNodes). That made them act local to provisionNodes. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- 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. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-55420) local variables in shared-library global vars being treated globally
Title: Message Title Brian J Murrell created an issue Jenkins / JENKINS-55420 local variables in shared-library global vars being treated globally Issue Type: Bug Assignee: Unassigned Components: pipeline Created: 2019-01-07 06:08 Environment: Jenkins ver. 2.121.2 Priority: Critical Reporter: Brian J Murrell I have a shared library that defines a global variable provisionNodes. Inside that global variable a local variable is defined to hold the value of a passed in parameter: nodeString = config['NODELIST'] The following code then optionally reassigns the variable if a subset of nodes is wanted (the logic of below is not really important): if (config['node_count']) { node_list = config['NODELIST'].split(',') node_cnt = node_list.size() if (config['node_count'] < node_cnt) { // take is blacklisted by Jenkins. //new_list = node_list.take(config['clients']) new_list = [] for (ii = 0; ii < config['node_count']; ii++) { new_list.add(node_list[ii]) } nodeString = new_list.join(',') } else if (config['node_count'] > node_cnt) { echo "${config['node_count']} clients requested." error "Only ${node_cnt} clients available!" } } ...