@@ -31,12 +31,15 @@ const (
3131
3232 GitlabDefaultAPIUrl = "https://gitlab.com"
3333 GitlabDefaultHost = "https://gitlab.com"
34+
35+ GiteaDefaultAPIUrl = "https://gitea.com"
36+ GiteaDefaultHost = "https://gitea.com/"
3437)
3538
3639// GitConfig is a git repository where the IntegrationConfig to be configured
3740type GitConfig struct {
3841 // Type for git remote server
39- // +kubebuilder:validation:Enum=github;gitlab
42+ // +kubebuilder:validation:Enum=github;gitlab;gitea
4043 Type GitType `json:"type"`
4144
4245 // Repository name of git repository (in <org>/<repo> form, e.g., tmax-cloud/cicd-operator)
@@ -60,6 +63,8 @@ func (config *GitConfig) GetGitHost() (string, error) {
6063 gitURL = GithubDefaultHost
6164 } else if gitURL == GitlabDefaultAPIUrl {
6265 gitURL = GitlabDefaultHost
66+ } else if gitURL == GiteaDefaultAPIUrl {
67+ gitURL = GiteaDefaultHost
6368 }
6469 gitU , err := url .Parse (gitURL )
6570 if err != nil {
@@ -75,6 +80,8 @@ func (config *GitConfig) GetAPIUrl() string {
7580 return GithubDefaultAPIUrl
7681 } else if config .Type == GitTypeGitLab && config .APIUrl == "" {
7782 return GitlabDefaultAPIUrl
83+ } else if config .Type == GitTypeGitea && config .APIUrl == "" {
84+ return GiteaDefaultAPIUrl
7885 }
7986 return config .APIUrl
8087}
@@ -100,6 +107,7 @@ type GitType string
100107const (
101108 GitTypeGitHub = GitType ("github" )
102109 GitTypeGitLab = GitType ("gitlab" )
110+ GitTypeGitea = GitType ("gitea" )
103111 GitTypeFake = GitType ("fake" )
104112)
105113
0 commit comments