Drone cli output is different from jsonnet cli

I’m trying to migrate our dronefiles from yaml to jsonnet and I’m finding some odd behaviours from the drone cli.

Here is a simple jsonnet file.

local Pipeline(name) = {
  kind: 'pipeline',
  type: 'kubernetes',
  name: name,
  steps: [
      name: 'publishToEcr',
      image: 'plugins/ecr',
      settings: {
        dockerfile: 'service1/Dockerfile',
        access_key: {
          from_secret: 'aws_access_key_id',
        secret_key: {
          from_secret: 'aws_secret_access_key',
        repo: 'drone-test/service1',
        registry: '1234556.dkr.ecr.us-east-1.amazonaws.com',
        region: 'us-east-1',
        tags: [

local whenCommitToNonMaster(step) = step {
  when: {
    event: ['push'],
    branch: {
      exclude: ['master'],


when I run

drone jsonnet --stream --stdout

I don’t get the when: stanza at the Pipeline(‘A’) for some reasons.

but at the same time if I use the jsonnet cli I get the intended behaviour and the when: stanza appears at Pipeline(‘A’)

jsonnet .drone.jsonnet

also there are some functions from the jsonnet Standard Library that make drone cli panic like std.parseJson and others.

Hello , Kindly share the drone cli version and also could you try $ drone jsonnet --stdout --stream

[I] ➜  testjsonnet drone jsonnet --stdout --stream
2020/11/25 00:30:17 RUNTIME ERROR: Field does not exist: parseJson
	.drone.jsonnet:13:22-35	function <splitter_env>
	.drone.jsonnet:136:16-34	object <anonymous>
	<std>:1245:30-34	thunk from <thunk from <function <anonymous>>>
	<std>:1239:24-25	thunk from <thunk <t> from <function <anonymous>>>
	<std>:1239:15-26	thunk <t> from <function <anonymous>>
	<std>:1240:8-9	function <anonymous>

	<std>:1245:20-35	thunk from <function <anonymous>>
	<std>:1231:10-11	function <isContent>

	<std>:1245:10-36	function <anonymous>
		builtin function <flatMap>

	.drone.jsonnet:(133:36)-(140:3)	function <service>
	.drone.jsonnet:355:5-88	thunk from <object <anonymous>>
	During manifestation
[I] ➜  testjsonnet drone --version
drone version 1.2.4

the when stanza can be added to steps, however, in the above example you are adding the when stanza to the pipeline, which is why it is being ignored. Perhaps you intended to add the trigger stanza to the pipeline instead?

source: https://docs.drone.io/pipeline/docker/syntax/trigger/

local whenCommitToNonMaster(step) = step {
- when: {
+ trigger: {
    event: ['push'],
    branch: {
      exclude: ['master'],

yes that was the problem indeed thanks a lot. But the parseJson problem still happening tho. drone cli panics when I add it even tho it’s on the jsonnet std

even tho it’s on the jsonnet std

the command line tools uses an older version of jsonnet-go which is probably why the function does not exist, since it was not yet part of the standard library at that time. If you are interested in upgrading the jsonnet module used by the command line tools, please consider sending a pull request to github.com/drone/drone-cli.

Someone already did it. Can it get reviewed please? https://github.com/drone/drone-cli/pull/174