Open aleitamar opened 6 years ago
sounds like a bug, thank you! @borzamircea @AndreeaDora - have time to look at that? I guess we should call it by name
@soninob I think this could be fixed by getting hte parameter by key and not by index.
Something like:
JsonObject parameterJsonObject = (JsonObject) jsonParametersArray.get("branchParamName");
Thanks Mircea, care to supply a PR?
Will do in a couple of days once things are quieter.
Did some quick reading and the jsonArray only has get methods by index and not key: https://docs.oracle.com/javaee/7/api/javax/json/JsonArray.html
But apparently searching by key should do the trick.
https://stackoverflow.com/questions/42549545/get-value-by-key-jsonarray/42549752
JsonArray jsonParametersArray = parameterJsonObjectArray.getAsJsonArray("parameters");
for(int i=0;i<jsonParametersArray.length();i++)
{
JSONObject parameterJsonObject = jsonArray.getJSONObject(i);
if (parameterJsonObject.keySet().contains("branchParamName"))
{
values.setBranchName(parameterJsonObject.get("branchParamName").getAsString());
break;
}
}
This should work.
good! Thank you, waiting for your PR :-)
When verigreen tries to get the status of jenkins jobs, it assumes that the first parameter of the job will be the 'jenkins.branchParamName' parameter. https://github.com/Verigreen/verigreen/blob/93e4efed4dd63e3c99a26785abad8e90d7fe1a89/verigreen-collector-impl/src/main/java/com/verigreen/collector/jobs/CallJenkinsJob.java#L211
If the first parameter is a different one, verigreen fails with 'TRIGGER_FAILED', even after triggering the jenkins job successfully.
This should be fixed or documented (maybe as part of the FAQ 'TRIGGER_FAILED' section?)