cathive / concourse-sonarqube-resource

performs SonarQube analyses and checks quality gates https://concourse-ci.org/ https://sonarqube.org/
Apache License 2.0
46 stars 49 forks source link

"additional_parameters" section only contains first item listed #14

Closed strimber closed 6 years ago

strimber commented 6 years ago

When we execute the following line (153) from out:

read -r -a props_kv_arr <<< "$(jq -r 'to_entries|map("(.key)=\"(.value|tostring)\"")|.[]' <<< "${additional_properties}")"

The props_ky_arr only contains the first value "param.foo: bar" we would expect all additional properties to be appended to the -Dparameter list...

possible solution: read -d ‘,’ -r -a props_kv_arr <<< “$(jq -r ‘to_entries|map(“(.key)=\“(.value|tostring)\“”)|.[]’ <<< “${additional_properties}“)” -d to specify the delimiter which is comma (,) in this case

sample input json:

{ “params”: { “project_path”: “cli_project”, “project_key”: “com.example.cli_project”, “sources”: [ “src1”, “src2" ], “additional_properties”: { “param.foo”: “bar”, “param1.foo1": “bar1” } }, “source”: { “host_url”: “https://sonar.example.com/“, “login”: “$$ACCESS_TOKEN$$” } }

headcr4sh commented 6 years ago

Ouch. Probably I bug that has been introduced by my (very) limited knowledge of the jq parser.