buildkite / buildkite/agent

Building w/ test merge commit has confusing error message on merge conflicts

Open
#4,244 0 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

## Describe the bug
When there is a merge conflict the build fails when Build w/ Test Merge Commit is enabled:

```
fatal: couldn't find remote ref refs/pull/74989/merge
# Attempt 1/1
⚠️ Warning: Checkout failed! fetching PR refspec ["refs/pull/74989/merge"]: exit status 128 (Attempt 6/6)
🚨 Error: fetching PR refspec ["refs/pull/74989/merge"]: exit status 128
```

This error does not make it clear that there are merge conflicts that need to be resolved and the default user behavior may be to re-trigger a build because there could be github flake for example. Instead we should surface a user friendly error message:

```
🚨 Error: fetching PR refspec ["refs/pull/74989/merge"]: exit status 128
This is possible due to there being merge conflicts or github having an issue creating the merge ref automatically
```

## Steps To Reproduce
Create a PR with merge conflicts and enable Build w/ Test Merge Commit.

## Expected behavior
Return this error instead:
```
🚨 Error: fetching PR refspec ["refs/pull/74989/merge"]: exit status 128
This is possible due to there being merge conflicts or github having an issue creating the merge ref automatically
```

## Actual behaviour
Confusing/unclear error:

```
fatal: couldn't find remote ref refs/pull/74989/merge
# Attempt 1/1
⚠️ Warning: Checkout failed! fetching PR refspec ["refs/pull/74989/merge"]: exit status 128 (Attempt 6/6)
🚨 Error: fetching PR refspec ["refs/pull/74989/merge"]: exit status 128
```

Contributor guide

Open the contributing guide

Research direction

Search the Go agent's checkout and fetch error handling for the reported "couldn't find remote ref" or "Checkout failed" messages, then trace the Build w/ Test Merge Commit path. Reproduce with a PR containing merge conflicts and verify that the existing error is followed by the requested explanation about merge conflicts or GitHub failing to create the merge ref.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
ci-cd
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.