Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config language: add Starlark go config language #138

Open
sgotti opened this issue Oct 10, 2019 · 2 comments
Open

config language: add Starlark go config language #138

sgotti opened this issue Oct 10, 2019 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@sgotti
Copy link
Member

sgotti commented Oct 10, 2019

https://github.com/google/starlark-go/blob/master/doc/spec.md

It should satisfy our reproducibility needs (like jsonnet) and could be easier to write agola config files.

Like in #137 we should provide build context information.

@tboerger
Copy link

Maybe https://github.com/drone/drone-convert-starlark could be useful to get an idea how other projects integrate Starlark. I really like that.

@camandel
Copy link
Contributor

camandel commented Mar 5, 2021

Maybe https://github.com/drone/drone-convert-starlark could be useful to get an idea how other projects integrate Starlark. I really like that.

I think starlark config file support has been added with commit d91ec09 (but not yet included into docker image, you need to compile it from sources).
Tried with a simple config.star file and it works:

def main(ctx):
   return run("my run", "my task")


def run(runname, taskname):
  return {
    "version": "v0",
    "runs": [
      {
        "name": runname,
        "tasks": [
           {
            "name": taskname,
            "runtime":
             {
               "type": "pod",
               "arch": "amd64",
               "containers":
                 [
                   { "image": "alpine:latest" }
                 ]
             },
            "steps": steps(3)
           }
        ]
      }
    ]
  }

def steps(n):
  steps = []

  for i in range(n):
    cmd =  { "run": "/bin/sleep %d" % (i + 1) }
    steps.append(cmd)

  return steps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants