Closed mykolad closed 5 years ago
Hi @mykolad
Thanks for reporting this.
This is actually intended behavior, as the parameter string can contain mutliple key value pairs and the behavior so far is splitting the string by "," to divide individual pairs and then by ":" to distinguish between key/variable name and value.
This can be observed when looking at the log with your string:
2019-01-30T19:22:56.7003847Z Will trigger build with following parameters: 01VarName: TrafficManagerEndpoints: { "a": 50, "b": 50 }
2019-01-30T19:22:56.7753365Z Found parameter 01VarName with value: TrafficManagerEndpoints: { "a": 50
2019-01-30T19:22:56.7753602Z Found parameter "b" with value: 50 }
It is briefly described in here and in detail in the following issue
That leaves us with the following options:
However option 2 would definetly need some time as I don't have too much free time on my hands at the moment.
If you have some other ideas or questions please feel free to ask and share
Hi @huserben,
Thanks for the quick answer. I had to go with workaround with option 1 in my case.
It would be great if option 2 would be available as well. As an easy solution probably some way of escaping commas would work. Something like:
TrafficManagerEndpoints: { "a"\: 50\, "b"\: 50 }
Hi @mykolad
Sorry it took a bit longer as I used the chance and added proper unit testing to the service that triggers the build before I added the change - as this build parameters section is quite fragile I wanted to ensure I don't break existing things before adding a new feature.
I now have a dev version that works as follows:
I tested with the following Build Parameter string: "01VarName: { "a": 50, "b": 50 }, 02VarName: { "Value1": 12, "OtherObject": { "SomeValue": 13, "Child": { "Name": "MyChild" } } }"
And the output then will be the following:
If it's fine with you like this I'll try to push this change in the coming days (probably tomorrow or Wednesday if everything goes normal).
Please let me know whether you would be happy with that approach or if you see any problem.
Hi @huserben,
As for me, this sounds great. Next week I will be able to test it on my build to confirm the fix.
Thank you for the quick response!
@mykolad
I just uploaded the newest version of the package. Could you please give it a try with the newest version of the TriggerBuildTask and tell me whether everything works as expected or not?
Hi @mykolad
did you have time to verify the fix? Please let me know once you did and whether it worked or not.
Hi @huserben
I was able to check it and it works great. I passed parameters in Trigger Build task advanced configuration in this format: TrafficManagerEndpoints:{"$(DeploymentUnit)":50, "$(PreviousDeploymentUnit)":50}
And in my build definition they were correctly received as: TrafficManagerEndpoints:{"a":50, "b":50}
Thank you, the original issue I posted is resolved.
Hi @mykolad
thanks, thats nice to hear.
If you find something else that isn't working as expected or you think could be improved please don't hesitate to open up other issues.
I need to pass a parameter to build definition in JSON. In TriggerBuild task I define additional parameters something like this: TrafficManagerEndpoints: { "a": 50, "b": 50 }
But to build definition this parameter is sent with part after comma cut: TrafficManagerEndpoints={ "a": 50
As the result, I get partial invalid JSON string in my build definition
Please provide a way to pass JSON parameters to build definitions.