Set Build meta-data via API

I have a use-case where I am modifying a build under certain conditions inside of a webhook.

Ideally, when the webhook is triggered for the build.scheduled event, I’d like to be able to add some meta-data to the build that I could then look up again when the build is finished.

Good idea @deecewan! This is something I can look into for you.

Are you using the REST or GraphQL API?

I’m using the rest API - it’s mostly mutations or very small gets so the REST is much easier. It also lets me lock down the API key a lot more.

Hey, are there any updates on this? I’d also really like the ability to update build meta-data via the GraphQL API, and I don’t believe a corresponding mutation exists right now.

Hi @akshayn ,

We currently only support adding meta-data on build creation for both REST and GraphQL API’s. However, we do not have any API available to amend/update the meta-data of an existing build.

How difficult would it be for this feature to be implemented? For some more context around our use case, we run a custom scaler that manually manages agents, and being able to store state regarding whether a job has been serviced by our scaler within an existing build’s metadata would be really useful.

Hi @akshayn,

Thanks for giving more context in your use case. Have you explored using the agent cli to set the meta-data instead? You can read more about it here: [`buildkite-agent meta-data` v3 | Buildkite Documentation](https://buildkite-agent meta-data)

Cheers!

We have, but since our scaler is an external service it would be much easier for us to be able to update an existing build’s meta-data through an API, the same way that we add annotations.

Hi @akshayn :wave:

I have raised this as a feature request for our Product team to review.

1 Like