preflight: if the repo has no remote, skip push & cleanup#737
preflight: if the repo has no remote, skip push & cleanup#737
Conversation
b4fbc84 to
13c789c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4fbc84640
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if _, err := gitOutput(dir, env, cfg.debug, "remote", "get-url", "origin"); err != nil { | ||
| pushSkipped = true |
There was a problem hiding this comment.
Fail snapshot on non-remote errors from origin probe
The new git remote get-url origin probe treats any error as "no remote" and continues with PushSkipped=true. That silently converts real git failures (for example, a git version that lacks remote get-url, or other repository/config errors) into a successful snapshot even though no push happened, so preflight can create a build pointing at a commit that remote agents cannot fetch. This should only skip when the error is specifically "origin remote does not exist" and otherwise return the original error.
Useful? React with 👍 / 👎.
13c789c to
a8a1bc9
Compare
This is useful for a pipeline that defines e.g. /path/to/codebase/.git as the repository, with a buildkite-agent running on that local machine. Changes to that git repo don't need to be pushed anywhere. Amp-Thread-ID: https://ampcode.com/threads/T-019d66ad-7398-770a-990d-705838d5dba4 Co-authored-by: Amp <amp@ampcode.com>
When a git repo has no remote, preflight would previously do this:
There are useful workflows where a buildkite-agent runs on the same machine as a git repo, with the pipeline configured with a repository of
/path/to/codebase/.git. Changes to the that git repo don't need to be pushed anywhere for the agent/build/preflight to use them.Emit a warning in this case, because it could also be an accidental misconfiguration.