I am on Jenksin 2.46.2 and have a job that uses Active Choices Reactive Parameter. I select my servers in my first selection from a XML file using XMLSlurper and reference that for my second selection. When I hardcode the server name the code works fine. When I use the variable in my code I get an error.
This code works:
def serverList = new XmlSlurper().parse("/app/jenkins/jobs/servers.xml")
def SERVER = 'testserver1'
def output = []
serverList.Server.find { it.@name == SERVER}.CleanUp.GZIP.File.each{
it.output.add(p)
}
return output
When I reference the variable selection from my previous selection I get the error:
def serverList = new XmlSlurper().parse("/app/jenkins/jobs/servers.xml")
def SERVER = SERVER
def output = []
serverList.Server.find { it.@name == SERVER}.CleanUp.GZIP.File.each{
it.output.add(p)
}
return output
The error that I am getting is below. Any idea why I get an error?
WARNING: failed to serialize [[/app/test2/log], [/app/test2/log]] for ...*other text*... net.sf.json.JSONException: There is a cycle in the hierarchy!
Here is my XML file:
<ServerList>
<Server name="testserver1">
<CleanUP>
<GZIP>
<File KeepDays="30">/app/test1/log</File>
</GZIP>
</CleanUP>
</Server>
<Server name="testserver2">
<CleanUP>
<GZIP>
<File KeepDays="30">/app/test2/log</File>
</GZIP>
</CleanUP>
</Server>
</ServerList>
NE.jpg