buildkite / buildkite/agent

Bootstrap cancel timeout can leave per-job temporary directories behind

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

Description

If a [per-job bootstrap process](https://github.com/buildkite/agent/blob/main/agent/job_runner.go#L425-L440) is forcibly terminated, any temporary directories it has created (such as in the [empty `BUILDKITE_REPO` case](https://github.com/buildkite/agent/issues/1485#issue-970092354)) will not be cleaned up.

This is hard to solve in the general case since the bootstrap process tree involves user supplied code, but we can at least clean up the directories our agent is responsible for having created.

Contributor guide

Open the contributing guide

Research direction

Start in agent/job_runner.go around lines 425-440, then trace the cancellation path for a forcibly terminated per-job bootstrap process and the empty BUILDKITE_REPO case. Identify which temporary directories the agent itself creates and define completion as cleaning those directories up when bootstrap cancellation occurs, without assuming user-supplied process-tree code can be cleaned.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
ci-cd
Issue type
Bug
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.