# Drone jsonnet - fails to compile node\_selector part

**URL:** <https://drone.discourse.group/t/drone-jsonnet-fails-to-compile-node-selector-part/11467>\
**Category:** Drone Bugs\
**Created:** [May 27, 2021, 9:44pm UTC](https://drone.discourse.group/t/drone-jsonnet-fails-to-compile-node-selector-part/11467 "2021-05-27T21:44:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mknapcok](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/mknapcok/32/2970_2.png) [@mknapcok](https://drone.discourse.group/u/mknapcok)\
**Post date:** [May 27, 2021, 9:44pm UTC](https://drone.discourse.group/t/drone-jsonnet-fails-to-compile-node-selector-part/11467/1 "2021-05-27T21:44:45Z")

</div>

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](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/b/b333f26bf5c2571abb7650476c8be469ed9b992b.png)

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 😅

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [May 27, 2021, 10:32pm UTC](https://drone.discourse.group/t/drone-jsonnet-fails-to-compile-node-selector-part/11467/2 "2021-05-27T22:32:56Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![mknapcok](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/mknapcok/32/2970_2.png) [@mknapcok](https://drone.discourse.group/u/mknapcok)\
**Post date:** [May 27, 2021, 11:13pm UTC](https://drone.discourse.group/t/drone-jsonnet-fails-to-compile-node-selector-part/11467/3 "2021-05-27T23:13:44Z")

</div>

Thanks. I see you updated the docker images at [https://hub.docker.com/r/drone/cli](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.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [May 28, 2021, 12:02am UTC](https://drone.discourse.group/t/drone-jsonnet-fails-to-compile-node-selector-part/11467/4 "2021-05-28T00:02:31Z")

</div>

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