[drone-cli] Issue parsing Jsonnet - cannot unmarshal

When I try to parse (drone jsonnet --stream --stdout) https://gist.github.com/TBK/a6adf432dce7337af8ba442b8580cd1c jsonnet template I get the following error:

2019/06/26 16:48:24 yaml: unmarshal errors:
line 10: cannot unmarshal !!seq into map[string]*yaml.Variable
line 25: cannot unmarshal !!seq into map[string]*yaml.Variable
line 40: cannot unmarshal !!seq into map[string]*yaml.Variable
line 54: cannot unmarshal !!seq into map[string]*yaml.Variable
line 202: cannot unmarshal !!seq into map[string]*yaml.Variable
line 220: cannot unmarshal !!seq into map[string]*yaml.Variable
line 240: cannot unmarshal !!seq into map[string]*yaml.Variable
line 260: cannot unmarshal !!seq into map[string]*yaml.Variable
line 279: cannot unmarshal !!seq into map[string]*yaml.Variable
line 300: cannot unmarshal !!seq into map[string]*yaml.Variable
line 324: cannot unmarshal !!seq into map[string]*yaml.Variable
line 344: cannot unmarshal !!seq into map[string]*yaml.Variable
line 366: cannot unmarshal !!seq into map[string]*yaml.Variable
line 388: cannot unmarshal !!seq into map[string]*yaml.Variable

I have tried to track down the issue and it seems related to drone-yaml.

Jsonnet (C cmd) and the Go variant passes the template successfully.

This tells me the generated yaml is not a valid .drone.yml. The reason it would pass the jsonnet (C cmd) and not the drone CLI is because the drone CLI performs linting on the generated file.

Specifically, it looks like you are using an array where a map is expected. I am not exactly sure where, but perhaps check your environment attributes. I hope that helps point you in the right direction.

Thanks. You are right. I had overlooked that environment attributes should be nested objects instead of an array.

Would it be possible to update the go-jsonnet dependency to support std.parseJson?