mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-02-23 14:46:21 +00:00
Support Git as only VCS
This commit is contained in:
parent
9a61cdb15a
commit
f339067968
27 changed files with 7 additions and 87 deletions
|
@ -157,12 +157,6 @@ var flags = []cli.Flag{
|
|||
Name: "repo-url",
|
||||
Usage: "Set the metadata environment variable \"CI_REPO_URL\".",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Sources: cli.EnvVars("CI_REPO_SCM"),
|
||||
Name: "repo-scm",
|
||||
Usage: "Set the metadata environment variable \"CI_REPO_SCM\".",
|
||||
Value: "git",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Sources: cli.EnvVars("CI_REPO_DEFAULT_BRANCH"),
|
||||
Name: "repo-default-branch",
|
||||
|
|
|
@ -78,7 +78,6 @@ func metadataFromContext(_ context.Context, c *cli.Command, axis matrix.Axis, w
|
|||
// Repo
|
||||
metadataFileAndOverrideOrDefault(c, "repo-remote-id", func(s string) { m.Repo.RemoteID = s }, c.String)
|
||||
metadataFileAndOverrideOrDefault(c, "repo-url", func(s string) { m.Repo.ForgeURL = s }, c.String)
|
||||
metadataFileAndOverrideOrDefault(c, "repo-scm", func(s string) { m.Repo.SCM = s }, c.String)
|
||||
metadataFileAndOverrideOrDefault(c, "repo-default-branch", func(s string) { m.Repo.Branch = s }, c.String)
|
||||
metadataFileAndOverrideOrDefault(c, "repo-clone-url", func(s string) { m.Repo.CloneURL = s }, c.String)
|
||||
metadataFileAndOverrideOrDefault(c, "repo-clone-ssh-url", func(s string) { m.Repo.CloneSSHURL = s }, c.String)
|
||||
|
|
|
@ -686,16 +686,6 @@ Example configuration to use a custom clone plugin:
|
|||
+ image: octocat/custom-git-plugin
|
||||
```
|
||||
|
||||
Example configuration to clone Mercurial repository:
|
||||
|
||||
```diff
|
||||
clone:
|
||||
- name: hg
|
||||
+ image: plugins/hg
|
||||
+ settings:
|
||||
+ path: bitbucket.org/foo/bar
|
||||
```
|
||||
|
||||
### Git Submodules
|
||||
|
||||
To use the credentials that cloned the repository to clone it's submodules, update `.gitmodules` to use `https` instead of `git`:
|
||||
|
|
|
@ -56,7 +56,6 @@ This is the reference list of all environment variables available to your pipeli
|
|||
| `CI_REPO_OWNER` | repository owner | `john-doe` |
|
||||
| `CI_REPO_NAME` | repository name | `my-repo` |
|
||||
| `CI_REPO_REMOTE_ID` | repository remote ID, is the UID it has in the forge | `82` |
|
||||
| `CI_REPO_SCM` | repository SCM | `git` |
|
||||
| `CI_REPO_URL` | repository web URL | `https://git.example.com/john-doe/my-repo` |
|
||||
| `CI_REPO_CLONE_URL` | repository clone URL | `https://git.example.com/john-doe/my-repo.git` |
|
||||
| `CI_REPO_CLONE_SSH_URL` | repository SSH clone URL | `git@git.example.com:john-doe/my-repo.git` |
|
||||
|
|
|
@ -16,6 +16,7 @@ This will be the next version of Woodpecker.
|
|||
- `CI_PIPELINE_FINISHED` as empty during execution
|
||||
- `CI_PIPELINE_STATUS` was always `success`
|
||||
- `CI_STEP_STATUS` was always `success`
|
||||
- `CI_REPO_SCM`
|
||||
- Set `/woodpecker` as default workdir for the **woodpecker-cli** container
|
||||
- Secret filters for plugins now check against tag if specified
|
||||
- Compatibility mode of deprecated `pipeline:`, `platform:` and `branches:` pipeline config options are now removed and pipeline will now fail if still in use.
|
||||
|
|
|
@ -63,10 +63,6 @@ func (e *local) setupClone(state *workflowState) error {
|
|||
|
||||
// execClone executes a clone-step locally.
|
||||
func (e *local) execClone(ctx context.Context, step *types.Step, state *workflowState, env []string) error {
|
||||
if scm := step.Environment["CI_REPO_SCM"]; scm != "git" {
|
||||
return fmt.Errorf("local backend can only clone from git repos, but this repo use '%s'", scm)
|
||||
}
|
||||
|
||||
if err := checkGitCloneCap(); err != nil {
|
||||
return fmt.Errorf("check for git clone capabilities failed: %w", err)
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ func SetDroneEnviron(env map[string]string) {
|
|||
copyEnv("CI_COMMIT_AUTHOR_AVATAR", "DRONE_COMMIT_AUTHOR_AVATAR", env)
|
||||
// repo
|
||||
copyEnv("CI_REPO", "DRONE_REPO", env)
|
||||
copyEnv("CI_REPO_SCM", "DRONE_REPO_SCM", env)
|
||||
copyEnv("CI_REPO_OWNER", "DRONE_REPO_OWNER", env)
|
||||
copyEnv("CI_REPO_NAME", "DRONE_REPO_NAME", env)
|
||||
copyEnv("CI_REPO_URL", "DRONE_REPO_LINK", env)
|
||||
|
@ -59,6 +58,7 @@ func SetDroneEnviron(env map[string]string) {
|
|||
copyEnv("CI_STEP_NUMBER", "DRONE_STEP_NUMBER", env)
|
||||
|
||||
env["DRONE_BUILD_STATUS"] = "success"
|
||||
env["DRONE_REPO_SCM"] = "git"
|
||||
|
||||
// some quirks
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ CI_REPO_CLONE_URL=https://codeberg.org/Epsilon_02/todo-checker.git
|
|||
CI_REPO_DEFAULT_BRANCH=main
|
||||
CI_REPO_NAME=todo-checker
|
||||
CI_REPO_OWNER=Epsilon_02
|
||||
CI_REPO_SCM=git
|
||||
CI_STEP_NAME=wp_01h1z7v5d1tskaqjexw0ng6w7d_0_step_3
|
||||
CI_STEP_STARTED=1685749339
|
||||
CI_SYSTEM_PLATFORM=linux/amd64
|
||||
|
@ -164,7 +163,6 @@ CI_REPO_NAME=woodpecker-test
|
|||
CI_REPO_OWNER=test
|
||||
CI_REPO_PRIVATE=false
|
||||
CI_REPO_REMOTE_ID=4
|
||||
CI_REPO_SCM=git
|
||||
CI_REPO_TRUSTED=false
|
||||
CI_REPO_TRUSTED_NETWORK=false
|
||||
CI_REPO_TRUSTED_VOLUMES=false
|
||||
|
|
|
@ -56,7 +56,6 @@ func (m *Metadata) Environ() map[string]string {
|
|||
"CI_REPO_NAME": m.Repo.Name,
|
||||
"CI_REPO_OWNER": m.Repo.Owner,
|
||||
"CI_REPO_REMOTE_ID": m.Repo.RemoteID,
|
||||
"CI_REPO_SCM": m.Repo.SCM,
|
||||
"CI_REPO_URL": m.Repo.ForgeURL,
|
||||
"CI_REPO_CLONE_URL": m.Repo.CloneURL,
|
||||
"CI_REPO_CLONE_SSH_URL": m.Repo.CloneSSHURL,
|
||||
|
|
|
@ -34,7 +34,6 @@ type (
|
|||
Owner string `json:"owner,omitempty"`
|
||||
RemoteID string `json:"remote_id,omitempty"`
|
||||
ForgeURL string `json:"forge_url,omitempty"`
|
||||
SCM string `json:"scm,omitempty"`
|
||||
CloneURL string `json:"clone_url,omitempty"`
|
||||
CloneSSHURL string `json:"clone_url_ssh,omitempty"`
|
||||
Private bool `json:"private,omitempty"`
|
||||
|
|
|
@ -38,15 +38,6 @@ steps:
|
|||
commands:
|
||||
- go test
|
||||
|
||||
secrets:
|
||||
image: docker
|
||||
commands:
|
||||
- echo $DOCKER_USERNAME
|
||||
- echo $DOCKER_PASSWORD
|
||||
secrets:
|
||||
- docker_username
|
||||
- docker_prod_password
|
||||
|
||||
detached:
|
||||
image: redis
|
||||
detach: true
|
||||
|
|
|
@ -59,14 +59,10 @@ func convertRepo(from *internal.Repo, perm *internal.RepoPerm) *model.Repo {
|
|||
ForgeURL: from.Links.HTML.Href,
|
||||
IsSCMPrivate: from.IsPrivate,
|
||||
Avatar: from.Owner.Links.Avatar.Href,
|
||||
SCMKind: model.SCMKind(from.Scm),
|
||||
Branch: from.MainBranch.Name,
|
||||
Perm: convertPerm(perm),
|
||||
PREnabled: true,
|
||||
}
|
||||
if repo.SCMKind == model.RepoHg {
|
||||
repo.Branch = "default"
|
||||
}
|
||||
return &repo
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ func Test_helper(t *testing.T) {
|
|||
from := &internal.Repo{
|
||||
FullName: "octocat/hello-world",
|
||||
IsPrivate: true,
|
||||
Scm: "hg",
|
||||
Scm: "git",
|
||||
}
|
||||
from.Owner.Links.Avatar.Href = "http://..."
|
||||
from.Links.HTML.Href = "https://bitbucket.org/foo/bar"
|
||||
|
@ -61,8 +61,6 @@ func Test_helper(t *testing.T) {
|
|||
g.Assert(to.FullName).Equal(from.FullName)
|
||||
g.Assert(to.Owner).Equal("octocat")
|
||||
g.Assert(to.Name).Equal("hello-world")
|
||||
g.Assert(to.Branch).Equal("default")
|
||||
g.Assert(string(to.SCMKind)).Equal(from.Scm)
|
||||
g.Assert(to.IsSCMPrivate).Equal(from.IsPrivate)
|
||||
g.Assert(to.Clone).Equal(from.Links.HTML.Href)
|
||||
g.Assert(to.ForgeURL).Equal(from.Links.HTML.Href)
|
||||
|
|
|
@ -125,7 +125,6 @@ func Test_parser(t *testing.T) {
|
|||
r, b, err := parseHook(req)
|
||||
g.Assert(err).IsNil()
|
||||
g.Assert(r.FullName).Equal("martinherren1984/publictestrepo")
|
||||
g.Assert(r.SCMKind).Equal(model.RepoGit)
|
||||
g.Assert(r.Clone).Equal("https://bitbucket.org/martinherren1984/publictestrepo")
|
||||
g.Assert(b.Commit).Equal("c14c1bb05dfb1fdcdf06b31485fff61b0ea44277")
|
||||
g.Assert(b.Message).Equal("a\n")
|
||||
|
|
|
@ -56,7 +56,6 @@ func convertRepo(from *bb.Repository, perm *model.Perm, branch string) *model.Re
|
|||
Name: from.Slug,
|
||||
Owner: from.Project.Key,
|
||||
Branch: branch,
|
||||
SCMKind: model.RepoGit,
|
||||
IsSCMPrivate: true, // Since we have to use Netrc it has to always be private :/ TODO: Is this really true?
|
||||
FullName: fmt.Sprintf("%s/%s", from.Project.Key, from.Slug),
|
||||
Perm: perm,
|
||||
|
|
|
@ -83,7 +83,6 @@ func TestHelper(t *testing.T) {
|
|||
g.Assert(to.Name).Equal("REPO")
|
||||
g.Assert(to.Owner).Equal("PRJ")
|
||||
g.Assert(to.Branch).Equal("main")
|
||||
g.Assert(to.SCMKind).Equal(model.RepoGit)
|
||||
g.Assert(to.FullName).Equal("PRJ/REPO")
|
||||
g.Assert(to.Perm).Equal(perm)
|
||||
g.Assert(to.Clone).Equal("https://git.domain/clone")
|
||||
|
|
|
@ -37,7 +37,6 @@ func toRepo(from *forgejo.Repository) *model.Repo {
|
|||
)
|
||||
return &model.Repo{
|
||||
ForgeRemoteID: model.ForgeRemoteID(fmt.Sprint(from.ID)),
|
||||
SCMKind: model.RepoGit,
|
||||
Name: name,
|
||||
Owner: from.Owner.UserName,
|
||||
FullName: from.FullName,
|
||||
|
|
|
@ -55,7 +55,6 @@ func TestForgejoParser(t *testing.T) {
|
|||
Clone: "https://codeberg.org/meisam/woodpecktester.git",
|
||||
CloneSSH: "git@codeberg.org:meisam/woodpecktester.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
PREnabled: true,
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
|
@ -90,7 +89,6 @@ func TestForgejoParser(t *testing.T) {
|
|||
ForgeURL: "http://forgejo.golang.org/gordon/hello-world",
|
||||
Clone: "http://forgejo.golang.org/gordon/hello-world.git",
|
||||
CloneSSH: "git@forgejo.golang.org:gordon/hello-world.git",
|
||||
SCMKind: "git",
|
||||
IsSCMPrivate: true,
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
|
@ -126,7 +124,6 @@ func TestForgejoParser(t *testing.T) {
|
|||
Clone: "http://127.0.0.1:3000/Test-CI/multi-line-secrets.git",
|
||||
CloneSSH: "ssh://git@127.0.0.1:2200/Test-CI/multi-line-secrets.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
Push: true,
|
||||
|
@ -161,7 +158,6 @@ func TestForgejoParser(t *testing.T) {
|
|||
Clone: "http://forgejo.golang.org/gordon/hello-world.git",
|
||||
CloneSSH: "git@forgejo.golang.org:gordon/hello-world.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
IsSCMPrivate: true,
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
|
@ -195,7 +191,6 @@ func TestForgejoParser(t *testing.T) {
|
|||
Clone: "https://forgejo.golang.org/gordon/hello-world.git",
|
||||
CloneSSH: "",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
IsSCMPrivate: true,
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
|
@ -233,7 +228,6 @@ func TestForgejoParser(t *testing.T) {
|
|||
Clone: "http://127.0.0.1:3000/Test-CI/multi-line-secrets.git",
|
||||
CloneSSH: "ssh://git@127.0.0.1:2200/Test-CI/multi-line-secrets.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
PREnabled: true,
|
||||
IsSCMPrivate: false,
|
||||
Perm: &model.Perm{
|
||||
|
@ -275,7 +269,6 @@ func TestForgejoParser(t *testing.T) {
|
|||
Clone: "https://forgejo.com/anbraten/test-repo.git",
|
||||
CloneSSH: "git@forgejo.com:anbraten/test-repo.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
PREnabled: true,
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
|
@ -313,7 +306,6 @@ func TestForgejoParser(t *testing.T) {
|
|||
Clone: "https://forgejo.com/anbraten/test-repo.git",
|
||||
CloneSSH: "git@forgejo.com:anbraten/test-repo.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
PREnabled: true,
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
|
@ -351,7 +343,6 @@ func TestForgejoParser(t *testing.T) {
|
|||
Clone: "https://git.xxx/anbraten/demo.git",
|
||||
CloneSSH: "ssh://git@git.xxx:22/anbraten/demo.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
PREnabled: true,
|
||||
IsSCMPrivate: true,
|
||||
Perm: &model.Perm{
|
||||
|
|
|
@ -38,7 +38,6 @@ func toRepo(from *gitea.Repository) *model.Repo {
|
|||
)
|
||||
return &model.Repo{
|
||||
ForgeRemoteID: model.ForgeRemoteID(fmt.Sprint(from.ID)),
|
||||
SCMKind: model.RepoGit,
|
||||
Name: name,
|
||||
Owner: from.Owner.UserName,
|
||||
FullName: from.FullName,
|
||||
|
|
|
@ -56,7 +56,6 @@ func TestGiteaParser(t *testing.T) {
|
|||
Clone: "https://codeberg.org/meisam/woodpecktester.git",
|
||||
CloneSSH: "git@codeberg.org:meisam/woodpecktester.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
PREnabled: true,
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
|
@ -91,7 +90,6 @@ func TestGiteaParser(t *testing.T) {
|
|||
ForgeURL: "http://gitea.golang.org/gordon/hello-world",
|
||||
Clone: "http://gitea.golang.org/gordon/hello-world.git",
|
||||
CloneSSH: "git@gitea.golang.org:gordon/hello-world.git",
|
||||
SCMKind: "git",
|
||||
IsSCMPrivate: true,
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
|
@ -127,7 +125,6 @@ func TestGiteaParser(t *testing.T) {
|
|||
Clone: "http://127.0.0.1:3000/Test-CI/multi-line-secrets.git",
|
||||
CloneSSH: "ssh://git@127.0.0.1:2200/Test-CI/multi-line-secrets.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
Push: true,
|
||||
|
@ -162,7 +159,6 @@ func TestGiteaParser(t *testing.T) {
|
|||
Clone: "http://gitea.golang.org/gordon/hello-world.git",
|
||||
CloneSSH: "git@gitea.golang.org:gordon/hello-world.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
IsSCMPrivate: true,
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
|
@ -196,7 +192,6 @@ func TestGiteaParser(t *testing.T) {
|
|||
Clone: "https://gitea.golang.org/gordon/hello-world.git",
|
||||
CloneSSH: "",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
IsSCMPrivate: true,
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
|
@ -234,7 +229,6 @@ func TestGiteaParser(t *testing.T) {
|
|||
Clone: "http://127.0.0.1:3000/Test-CI/multi-line-secrets.git",
|
||||
CloneSSH: "ssh://git@127.0.0.1:2200/Test-CI/multi-line-secrets.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
PREnabled: true,
|
||||
IsSCMPrivate: false,
|
||||
Perm: &model.Perm{
|
||||
|
@ -276,7 +270,6 @@ func TestGiteaParser(t *testing.T) {
|
|||
Clone: "https://gitea.com/anbraten/test-repo.git",
|
||||
CloneSSH: "git@gitea.com:anbraten/test-repo.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
PREnabled: true,
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
|
@ -314,7 +307,6 @@ func TestGiteaParser(t *testing.T) {
|
|||
Clone: "https://gitea.com/anbraten/test-repo.git",
|
||||
CloneSSH: "git@gitea.com:anbraten/test-repo.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
PREnabled: true,
|
||||
Perm: &model.Perm{
|
||||
Pull: true,
|
||||
|
@ -352,7 +344,6 @@ func TestGiteaParser(t *testing.T) {
|
|||
Clone: "https://git.xxx/anbraten/demo.git",
|
||||
CloneSSH: "ssh://git@git.xxx:22/anbraten/demo.git",
|
||||
Branch: "main",
|
||||
SCMKind: "git",
|
||||
PREnabled: true,
|
||||
IsSCMPrivate: true,
|
||||
Perm: &model.Perm{
|
||||
|
|
|
@ -94,7 +94,6 @@ func convertRepo(from *github.Repository) *model.Repo {
|
|||
Owner: from.GetOwner().GetLogin(),
|
||||
Avatar: from.GetOwner().GetAvatarURL(),
|
||||
Perm: convertPerm(from.GetPermissions()),
|
||||
SCMKind: model.RepoGit,
|
||||
PREnabled: true,
|
||||
}
|
||||
return repo
|
||||
|
@ -152,7 +151,6 @@ func convertRepoHook(eventRepo *github.PushEventRepository) *model.Repo {
|
|||
Clone: eventRepo.GetCloneURL(),
|
||||
CloneSSH: eventRepo.GetSSHURL(),
|
||||
Branch: eventRepo.GetDefaultBranch(),
|
||||
SCMKind: model.RepoGit,
|
||||
PREnabled: true,
|
||||
}
|
||||
if repo.FullName == "" {
|
||||
|
|
|
@ -115,7 +115,6 @@ func Test_helper(t *testing.T) {
|
|||
g.Assert(to.Owner).Equal("octocat")
|
||||
g.Assert(to.Name).Equal("hello-world")
|
||||
g.Assert(to.Branch).Equal("develop")
|
||||
g.Assert(string(to.SCMKind)).Equal("git")
|
||||
g.Assert(to.IsSCMPrivate).IsTrue()
|
||||
g.Assert(to.Clone).Equal("https://github.com/octocat/hello-world.git")
|
||||
g.Assert(to.ForgeURL).Equal("https://github.com/octocat/hello-world")
|
||||
|
|
|
@ -66,16 +66,6 @@ const (
|
|||
StatusCreated StatusValue = "created" // created / internal use only
|
||||
)
|
||||
|
||||
// SCMKind represent different version control systems.
|
||||
type SCMKind string // @name SCMKind
|
||||
|
||||
const (
|
||||
RepoGit SCMKind = "git"
|
||||
RepoHg SCMKind = "hg"
|
||||
RepoFossil SCMKind = "fossil"
|
||||
RepoPerforce SCMKind = "perforce"
|
||||
)
|
||||
|
||||
// RepoVisibility represent to what state a repo in woodpecker is visible to others.
|
||||
type RepoVisibility string // @name RepoVisibility
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ type Repo struct {
|
|||
Clone string `json:"clone_url,omitempty" xorm:"varchar(1000) 'clone'"`
|
||||
CloneSSH string `json:"clone_url_ssh" xorm:"varchar(1000) 'clone_ssh'"`
|
||||
Branch string `json:"default_branch,omitempty" xorm:"varchar(500) 'branch'"`
|
||||
SCMKind SCMKind `json:"scm,omitempty" xorm:"varchar(50) 'scm'"`
|
||||
PREnabled bool `json:"pr_enabled" xorm:"DEFAULT TRUE 'pr_enabled'"`
|
||||
Timeout int64 `json:"timeout,omitempty" xorm:"timeout"`
|
||||
Visibility RepoVisibility `json:"visibility" xorm:"varchar(10) 'visibility'"`
|
||||
|
@ -87,7 +86,6 @@ func (r *Repo) Update(from *Repo) {
|
|||
r.FullName = from.FullName
|
||||
r.Avatar = from.Avatar
|
||||
r.ForgeURL = from.ForgeURL
|
||||
r.SCMKind = from.SCMKind
|
||||
r.PREnabled = from.PREnabled
|
||||
if len(from.Clone) > 0 {
|
||||
r.Clone = from.Clone
|
||||
|
|
|
@ -48,7 +48,6 @@ func MetadataFromStruct(forge metadata.ServerForge, repo *model.Repo, pipeline,
|
|||
Owner: repo.Owner,
|
||||
RemoteID: fmt.Sprint(repo.ForgeRemoteID),
|
||||
ForgeURL: repo.ForgeURL,
|
||||
SCM: string(repo.SCMKind),
|
||||
CloneURL: repo.Clone,
|
||||
CloneSSHURL: repo.CloneSSH,
|
||||
Private: repo.IsSCMPrivate,
|
||||
|
|
|
@ -53,7 +53,7 @@ func TestMetadataFromStruct(t *testing.T) {
|
|||
"CI_PREV_COMMIT_MESSAGE": "", "CI_PREV_COMMIT_REF": "", "CI_PREV_COMMIT_REFSPEC": "", "CI_PREV_COMMIT_SHA": "", "CI_PREV_COMMIT_URL": "", "CI_PREV_PIPELINE_CREATED": "0",
|
||||
"CI_PREV_PIPELINE_DEPLOY_TARGET": "", "CI_PREV_PIPELINE_DEPLOY_TASK": "", "CI_PREV_PIPELINE_EVENT": "", "CI_PREV_PIPELINE_FINISHED": "0", "CI_PREV_PIPELINE_NUMBER": "0", "CI_PREV_PIPELINE_PARENT": "0",
|
||||
"CI_PREV_PIPELINE_STARTED": "0", "CI_PREV_PIPELINE_STATUS": "", "CI_PREV_PIPELINE_URL": "/repos/0/pipeline/0", "CI_PREV_PIPELINE_FORGE_URL": "", "CI_REPO": "", "CI_REPO_CLONE_URL": "", "CI_REPO_CLONE_SSH_URL": "", "CI_REPO_DEFAULT_BRANCH": "", "CI_REPO_REMOTE_ID": "",
|
||||
"CI_REPO_NAME": "", "CI_REPO_OWNER": "", "CI_REPO_PRIVATE": "false", "CI_REPO_SCM": "", "CI_REPO_TRUSTED": "false", "CI_REPO_TRUSTED_NETWORK": "false",
|
||||
"CI_REPO_NAME": "", "CI_REPO_OWNER": "", "CI_REPO_PRIVATE": "false", "CI_REPO_TRUSTED": "false", "CI_REPO_TRUSTED_NETWORK": "false",
|
||||
"CI_REPO_TRUSTED_VOLUMES": "false", "CI_REPO_TRUSTED_SECURITY": "false", "CI_REPO_URL": "",
|
||||
"CI_STEP_NAME": "", "CI_STEP_NUMBER": "0", "CI_STEP_STARTED": "", "CI_STEP_URL": "/repos/0/pipeline/0", "CI_SYSTEM_HOST": "", "CI_SYSTEM_NAME": "woodpecker",
|
||||
"CI_SYSTEM_PLATFORM": "", "CI_SYSTEM_URL": "", "CI_SYSTEM_VERSION": "", "CI_WORKFLOW_NAME": "", "CI_WORKFLOW_NUMBER": "0",
|
||||
|
@ -62,7 +62,7 @@ func TestMetadataFromStruct(t *testing.T) {
|
|||
{
|
||||
name: "Test with forge",
|
||||
forge: forge,
|
||||
repo: &model.Repo{FullName: "testUser/testRepo", ForgeURL: "https://gitea.com/testUser/testRepo", Clone: "https://gitea.com/testUser/testRepo.git", CloneSSH: "git@gitea.com:testUser/testRepo.git", Branch: "main", IsSCMPrivate: true, SCMKind: "git"},
|
||||
repo: &model.Repo{FullName: "testUser/testRepo", ForgeURL: "https://gitea.com/testUser/testRepo", Clone: "https://gitea.com/testUser/testRepo.git", CloneSSH: "git@gitea.com:testUser/testRepo.git", Branch: "main", IsSCMPrivate: true},
|
||||
pipeline: &model.Pipeline{Number: 3, ChangedFiles: []string{"test.go", "markdown file.md"}},
|
||||
prev: &model.Pipeline{Number: 2},
|
||||
workflow: &model.Workflow{Name: "hello"},
|
||||
|
@ -70,7 +70,7 @@ func TestMetadataFromStruct(t *testing.T) {
|
|||
expectedMetadata: metadata.Metadata{
|
||||
Forge: metadata.Forge{Type: "gitea", URL: "https://gitea.com"},
|
||||
Sys: metadata.System{Name: "woodpecker", Host: "example.com", URL: "https://example.com"},
|
||||
Repo: metadata.Repo{Owner: "testUser", Name: "testRepo", ForgeURL: "https://gitea.com/testUser/testRepo", CloneURL: "https://gitea.com/testUser/testRepo.git", CloneSSHURL: "git@gitea.com:testUser/testRepo.git", Branch: "main", Private: true, SCM: "git"},
|
||||
Repo: metadata.Repo{Owner: "testUser", Name: "testRepo", ForgeURL: "https://gitea.com/testUser/testRepo", CloneURL: "https://gitea.com/testUser/testRepo.git", CloneSSHURL: "git@gitea.com:testUser/testRepo.git", Branch: "main", Private: true},
|
||||
Curr: metadata.Pipeline{
|
||||
Number: 3,
|
||||
Commit: metadata.Commit{ChangedFiles: []string{"test.go", "markdown file.md"}},
|
||||
|
@ -90,7 +90,7 @@ func TestMetadataFromStruct(t *testing.T) {
|
|||
"CI_PREV_PIPELINE_DEPLOY_TARGET": "", "CI_PREV_PIPELINE_DEPLOY_TASK": "", "CI_PREV_PIPELINE_EVENT": "", "CI_PREV_PIPELINE_FINISHED": "0", "CI_PREV_PIPELINE_NUMBER": "2", "CI_PREV_PIPELINE_PARENT": "0",
|
||||
"CI_PREV_PIPELINE_STARTED": "0", "CI_PREV_PIPELINE_STATUS": "", "CI_PREV_PIPELINE_URL": "https://example.com/repos/0/pipeline/2", "CI_PREV_PIPELINE_FORGE_URL": "", "CI_REPO": "testUser/testRepo", "CI_REPO_CLONE_URL": "https://gitea.com/testUser/testRepo.git", "CI_REPO_CLONE_SSH_URL": "git@gitea.com:testUser/testRepo.git",
|
||||
"CI_REPO_DEFAULT_BRANCH": "main", "CI_REPO_NAME": "testRepo", "CI_REPO_OWNER": "testUser", "CI_REPO_PRIVATE": "true", "CI_REPO_REMOTE_ID": "",
|
||||
"CI_REPO_SCM": "git", "CI_REPO_TRUSTED": "false", "CI_REPO_TRUSTED_NETWORK": "false",
|
||||
"CI_REPO_TRUSTED": "false", "CI_REPO_TRUSTED_NETWORK": "false",
|
||||
"CI_REPO_TRUSTED_VOLUMES": "false", "CI_REPO_TRUSTED_SECURITY": "false",
|
||||
"CI_REPO_URL": "https://gitea.com/testUser/testRepo",
|
||||
"CI_STEP_NAME": "", "CI_STEP_NUMBER": "0", "CI_STEP_STARTED": "", "CI_STEP_URL": "https://example.com/repos/0/pipeline/3", "CI_SYSTEM_HOST": "example.com",
|
||||
|
|
|
@ -56,7 +56,6 @@ type repoV008 struct {
|
|||
Clone string `xorm:"varchar(1000) 'repo_clone'"`
|
||||
CloneSSH string `xorm:"varchar(1000) 'repo_clone_ssh'"`
|
||||
Branch string `xorm:"varchar(500) 'repo_branch'"`
|
||||
SCMKind model.SCMKind `xorm:"varchar(50) 'repo_scm'"`
|
||||
PREnabled bool `xorm:"DEFAULT TRUE 'repo_pr_enabled'"`
|
||||
Timeout int64 `xorm:"repo_timeout"`
|
||||
Visibility model.RepoVisibility `xorm:"varchar(10) 'repo_visibility'"`
|
||||
|
|
Loading…
Reference in a new issue