Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Make a job checkout follow the remote it was told to use

5baf4e736be8096457f877f5e8b18f73404ed5c5 · Keenan Nemetz · 16d ago · parent 8a4af42e

Make a job checkout follow the remote it was told to use

Two defects, one incident: the forge moved behind sshd and CI could not check
out a commit.

A cached checkout kept the clone URL it was born with. prepareWorktree clones
once and afterwards only fetches from origin, so changing --remote — a new port,
a new host, the front door replacing Vole's own listener — left every job
fetching an address that no longer exists. It now points origin at the URL built
from the current argument before fetching, so the cache follows the runner's
configuration rather than the day it was created.

client.RepoURL dropped the user from the instance URL. Vole's own listener
authenticates the key and ignores the name the client asks for, so that was
invisible; sshd selects the operating-system account by that name, and a checkout
without it asks for an account that cannot exist. The user is kept (the name
only: a password has no meaning over SSH and must not be copied into a URL).

The worktree test never changed the remote, and RepoURL had no test at all, so
both are covered now: a second prepareWorktree with a different remote asserts
origin moved, and RepoURL is checked with and without a user and a port.

Closes #316.

ci/agent/worktree.go +9

@@ -114,6 +114,15 @@ func prepareWorktree(remote, cache, repo, sha, runID string, attempt int) (check
114 114 return checkout{}, fmt.Errorf("git clone: %v: %s", err, out)
115 115 }
116 116 } else {
117 // The cache outlives the runner's arguments. When --remote changes — a new
118 // port, a new host, or the sshd front door replacing Vole's own listener —
119 // this checkout still has the old origin, and every fetch fails against an
120 // address that is not there any more. Point it at what this runner was told
121 // to use, every time, so the cache follows the argument rather than the day
122 // it was created.
123 if out, err := exec.Command("git", "-C", cacheDir, "remote", "set-url", "origin", cloneURL).CombinedOutput(); err != nil {
124 return checkout{}, fmt.Errorf("git remote set-url: %v: %s", err, out)
125 }
117 126 // The branch fetch is the delta and nothing else: the history the cache holds
118 127 // is already here. It is not skipped when the revision is cached, because a
119 128 // job's checkout carries these refs as origin/*, and a step that compares