Create multiple pipelines with drone script/skylark

Hello,
based on your example:

load(“//config/common/pipeline.sky”, “pipeline”)
def main(ctx):
return [
pipeline(ctx, os = ‘linux’, arch=‘amd64’, name=‘amd64’),
pipeline(ctx, os = ‘linux’, arch=‘arm64’, name='arm64),
pipeline(ctx, os = ‘linux’, arch=‘arm’, name=‘arm32’),
]

returns: .drone.py:6:52: unexpected newline in string
How can we generate multiple pipelines?
Thx

returns: .drone.py:6:52: unexpected newline in string

This error comes from the starlark interpreter and indicates there an error with your starlark script. I cannot speculate what might cause the error since I do not have the full script and do not have the ability to reproduce.

I personally have no issue generating a multi-document starlark script. You can run a simple test using the following command to demonstrate that this works as expected, when your script is valid and returns a valid structure.

def main(ctx):
  return [
    {"kind": "pipeline", "name": "pipelineA"},
    {"kind": "pipeline", "name": "pipelineB"},
  ]

it works, thanks!

def main(ctx):
    return [
        lint(ctx),
        build(ctx),
    ]

def lint(ctx):
    return {
        "kind": "pipeline",
        "name": "lint",
        "clone": {"depth": 1},
    }

def build(ctx):
    return {
        "kind": "pipeline",
        "name": "build",
        "clone": {"depth": 1},
    }

the bash command line:

drone script --source ./.drone.starlark --target ./.drone-starlark.yml --stdout

and the result:

---
kind: pipeline
name: lint

platform:
  os: linux
  arch: amd64

clone:
  depth: 1

---
kind: pipeline
name: build

platform:
  os: linux
  arch: amd64

clone:
  depth: 1

...