buildkite / buildkite/agent

Ref syntax for looking up plugin parameters in buildkite-agent meta-data

Open
#1,199 0 comments 0 reactions 0 assignees View on GitHub
plugins
Dominant language
Go
Stars
1.1k
Forks
378
Avg merge
2d 6h
Merged PRs (30d)
74

Description

I’ve been writing a lot of CloudFormation lately and using the intrinsic functions. I’ve also been factoring some of my Buildkite command steps into plugins so I can write more self documenting argument name value pairs.

I just built a one off feature into one of my plugins that I thought might be more generally applicable: using CloudFormation like `{ Ref: tag }` syntax as a plugin parameter to lookup a value in the `buildkite-agent meta-data get` key space. This is passed down to the plugin which can [detect by checking whether the `${PLUGIN}_{KEY}_REF` environment variable](https://github.com/keithduncan/kanikoctl-buildkite-plugin/blob/261d24e5f25e01ba0ee8f2b406c5ff7c260d2cc5/hooks/command#L58-L75) exists.

This would be particularly useful to pass `block` or `input` keys into plugin parameters without having an intermediate `buildkite-agent pipeline upload` to interpolate them:

What I have now:

Screen Shot 2020-03-16 at 16 51 12

If I wanted to parameterise the tags (supported for this field in my plugin):

Screen Shot 2020-03-16 at 16 52 29

While my `{ Ref: key }` syntax could be implemented in the agent, YAML tag syntax `!Ref` is ignored today and the contents are passed down to the agent without the tag. I _think_ that would yield a backwards compatible way to implement this. While someone could already be using `Ref` keys in their plugin parameters key path `!Ref` doesn’t work or exist today.

Contributor guide

Open the contributing guide

Research direction

Start with the buildkite-agent meta-data get entry point and the plugin parameter handling described in the issue, then compare the existing YAML tag behavior with the proposed Ref form. Review the linked plugin hook to understand the expected environment-variable signal. Done should define compatible Ref lookup behavior for plugin parameters without changing ordinary parameters.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, yaml
Domain
ci-cd, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.