mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-15 22:42:43 +00:00
sourcehut: use ssh sources URL when appropriate
Co-authored-by: Jordan Anderson <jordan@jba.io>
This commit is contained in:
parent
6e13ac4d5f
commit
3bea06f906
2 changed files with 59 additions and 3 deletions
|
@ -460,6 +460,57 @@ environment:
|
|||
BUILD_SUBMITTER_URL: https://example.forgejo.org/
|
||||
GIT_REF: refs/heads/main
|
||||
image: alpine/edge
|
||||
tasks:
|
||||
- hello: echo world
|
||||
`, string(manifest))
|
||||
})
|
||||
|
||||
t.Run("with ssh source", func(t *testing.T) {
|
||||
repo := &api.Repository{
|
||||
CloneURL: "http://localhost:3000/testdata/repo.git",
|
||||
SSHURL: "git@localhost:testdata/repo.git",
|
||||
}
|
||||
|
||||
manifest, err := adjustManifest(repo, "58771003157b81abc6bf41df0c5db4147a3e3c83", "refs/heads/main", strings.NewReader(`image: alpine/edge
|
||||
sources:
|
||||
- git@localhost:testdata/repo.git
|
||||
- http://other.example.conm/repo.git
|
||||
tasks:
|
||||
- hello: echo world`), ".build.yml")
|
||||
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `sources:
|
||||
- git@localhost:testdata/repo.git#58771003157b81abc6bf41df0c5db4147a3e3c83
|
||||
- http://other.example.conm/repo.git
|
||||
environment:
|
||||
BUILD_SUBMITTER: forgejo
|
||||
BUILD_SUBMITTER_URL: https://example.forgejo.org/
|
||||
GIT_REF: refs/heads/main
|
||||
image: alpine/edge
|
||||
tasks:
|
||||
- hello: echo world
|
||||
`, string(manifest))
|
||||
})
|
||||
|
||||
t.Run("private without source", func(t *testing.T) {
|
||||
repo := &api.Repository{
|
||||
CloneURL: "http://localhost:3000/testdata/repo.git",
|
||||
SSHURL: "git@localhost:testdata/repo.git",
|
||||
Private: true,
|
||||
}
|
||||
|
||||
manifest, err := adjustManifest(repo, "58771003157b81abc6bf41df0c5db4147a3e3c83", "refs/heads/main", strings.NewReader(`image: alpine/edge
|
||||
tasks:
|
||||
- hello: echo world`), ".build.yml")
|
||||
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `sources:
|
||||
- git@localhost:testdata/repo.git#58771003157b81abc6bf41df0c5db4147a3e3c83
|
||||
environment:
|
||||
BUILD_SUBMITTER: forgejo
|
||||
BUILD_SUBMITTER_URL: https://example.forgejo.org/
|
||||
GIT_REF: refs/heads/main
|
||||
image: alpine/edge
|
||||
tasks:
|
||||
- hello: echo world
|
||||
`, string(manifest))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue