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.
client/git.go +13−1
| @@ -131,6 +131,12 @@ func SanitizeAuthor(s string) string { | |||
| 131 | 131 | // RepoURL builds the SSH URL for one repository from an instance base URL, so an | |
| 132 | 132 | // upload lands where the job's push would. The base is the instance's address, | |
| 133 | 133 | // which need not name a repository itself. | |
| 134 | // | ||
| 135 | // The user is kept. It used to be dropped because Vole's own SSH listener | ||
| 136 | // authenticates the key and ignores the name the client asked for, so `ssh://host` | ||
| 137 | // and `ssh://git@host` were the same thing. Behind sshd they are not: the name | ||
| 138 | // selects the operating-system account, and a job checkout without it asks for an | ||
| 139 | // account that cannot exist. | ||
| 134 | 140 | func RepoURL(remote, repo string) (string, error) { | |
| 135 | 141 | u, err := url.Parse(remote) | |
| 136 | 142 | if err != nil { | |
| @@ -139,7 +145,13 @@ func RepoURL(remote, repo string) (string, error) { | |||
| 139 | 145 | if u.Scheme != "ssh" || u.Host == "" { | |
| 140 | 146 | return "", fmt.Errorf("%q is not an ssh URL (expected ssh://user@host:port)", remote) | |
| 141 | 147 | } | |
| 142 | return fmt.Sprintf("%s://%s/%s.git", u.Scheme, u.Host, repo), nil | ||
| 148 | user := "" | ||
| 149 | if u.User != nil { | ||
| 150 | // The name only: a password has no meaning over SSH and must not be copied | ||
| 151 | // into a URL this builds. | ||
| 152 | user = u.User.Username() + "@" | ||
| 153 | } | ||
| 154 | return fmt.Sprintf("%s://%s%s/%s.git", u.Scheme, user, u.Host, repo), nil | ||
| 143 | 155 | } | |
| 144 | 156 | ||
| 145 | 157 | // RepoNameFromPath is the repository a remote path names: /demo.git -> demo. | |