3
14
Fork
You've already forked yojo
5

substitutes ssh sources with cloneUrl #31

Open
opened 2026年05月02日 09:22:30 +02:00 by romi · 1 comment

I’m trying to submit a build from a private repository, and my build manifest looks like this:

image:nixos/unstableenvironment:NIX_CONFIG:| experimental-features = nix-command flakessources:- git@example.org/user/reposecrets:- something-something-something

builds.sr.ht receives this manifest:

environment:BUILD_SUBMITTER:yojoGIT_REF:refs/heads/test_buildsNIX_CONFIG:| experimental-features = nix-command flakesimage:nixos/unstablesecrets:- something-something-somethingsources:- https://git.example.org/user/repo.git#headHash

... which is from something happening here, I guess:

Lines 134 to 157 in 75d3cd5
cloneURL,err:=url.Parse(ctx.headRepo.CloneURL)
iferr!=nil{
returnfmt.Errorf("failed to parse Gitea clone URL: %v",err)
}
manifestCloneURL:=*cloneURL
manifestCloneURL.Fragment=ctx.headHash
sources,ok:=sourcesIface.([]interface{})
if!ok{
returnfmt.Errorf("invalid manifest: `sources` is not a list")
}
fori,srcIface:=rangesources{
src,ok:=srcIface.(string)
if!ok{
returnfmt.Errorf("invalid manifest: `sources` contains a %T, want a string",srcIface)
}
// TODO: use fork parent to figure out whether we should replace
// the source
ifstrings.HasSuffix(src,"/"+ctx.baseRepo.Name)||strings.HasSuffix(src,"/"+ctx.baseRepo.Name+".git"){
sources[i]=manifestCloneURL.String()
}

My webhook request’s "clone_url" holds a value for git over https.
I don’t know enough about forgejo, maybe it should substitute the "clone_url" with "ssh_url" for private repositories, although it may be something I misconfigured 😥 or maybe yojo should use "ssh_url" if ctx.headRepo.Private :)

I’m trying to submit a build from a private repository, and my build manifest looks like this: ```yml image: nixos/unstable environment: NIX_CONFIG: | experimental-features = nix-command flakes sources: - git@example.org/user/repo secrets: - something-something-something ``` builds.sr.ht receives this manifest: ```yml environment: BUILD_SUBMITTER: yojo GIT_REF: refs/heads/test_builds NIX_CONFIG: | experimental-features = nix-command flakes image: nixos/unstable secrets: - something-something-something sources: - https://git.example.org/user/repo.git#headHash ``` ... which is from something happening here, I guess: https://codeberg.org/emersion/yojo/src/commit/75d3cd593a4447de731f7e9a75c9431721c125ae/job.go#L134-L157 My webhook request’s `"clone_url"` holds a value for git over https. I don’t know enough about forgejo, maybe it should substitute the `"clone_url"` with `"ssh_url"` for private repositories, although it may be something I misconfigured 😥 or maybe yojo should use `"ssh_url"` if `ctx.headRepo.Private` :)

Merely substituting the SSH URL wouldn't be enough: we don't have any private SSH key set up. Perhaps cloning over HTTPS with a short lived token would work.

Merely substituting the SSH URL wouldn't be enough: we don't have any private SSH key set up. Perhaps cloning over HTTPS with a short lived token would work.
Sign in to join this conversation.
No Branch/Tag specified
master
No results found.
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
emersion/yojo#31
Reference in a new issue
emersion/yojo
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?