buildkite / buildkite/agent

Option to prevent startup if tag fetching fails

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

Description

**Is your feature request related to a problem? Please describe.**
We use `--tags-from-ec2-tags` to set several tags automatically based on the EC2 instance the agent is running on. One of the tags we set in this way is the `queue` tag. Recently, one of our agents failed to fetch those EC2 tags on startup (I don't have logs for what the underlying error was unfortunately), but the agent continues to start regardless of this error. This caused our agent to start up in the `default` queue, which was incorrect and caused us a bit of a headache.

**Describe the solution you'd like**
Currently, the agent is configured to just [log errors](https://github.com/buildkite/agent/blob/9ea5d0e03921e3e7180fede9358eaf2d6ca66598/agent/tags.go#L184-L187) when fetching tags. Since that functionality is actually pretty critical to us, I'd love to have an option to actually block startup by erroring/panicking instead.

Blocking startup would be a good safe default, but it's also a breaking change, so just having another config option to enable the "strict" behavior here would work well for us.

**Describe alternatives you've considered**
Alternatively, if there was a way to configure buildkite-agent to **require** a queue to be configured, and not to automatically use the `default` queue, that would work. We tried configuring `tags="queue=not-functional-queue"` in the config file, with the hopes that it would be "overridden" by the EC2 tag. But it seems that will just cause the agent to listen on both queues.

Or, if there was a way to inspect the config of the Buildkite Agent after it starts, we could use that to verify that the queue was set properly.

Contributor guide

Open the contributing guide

Research direction

Start in agent/tags.go around lines 184-187, then trace how tag-fetching errors are handled during agent startup and how configuration options are defined. The work is complete when an explicit strict behavior can prevent startup after tag-fetching failure, while the existing non-strict behavior remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
ci-cd, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.