Systemd template file doesn't spawn unique agent names
- Dominant language
- Go
- Stars
- 1.1k
- Forks
- 378
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 74
Description
The [template unit file](https://github.com/buildkite/agent/blob/main/packaging/linux/root/usr/share/buildkite-agent/systemd/buildkite-agent%40.service) intended for spawning multiple agents on one host doesn't start agents using unique names.
As the [documentation](https://buildkite.com/docs/agent/v3/ubuntu#running-multiple-agents) states, you can run
```bash
sudo systemctl enable --now buildkite-agent@1
sudo systemctl enable --now buildkite-agent@2
```
But the [default configuration file](https://github.com/buildkite/agent/blob/main/packaging/linux/root/usr/share/buildkite-agent/buildkite-agent.cfg#L5) does not use the `%n` substitution.
I'm not sure if the the templated file is intended to be used with a number that tells it how many agents to spawn or a string that will be used in the agents name. ie
```bash
# spawn four agents with incrementing names using %n
sudo systemctl enable --now buildkite-agent@4
# or, run multiple units spawning one agent each, using the template to inject the unique name
sudo systemctl enable --now buildkite-agent@deploy
sudo systemctl enable --now buildkite-agent@build
```
Contributor guide
Research direction
Inspect packaging/linux/root/usr/share/buildkite-agent/systemd/buildkite-agent@.service and compare it with packaging/linux/root/usr/share/buildkite-agent/buildkite-agent.cfg#L5. Use the documented systemctl commands and the Ubuntu multiple-agent documentation to determine whether the instance identifier represents a count or an agent name. Done means templated agents start with distinct, intended names in both documented usage patterns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100