diff --git a/cli/exec/flags.go b/cli/exec/flags.go index d50376bdb..10518d32b 100644 --- a/cli/exec/flags.go +++ b/cli/exec/flags.go @@ -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", diff --git a/cli/exec/metadata.go b/cli/exec/metadata.go index 799e843a4..f3f1cefec 100644 --- a/cli/exec/metadata.go +++ b/cli/exec/metadata.go @@ -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) diff --git a/docs/docs/20-usage/20-workflow-syntax.md b/docs/docs/20-usage/20-workflow-syntax.md index a3d04da37..b5871a8fd 100644 --- a/docs/docs/20-usage/20-workflow-syntax.md +++ b/docs/docs/20-usage/20-workflow-syntax.md @@ -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`: diff --git a/docs/docs/20-usage/50-environment.md b/docs/docs/20-usage/50-environment.md index 9f6bd75e7..e2f112d3a 100644 --- a/docs/docs/20-usage/50-environment.md +++ b/docs/docs/20-usage/50-environment.md @@ -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` | diff --git a/docs/src/pages/migrations.md b/docs/src/pages/migrations.md index 9b7639366..b1dbc4263 100644 --- a/docs/src/pages/migrations.md +++ b/docs/src/pages/migrations.md @@ -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. diff --git a/pipeline/backend/local/clone.go b/pipeline/backend/local/clone.go index 4a9bb5ff4..a86cde5c2 100644 --- a/pipeline/backend/local/clone.go +++ b/pipeline/backend/local/clone.go @@ -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) } diff --git a/pipeline/frontend/metadata/drone_compatibility.go b/pipeline/frontend/metadata/drone_compatibility.go index c6de5510d..d93d14d90 100644 --- a/pipeline/frontend/metadata/drone_compatibility.go +++ b/pipeline/frontend/metadata/drone_compatibility.go @@ -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 diff --git a/pipeline/frontend/metadata/drone_compatibility_test.go b/pipeline/frontend/metadata/drone_compatibility_test.go index f38bdc5e2..291175ac5 100644 --- a/pipeline/frontend/metadata/drone_compatibility_test.go +++ b/pipeline/frontend/metadata/drone_compatibility_test.go @@ -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 diff --git a/pipeline/frontend/metadata/environment.go b/pipeline/frontend/metadata/environment.go index 25ac55d31..d1d80726f 100644 --- a/pipeline/frontend/metadata/environment.go +++ b/pipeline/frontend/metadata/environment.go @@ -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, diff --git a/pipeline/frontend/metadata/types.go b/pipeline/frontend/metadata/types.go index 5fa56e85e..7b1084f65 100644 --- a/pipeline/frontend/metadata/types.go +++ b/pipeline/frontend/metadata/types.go @@ -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"` diff --git a/pipeline/frontend/yaml/linter/schema/.woodpecker/test-step.yaml b/pipeline/frontend/yaml/linter/schema/.woodpecker/test-step.yaml index da6ada4f2..1aadfa601 100644 --- a/pipeline/frontend/yaml/linter/schema/.woodpecker/test-step.yaml +++ b/pipeline/frontend/yaml/linter/schema/.woodpecker/test-step.yaml @@ -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 diff --git a/server/forge/bitbucket/convert.go b/server/forge/bitbucket/convert.go index 6dc8f1fb1..df3f7351a 100644 --- a/server/forge/bitbucket/convert.go +++ b/server/forge/bitbucket/convert.go @@ -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 } diff --git a/server/forge/bitbucket/convert_test.go b/server/forge/bitbucket/convert_test.go index 70dac2bae..d3dcb1904 100644 --- a/server/forge/bitbucket/convert_test.go +++ b/server/forge/bitbucket/convert_test.go @@ -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) diff --git a/server/forge/bitbucket/parse_test.go b/server/forge/bitbucket/parse_test.go index a5562fc39..09d2f5098 100644 --- a/server/forge/bitbucket/parse_test.go +++ b/server/forge/bitbucket/parse_test.go @@ -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") diff --git a/server/forge/bitbucketdatacenter/convert.go b/server/forge/bitbucketdatacenter/convert.go index bef0c30d5..bb365f13e 100644 --- a/server/forge/bitbucketdatacenter/convert.go +++ b/server/forge/bitbucketdatacenter/convert.go @@ -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, diff --git a/server/forge/bitbucketdatacenter/convert_test.go b/server/forge/bitbucketdatacenter/convert_test.go index 564f00530..f1c1a1f7c 100644 --- a/server/forge/bitbucketdatacenter/convert_test.go +++ b/server/forge/bitbucketdatacenter/convert_test.go @@ -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") diff --git a/server/forge/forgejo/helper.go b/server/forge/forgejo/helper.go index 0ab2b24e0..a1d8bfecb 100644 --- a/server/forge/forgejo/helper.go +++ b/server/forge/forgejo/helper.go @@ -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, diff --git a/server/forge/forgejo/parse_test.go b/server/forge/forgejo/parse_test.go index 9415d9975..e0ce07d89 100644 --- a/server/forge/forgejo/parse_test.go +++ b/server/forge/forgejo/parse_test.go @@ -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{ diff --git a/server/forge/gitea/helper.go b/server/forge/gitea/helper.go index 69b2a885b..3a7e1dfbe 100644 --- a/server/forge/gitea/helper.go +++ b/server/forge/gitea/helper.go @@ -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, diff --git a/server/forge/gitea/parse_test.go b/server/forge/gitea/parse_test.go index a37384464..ee06e9976 100644 --- a/server/forge/gitea/parse_test.go +++ b/server/forge/gitea/parse_test.go @@ -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{ diff --git a/server/forge/github/convert.go b/server/forge/github/convert.go index 2047826ad..7bb29d260 100644 --- a/server/forge/github/convert.go +++ b/server/forge/github/convert.go @@ -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 == "" { diff --git a/server/forge/github/convert_test.go b/server/forge/github/convert_test.go index 605aa0452..699570357 100644 --- a/server/forge/github/convert_test.go +++ b/server/forge/github/convert_test.go @@ -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") diff --git a/server/model/const.go b/server/model/const.go index 0707473b8..950f933ee 100644 --- a/server/model/const.go +++ b/server/model/const.go @@ -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 diff --git a/server/model/repo.go b/server/model/repo.go index 3c18e17e0..ed0b81eb2 100644 --- a/server/model/repo.go +++ b/server/model/repo.go @@ -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 diff --git a/server/pipeline/stepbuilder/metadata.go b/server/pipeline/stepbuilder/metadata.go index 52d79b4bb..e561583ce 100644 --- a/server/pipeline/stepbuilder/metadata.go +++ b/server/pipeline/stepbuilder/metadata.go @@ -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, diff --git a/server/pipeline/stepbuilder/metadata_test.go b/server/pipeline/stepbuilder/metadata_test.go index 1111a5603..ff8659793 100644 --- a/server/pipeline/stepbuilder/metadata_test.go +++ b/server/pipeline/stepbuilder/metadata_test.go @@ -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", diff --git a/server/store/datastore/migration/008_set_default_forge_id.go b/server/store/datastore/migration/008_set_default_forge_id.go index d430dbda2..faeaa9a07 100644 --- a/server/store/datastore/migration/008_set_default_forge_id.go +++ b/server/store/datastore/migration/008_set_default_forge_id.go @@ -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'"`