[JIRA] (JENKINS-36225) load step causes changes to parameters to be discarded
Title: Message Title Itai Sanders commented on JENKINS-36225 Re: load step causes changes to parameters to be discarded ok, I double checked. this doesn't happen with "normal" global variables, but only when retrieving those from build parameters. to reproduce, run the following pipeline code: stage 'setting build parameters' properties([parameters([string(defaultValue: 'SomeValue', description: '', name: 'GV')])]) node { stage 'preparing file system' deleteDir() writeFile file: 'myscript.groovy', text: ''' echo 'script loaded.' ''' stage 'edditing parameter variable' echo "$GV" GV = GV - 'Some' echo "$GV" stage 'running loading step' load 'myscript.groovy' stage 'result' echo "$GV" if (GV != 'Value') currentBuild.result = 'UNSTABLE' deleteDir() } you will need to run it twice, once to set the build parameter and the next one to use it. I get the following output: Entering stage setting build parameters Proceeding [Pipeline] properties [Pipeline] node Running on... [Pipeline] { [Pipeline] stage (preparing file system) Entering stage preparing file system Proceeding [Pipeline] deleteDir [Pipeline] writeFile [Pipeline] stage (edditing parameter variable) Entering stage edditing parameter variable Proceeding [Pipeline] echo SomeValue [Pipeline] echo Value [Pipeline] stage (running loading step) Entering stage running loading step Proceeding [Pipeline] load [Pipeline] { (myscript.groovy) [Pipeline] echo script loaded. [Pipeline] } [Pipeline] // load [Pipeline] stage (result) Entering stage result Proceeding [Pipeline] echo SomeValue [Pipeline] deleteDir [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline [Bitbucket] Notifying commit build result [Bitbucket] Build result notified Finished: UNSTABLE Add Comment
[JIRA] (JENKINS-36225) load step causes changes to parameters to be discarded
Title: Message Title Itai Sanders commented on JENKINS-36225 Re: load step causes changes to parameters to be discarded Jesse Glick I posted a pseudo-script for reproduction. I agree about the lexical variables preferences, but build parameters are passed as global variables (the scenario in which I've had the problem with in the first place). I didn't check this our for a while now (worked around it in my pipelines by reassigning the variables after each load step). I will try making sure this wasn't fixed along some other update and let you know the result. will post the actual script too if the problem still exists. Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- 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-36225) load step causes changes to parameters to be discarded
Title: Message Title Jesse Glick commented on JENKINS-36225 Re: load step causes changes to parameters to be discarded Steps to reproduce from scratch? Probably something to do with use of global variables. Prefer lexical variables (def keyword). Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- 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-36225) load step causes changes to parameters to be discarded
Title: Message Title Jesse Glick updated an issue Jenkins / JENKINS-36225 load step causes changes to parameters to be discarded Change By: Jesse Glick Component/s: workflow-cps-plugin Component/s: pipeline Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- 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-36225) load step causes changes to parameters to be discarded
Title: Message Title Kohsuke Kawaguchi updated an issue Jenkins / JENKINS-36225 load step causes changes to parameters to be discarded Change By: Kohsuke Kawaguchi I have a pipeline job which gets some string (choice) parameters.along the pipeline I edit one of those strings, and later on load a groovy script file using the load step.I noticed that the changes I made to the string hold just until the load step, and after that the variable somehow reverts back to the original value (as chosen when the build was initialized).e.g.parameter name: SomeParameterparameter value: SomeValuepipeline script: {noformat} echo SomeParameterSomeParameter = SomeParameter - 'Some'echo SomeParameterload file: 'myscript.groovy'echo SomeParameters {noformat} output: {noformat} [pipeline] echoSomeValue[pipeline] echoValue[pipeline] load[pipeline] echoSomeValue {noformat} Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups
[JIRA] (JENKINS-36225) load step causes changes to parameters to be discarded
Title: Message Title Itai Sanders created an issue Jenkins / JENKINS-36225 load step causes changes to parameters to be discarded Issue Type: Bug Assignee: Jesse Glick Components: workflow-plugin Created: 2016/Jun/26 1:08 PM Priority: Minor Reporter: Itai Sanders I have a pipeline job which gets some string (choice) parameters. along the pipeline I edit one of those strings, and later on load a groovy script file using the load step. I noticed that the changes I made to the string hold just until the load step, and after that the variable somehow reverts back to the original value (as chosen when the build was initialized). e.g. parameter name: SomeParameter parameter value: SomeValue pipeline script: echo SomeParameter SomeParameter = SomeParameter - 'Some' echo SomeParameter load file: 'myscript.groovy' echo SomeParameters output: [pipeline] echo SomeValue [pipeline] echo Value [pipeline] load [pipeline] echo SomeValue Add Comment