Drone jsonnet - fails to compile node_selector part

Hi,
I’m using drone/cli from [Docker Hub](https://hub.docker.com/r/drone/cli) to compile my jsonnet configuration to produce drone-config.yaml. And I can’t find a way how to compile node_selector part to output yaml configuration. Here’s a snippet:

build(NAME, TYPE, ENVS): {
kind: ‘pipeline’,
type: ‘kubernetes’,
name: NAME,
clone: {
depth: 1,
},
trigger: {
event: [‘push’],
},
node_selector: {
Type: ‘spot-8’,
},
steps: [
build_steps.step_restore(),
build_steps.step_deps(),
build_steps.step_build(NAME, ENVS),
build_steps.step_image_ecr(NAME, TYPE),
],
},

For better readability, here’s a picture:
image

Unfortunately, the “node_selector” part doesn’t propagate to the outputted YAML.

Although the YAML is normally generated out of jsonnet source I managed to hard-code the “node_selector” part, commit and run this pipeline and it works, so I don’t think the syntax is the problem.
When I use other jsonnet compiler, it works. In my experience, I already know, that drone jsonnet compiler ommits some parts if it considers useless ( happened to me with triggers). But I don’t see a reason here, why would it ommit this “node_selector” part.

Thanks for the answer. I’m desperate with this one :sweat_smile:

the drone jsonnet command was created for docker pipelines, not kubernetes pipelines, and is therefore un-aware of kubernetes-specific fields. I believe this is fixed in master, but unless you are running the CLI from source you would need to use drone jsonnet --format=false to avoid pretty-printing the yaml (which omits unknown fields).

Thanks. I see you updated the docker images at https://hub.docker.com/r/drone/cli and now the image with tag “latest” is using the flag --format=false by default.
Actually I’d like to keep the output in YAML as it was. Is there a way I could use the master branche version of drone/cli that supports kubernetes pipelines syntax with use of YAML output instead of JSON?
Thanks.

yaml is a superset of json, so technically the output is still yaml :slight_smile: