Skip to content

preflight: if the repo has no remote, skip push & cleanup#737

Open
pda wants to merge 1 commit intomainfrom
preflight-skip-push-with-no-origin
Open

preflight: if the repo has no remote, skip push & cleanup#737
pda wants to merge 1 commit intomainfrom
preflight-skip-push-with-no-origin

Conversation

@pda
Copy link
Copy Markdown
Member

@pda pda commented Mar 31, 2026

When a git repo has no remote, preflight would previously do this:

Error: snapshot error: git push origin 3f6b6eaf03a0d2eaf7be4a02ede2ab34740b29cc:refs/heads/bk/preflight/019d4313-4222-730d-9669-98483dc2e507: exit status 128 (failed to create preflight snapshot)

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.

@pda pda requested a review from matthewborden March 31, 2026 09:03
@pda pda requested review from a team as code owners March 31, 2026 09:03
@pda pda force-pushed the preflight-skip-push-with-no-origin branch from b4fbc84 to 13c789c Compare March 31, 2026 09:06
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +116 to +117
if _, err := gitOutput(dir, env, cfg.debug, "remote", "get-url", "origin"); err != nil {
pushSkipped = true
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@pda pda closed this Apr 7, 2026
@pda pda force-pushed the preflight-skip-push-with-no-origin branch from 13c789c to a8a1bc9 Compare April 7, 2026 06:45
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>
@pda pda reopened this Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants