I have a Jenkins job that spits out a json file with a bunch of values. Specifically, this file contains TCP port numbers from a virtual machine created using the Jenkins plugin.
I need to grab these port numbers from the json file and use their values in an ant build that I'll call as the next step of the jenkins job.
The json file looks somewhat like this:
{
"vms": [{
"interfaces": [{
"services": [{
"internal_port": 25,
"external_port": 12345,
"id": "smtp"
},
{
"internal_port": 80,
"external_port": 12346,
"id": "http"
}]
}]
}]
}
So I need to set a parameter for my ant script from this json to ${http.external.port} and ${smtp.external.port} properties.
Is is doable from a separate jenkins task? Do I have to do this within the same ant script? I prefer doing from a separate jenkins step because this same ant script is used from other jobs that don't generate the json file (I'm getting the parameters from a static .properties file).