buildkite / buildkite/agent

BUILDKITE_CHECKOUT_EXIT_STATUS

Open
#1,607 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

**Is your feature request related to a problem? Please describe.**
Yes, but non-blocking.

Occasionally we get errors like,
```
$ git checkout -f FETCH_HEAD
--
  | Updating files: 100% (20200/20200), done.
  | error: Could not read d14822981d71c7fb637153e4fcb8c7e4bc5e2142
  | fatal: internal error in revision walk
  | ⚠️ Warning: Checkout failed! exit status 128 (Attempt 1/3 Retrying in 2s)
```

**Describe the solution you'd like**
Want to resolve this in a `pre-exit` repo hook, but both `$?` and `$BUILDKITE_LAST_HOOK_EXIT_STATUS` are `0`. If there was a `BUILDKITE_CHECKOUT_EXIT_STATUS` similar to `BUILDKITE_LAST_HOOK_EXIT_STATUS` and `BUILDKITE_COMMAND_EXIT_STATUS` which indicated in the `pre-exit` hook this checkout failed, we'd resolve this issue only when we needed to.

**Describe alternatives you've considered**
Alternative is to always reset the repo.

Another alternative considered was to add a `export BUILDKITE_CHECKOUT_EXIT_STATUS=1` to the environment hook then unset it `post-checkout`, but would live to avoid pre-checkout (and therefore non-repo hooks) to resolve this.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.