Turn Buildkite build failures into tracked Jira bugs

When a build fails on an important pipeline, an agent reads the logs, drafts the likely cause, and opens a Jira bug, skipping duplicate tickets.

Agentic Task
BuildkiteJiraLinearEngineeringNotifications & Alerts
PromptCreate

When a Buildkite build finishes in a failed state, run this agent to open a tracked bug. Set the trigger as a Buildkite webhook subscribed to the build.finished event, and only act when the build state is failed (ignore passed, canceled, blocked, and skipped). Restrict the workflow to an allowlist of important pipelines and branches, for example the pipelines that gate production plus main and release branches, so failures on experimental or feature branches never generate tickets. If the failing build's pipeline or branch is not on the allowlist, stop and do nothing.

Using the pipeline slug and build number from the webhook payload, call Buildkite Get a Build to load the full context: the build state and message, the commit SHA, the branch, the author or creator, the build's web URL, and the list of jobs. Identify the job that failed (a failed state or a non-zero exit status) and call Buildkite Get a Job's Log Output to read that job's log. Concentrate on the tail of the log and any error output to work out the likely root cause.

Before filing anything, run Jira Search Issues (JQL) to check whether an open ticket already covers the same pipeline and branch. Search the target project for Bug issues that are not in a done or closed status and that reference this pipeline and branch, for example: project = ENG AND issuetype = Bug AND statusCategory != Done AND text ~ "<pipeline>" AND text ~ "<branch>". If a matching open ticket already exists, do not create a duplicate; stop there so a flapping pipeline never spawns repeat tickets.

Only when no open duplicate exists, call Jira Create Issue with issue type Bug in the chosen project. Draft a concise, useful ticket. Use a title that names the pipeline and the failing step or job, for example 'CI failure: web-deploy, RSpec step failed on main'. Write a short description that summarizes the likely root cause from the log, names the offending commit SHA and its author, states the branch, and includes a direct link to the Buildkite build. Keep it skimmable: one short root-cause paragraph plus the key facts (pipeline, branch, commit, author, build link). Do not paste the whole log; quote only the few relevant error lines.

If your team tracks work in Linear instead of Jira, the same flow applies: use Linear List Issues to look for an open duplicate for the pipeline and branch, then Linear Create Issue only when none exists. Keep the pipeline and branch allowlist easy to edit so the team can tune which failures are important enough to track.

Additional information

What does this prompt do?
  • Watches your most important Buildkite pipelines and reacts the moment a build fails.
  • Reads the failing job's logs and writes a short, plain-English summary of the likely cause.
  • Opens a Jira bug with the failing step, the offending commit and author, and a link to the build.
  • Checks for an existing open ticket first, so a flaky pipeline never creates duplicate bugs.
What do I need to use this?
  • A Buildkite account with the pipelines you want to monitor.
  • A Jira project where new bugs should be created (or a Linear workspace if your team uses Linear).
  • A short list of the pipelines and branches that matter, such as main and your release branches.
How can I customize it?
  • Choose which pipelines and branches count as important so experimental branches never create tickets.
  • Pick the Jira project and set the issue type, priority, or labels for new bugs.
  • Swap Jira for Linear if that is where your team tracks work.

Frequently asked questions

Will this create a ticket for every failed build?
No. It only reacts to failures on the pipelines and branches you mark as important, and it skips creating a ticket if an open bug for the same pipeline and branch already exists.
What goes into the bug ticket?
A clear title naming the pipeline and the step that failed, a short summary of the likely cause pulled from the build log, the commit and author behind the change, and a direct link to the build in Buildkite.
How does it avoid duplicate tickets when a pipeline keeps failing?
Before filing, it searches Jira for an open bug covering the same pipeline and branch. If one already exists, it leaves it alone instead of opening another.
Can I use Linear instead of Jira?
Yes. Linear is supported, and the same flow applies: check for an existing open issue first, then create a new one only if there is no duplicate.
Do I need to write the bug description myself?
No. The agent drafts a concise write-up for you from the failing log, so the ticket is useful the moment it lands.

Stop chasing red builds by hand.

Let an agent turn every important Buildkite failure into a clear, de-duplicated Jira bug your team can act on.