Drone-jsonnet not working

when using the CLI you need drone jsonnet --stream

I also get this error

yaml: line 2: mapping values are not allowed in this context

I don’t really understand why you started to comment about CURL and CLI commands. The problem is when I put a clear object in .drone.jsonnet everything goes fine:

{
"kind": "pipeline",
"type": "docker",
"name": "default",
"steps": [
    {
        "name": "build",
        "image": "alpine",
        "commands": [
            "echo hello world",
        ]
    }
]

}

But when I prepend it with any function it causes this error. Example:

local build(env) = {
  name: "build",
  image: "node:14.9.0",
  commands: [
    "yarn run build",
  ]
};

{
    "kind": "pipeline",
    "type": "docker",
    "name": "default",
    "steps": [
        build("hi")
    ]
}

Log errors:

{"commit":"b23aa7a47f0b0f016562e828842c7e90a44ef49c","error":"yaml: line 1: mapping values are not allowed in this context","event":"push","level":"warning","msg":"trigger: cannot parse yaml","ref":"refs/heads/feature/drone","repo":"schain/frontend","time":"2020-10-31T10:02:00Z"

And yes I changed repo setting to .drone.jsonnet surely

$ drone --version
drone version 1.2.2

the jsonnet conversion was previously handled by an external microservice [1], and in this comment the individual was trying to curl the microservice with an unsigned http request.

But when I prepend it with any function it causes this error.
And yes I changed repo setting to .drone.jsonnet surely

This happens if you do not enable jsonnet support on your server. You can enable jsonnet support on your server by setting the DRONE_JSONNET_ENABLED flag to true.

[1] https://github.com/drone/drone-jsonnet-config
[2] https://docs.drone.io/server/reference/drone-jsonnet-enabled/

1 Like