--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPzcO4idZco8oAQcWpRocE5XuRw%3DCrph7oaCqFnQw7-0W-jmAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
As far as I know, Jesse's advice was to use the more Java like iteration technique, rather than for / each.Mark Waite
On Sun, Apr 9, 2017 at 7:29 PM niristotle okram <nirish...@gmail.com> wrote:
Is anyone aware of iterating/looping either using a for / each inside a NonCPS method in a master slave environment?I am using the "readFile", DSL to read from the slave's workspace. And i parsing it via the jsonsluper. I am unable to loop through the object.Have anyone done this successfully?On Fri, Apr 7, 2017 at 12:36 PM, niristotle okram <nirish...@gmail.com> wrote:Can anyone say, if the issue of using '.each{ }' , with the closure in jenkins https://issues.jenkins-ci.org/browse/JENKINS-26481also affect a NonCPS method??I find it works okay in a master only env.
--Regards
nirish okram
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPzcO4idZco8oAQcWpRocE5XuRw%3DCrph7oaCqFnQw7-0W-jmAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtEH%3Dsg2MD6Vxr0WSruZsm%3D9%3D3O%3D6%3DN97LhawpfuY3KPnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
I have seen that mentioned somewhere in the past. But i am baffled as to why things works in the master and fails in the slave/agent.Can anyone spot where i am faulting. this have owned me for days now :( ... i am trying to generate an XML file. based on the data provided by a JSON file.The pipeline snippet isimport groovy.xml.*import groovy.json.JsonSlurpernode('slave1') {deleteDir()stage('Checkout') {checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [],userRemoteConfigs: [[credentialsId: 'b27f7cb2-efa8-496a-90d8-825b9332bf44', url: 'g...@somerepo.git']]])}writeFile file: "MyFile.XML", text: GenerateXML() //calling the method to generate the XML
println "Generated the manifest XML"}@NonCPSdef GenerateXML() {/*parsing the obj.json file*/def currentws = pwd()println currentwsdef jsonSlurper = new JsonSlurper();//def fileReader = new BufferedReader(new FileReader("${currentws}/objects.json")) //the file location need to change in the actual implementation
def fileReader = readFile "${currentws}/objects.json" // ^^avoided the above line to use the pipeline DSL
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPzcO4idZco8oAQcWpRocE5XuRw%3DCrph7oaCqFnQw7-0W-jmAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtEH%3Dsg2MD6Vxr0WSruZsm%3D9%3D3O%3D6%3DN97LhawpfuY3KPnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
----Regards
nirish okram
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPzcO4hNr8qFX6PmJjeSE4jhgUwxtxLi6kc8rsirJJa-%2BVArfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CA%2BnPnMyn1iD8qkDjK8xm5UTMvBb5%2BFtOGzVRF7wWkfho5_QjrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
On Mon 10 Apr 2017 at 06:02, niristotle okram <nirish...@gmail.com> wrote:I have seen that mentioned somewhere in the past. But i am baffled as to why things works in the master and fails in the slave/agent.Can anyone spot where i am faulting. this have owned me for days now :( ... i am trying to generate an XML file. based on the data provided by a JSON file.The pipeline snippet isimport groovy.xml.*import groovy.json.JsonSlurpernode('slave1') {deleteDir()stage('Checkout') {checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [],userRemoteConfigs: [[credentialsId: 'b27f7cb2-efa8-496a-90d8-825b9332bf44', url: 'g...@somerepo.git']]])}writeFile file: "MyFile.XML", text: GenerateXML() //calling the method to generate the XMLprintln "Generated the manifest XML"}@NonCPSdef GenerateXML() {/*parsing the obj.json file*/def currentws = pwd()println currentwsdef jsonSlurper = new JsonSlurper();//def fileReader = new BufferedReader(new FileReader("${currentws}/objects.json")) //the file location need to change in the actual implementationThis won't work as groovy always executes on the master. You need to use FilePath to get the remote file
def fileReader = readFile "${currentws}/objects.json" // ^^avoided the above line to use the pipeline DSLAfaik you can put CPS calls inside nonCPS
@NonCPS
method"That is certainly where the programming experience leads one. But this is unfortunate. It is rather bizarre to put a complete programming language such as groovy in front of someone and then say “but only use a tiny little bit of it.” Makes one wonder whether using groovy as a framework for this was a mistake from the get-go.
The notion of pushing ‘build’ operations down into scripts is perfectly sensible. The idea of having to ‘pull’ CI-integration activities ‘up into a plugin’ seems really unfortunate to me.
At any rate my personal experience with the NonCPS mechanism is that one needs to be thoughtful about defining what is inside the function and what is outside (e.g. passed in to the function). So, for example maybe do the file read outside of the function and pass a string into the GenerateXML() function.
def fileReader = readFile "${currentws}/objects.json" // ^^avoided the above line to use the pipeline DSL
Afaik you can put CPS calls inside nonCPS
No, it's not supported.
"You may not call regular (CPS-transformed) methods, or Pipeline steps, from a @NonCPS
method"
[snip]
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS4u8fp1_NFrNKCeop933Gier_f9MuhH1oMo480rHQ5z5A%40mail.gmail.com.