# Starlark context not have some detailed info

**URL:** <https://drone.discourse.group/t/starlark-context-not-have-some-detailed-info/11287>\
**Category:** Drone Support\
**Created:** [October 28, 2019, 3:17am UTC](https://drone.discourse.group/t/starlark-context-not-have-some-detailed-info/11287 "2019-10-28T03:17:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![puzzloholic](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/puzzloholic/32/4826_2.png) [@puzzloholic](https://drone.discourse.group/u/puzzloholic)\
**Post date:** [October 28, 2019, 3:17am UTC](https://drone.discourse.group/t/starlark-context-not-have-some-detailed-info/11287/1 "2019-10-28T03:17:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![puzzloholic](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/puzzloholic/32/4826_2.png) [@puzzloholic](https://drone.discourse.group/u/puzzloholic)\
**Post date:** [October 28, 2019, 3:33am UTC](https://drone.discourse.group/t/starlark-context-not-have-some-detailed-info/11287/2 "2019-10-28T03:33:16Z")

</div>

@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:

```auto
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`

```auto
"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

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

```

when I try to

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

```

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [October 28, 2019, 3:42pm UTC](https://drone.discourse.group/t/starlark-context-not-have-some-detailed-info/11287/3 "2019-10-28T15:42:04Z")

</div>

> [@On another topic](https://drone.discourse.group/t/6087/1):
>
> - drone build info (link, build number, etc)
> - build start time

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.

---

<div class="post-metadata">

**Author:** ![zicklag](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/zicklag/32/3829_2.png) [@zicklag](https://drone.discourse.group/u/zicklag)\
**Post date:** [January 9, 2020, 6:40pm UTC](https://drone.discourse.group/t/starlark-context-not-have-some-detailed-info/11287/4 "2020-01-09T18:40:16Z")

</div>

> [@On another topic](https://drone.discourse.group/t/6087/3):
>
> 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.

Is there any way to get that information into the build? I want to convert to starlark because I need to script out a build for multiple architectures, but I’m using the drone build ID inside of one of my package scripts. Can I still use the Drone environment variables in the build somehow?

* * *

**Edit:** Ah, the environment variables are still set and can be accessed during the build.

This means in your build steps, which may be generated by starlark, you can `echo $DRONE_BUILD_NUMBER` and `DRONE_BUILD_NUMBER` will be resolved by the shell when it is _executed_ by the Drone runner.

Sorry for the noise, but I’ll leave this here just in case anybody else needs it.

---

<div class="post-metadata">

**Author:** ![gilesbradshaw](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/gilesbradshaw/32/5650_2.png) [@gilesbradshaw](https://drone.discourse.group/u/gilesbradshaw)\
**Post date:** [April 29, 2020, 3:09pm UTC](https://drone.discourse.group/t/starlark-context-not-have-some-detailed-info/11287/5 "2020-04-29T15:09:42Z")

</div>

@bradrydzewski I wonder why there isn’t repo.link etc =- surely these are known?

---

<div class="post-metadata">

**Author:** ![ashwilliams1](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/ashwilliams1/32/5549_2.png) [@ashwilliams1](https://drone.discourse.group/u/ashwilliams1)\
**Post date:** [April 29, 2020, 6:12pm UTC](https://drone.discourse.group/t/starlark-context-not-have-some-detailed-info/11287/6 "2020-04-29T18:12:43Z")

</div>

the repository link is provided, here is the relevant source code:

> <https://github.com/drone/drone-convert-starlark/blob/master/plugin/args.go#L77>
