Drone

How to use Jsonnet multiple pipelines on OSS edition?

Hello,

I would like to use Jsonnet multiple pipelines on OSS edition (v1.7.0, single machine).

I tried following .drone.jsonnet, but I just got yaml: line 1: mapping values are not allowed in this context error.

local pipeline(version) = {
  kind: "pipeline",
  name: "default"+version,
  steps: [
    {
      name: "hello",
      image: "alpine:"+version,
      commands: [
        "echo hello"
      ]
    }
  ],
};

[
  pipeline('3.8'),
  pipeline('3.9'),
]

However, I ran .drone.yml generated by drone jsonnet --stream from the .drone.jsonnet successfully.

How can I run original multiple-pipelined .drone.jsonnet, or OSS edition doesn’t support multiple pipelines jsonnet?

I also read an article below, but I could not realize how to run.

Works fine for me. Did you configure using the jsonnet?

Hello, Matthias.

Did you configure using the jsonnet?

Yes, I’ve set DRONE_JSONNET_ENABLED as true and .drone.jsonnet on the filename of Configuration of pre-repository settings.

By the way, I was able to run same multiple jsonnet on v1.2.3 OSS edition.

1 Like

Hi,

I am having the same issue yaml: line 1: mapping values are not allowed in this context. Pipelines are locally converted successfully with drone jsonnet --stream.
Running single jsonnet pipelines are running fine on server side.
I have configured drone with native jsonnet support and I am running drone 1.9.0.

Any ideas on this?

@netumoliver you can find the source code and unit tests at the below link. There is code and unit tests to handle single-pipeline and multi-pipeline configurations and they are passing. So your best bet is to probably triage the code

You should also make sure your file has a .jsonnet suffix otherwise it will not be converted from jsonnet to yaml.