[solved] Jsonnet error when used for multiple pipeline

drone-kube-runner: 1.0.0-beta-2
drone: 1.6.5
drone-registry-plugin: 1.0.0
drone-cli: 1.2.1

Taken from the swift example for multi-version: https://docs.drone.io/pipeline/kubernetes/examples/language/swift/#test-multiple-versions

I followed along, but I couldn’t get drone jsonnet command to work, haven’t tried on the server itself.

➜  temp drone jsonnet
2020/04/02 00:04:08 yaml: unmarshal errors:
  line 1: cannot unmarshal !!seq into yaml.RawResource
local Pipeline(version) = {
  kind: "pipeline",
  type: "kubernetes",
  name: "swift"+version,
  steps: [
    {
      name: "test",
      image: "swift:"+version,
      commands: [
        "swift build",
        "swift test"
      ]
    }
  ]
};

[
  Pipeline("3"),
  Pipeline("4"),
]

If your jsonnet file returns an array, you need to include the --stream flag

drone jsonnet --stream

Thanks Ash,

The flag is slightly misleading and not very obvious imo.

The drone jsonnet command uses the same flag names as the official jsonnet executable. We decided it was better to use the same flag names, and have consistency with the official jsonnet tooling, as opposed to create our own naming conventions.

You can’t please everyone :man_shrugging:

1 Like