Issue with starlark to yaml conversion since version 1.3.1 of the drone cli

I have been using starlark more to make managing the .drone.yml a bit simpler. But from version 1.3.1 and onwards of the drone cli the conversion broke, everything works with version 1.3.0.

The issue is only one pipeline gets written to the .drone.yml file when doing drone starlark.

I’ve tested with the following example provided in the docs, which is also broken:

def main(ctx):
  return [
    step("amd64"),
    step("arm64"),
  ]

def step(arch):
  return {
    "kind": "pipeline",
    "name": "build-%s" % arch,
    "steps": [
      {
        "name": "build",
        "image": "alpine",
        "commands": [
            "echo hello world"
        ]
      }
    ]
  }

It creates the following .drone.yml:

kind: pipeline
name: build-amd64
steps:
- commands:
  - echo hello world
  image: alpine
  name: build

And here is a link to one of my repos with a starlark file that creates a broken yaml file when converted with drone cli 1.3.1 and above: https://github.com/mwalbeck/docker-composer

Hey @mwalbeck I have a fix currently under view, Hopefully we will get it merged and released soon. (fix) fix multi-docs/lists in starlark by tphoney · Pull Request #200 · drone/drone-cli · GitHub
Thanks for reporting it.

Thanks for the quick response on this! I gave the fix a try and everything seems to work as intended. Cheers!

The change has been merged, i am working on the release now.

v.1.4.0 is released. Thanks for raising the issue.

Thank you for the quick fix. Cheers!