Drone

Starlark context not have some detailed info

There is missing info from ctx variable, where I usually use when using drone.yml, some of them:

  • drone build info (link, build number, etc)
  • build start time

Can you add this info to ctx variable?

Thank you so much.

@bradrydzewski Can you list out latest ctx structure? because when I try to print(ctx) on pipeline and on drone starlark convert gives different result:
This is from pipeline:

echo "context"(
  build = "build"(
    action = "",
    after = "xxx",
    author_avatar = "xxx",
    author_email = "xxx",
    author_login = "xxx",
    author_name = "xxx",
    before = "xxx",
    branch = "develop",
    commit = "xxx",
    cron = "",
    environent = "",
    event = "push",
    link = "",
    message = "print ctx\n",
    params = {},
    ref = "refs/heads/develop",
    sender = "",
    source = "develop",
    source_repo = "",
    target = "develop",
    title = ""
  ),
  repo = "repo"(
    active = True,
    branch = "master",
    config = ".drone.star",
    git_http_url = "xxx",
    git_ssh_url = "xxx",
    ignore_forks = False,
    ignore_pull_requests = False,
    link = "xxx",
    name = "xxx",
    namespace = "xxx",
    private = True,
    protected = False,
    slug = "xxx",
    trusted = False,
    uid = "xxx",
    visibility = "private"
  )
)

and this is from drone starlark convert

"context"(
  build = "build"(
    branch = "master",
    commit = "",
    event = "push",
    message = "",
    ref = "refs/heads/master",
    source = "",
    target = ""
  ),
  repo = "repo"(
    name = "xxx",
    namespace = "",
    slug = ""
  )
)

That is why it gives error

2019/10/28 10:23:04 "build" struct has no .author_name attribute

when I try to

"BUILD_AUTHOR": "%s" % ctx.build.author_name,

The is expected. The starlark script is evaluated before the build is created, thus build number and build started are not available at that time.