Create Repo / Org make --forge-type optional
* This makes gitea garm usage unnessary complex Signed-off-by: Christopher Homberger <christopher.homberger@web.de>
This commit is contained in:
parent
18ef27bb91
commit
efd725ea94
8 changed files with 53 additions and 26 deletions
|
|
@ -78,6 +78,7 @@ const (
|
|||
)
|
||||
|
||||
const (
|
||||
AutoEndpointType EndpointType = ""
|
||||
GithubEndpointType EndpointType = "github"
|
||||
GiteaEndpointType EndpointType = "gitea"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -48,15 +48,6 @@ type CreateRepoParams struct {
|
|||
ForgeType EndpointType `json:"forge_type,omitempty"`
|
||||
}
|
||||
|
||||
func (c CreateRepoParams) GetForgeType() EndpointType {
|
||||
switch c.ForgeType {
|
||||
case GithubEndpointType, GiteaEndpointType:
|
||||
return c.ForgeType
|
||||
default:
|
||||
return GithubEndpointType
|
||||
}
|
||||
}
|
||||
|
||||
func (c *CreateRepoParams) Validate() error {
|
||||
if c.Owner == "" {
|
||||
return runnerErrors.NewBadRequestError("missing owner")
|
||||
|
|
@ -73,6 +64,13 @@ func (c *CreateRepoParams) Validate() error {
|
|||
return runnerErrors.NewMissingSecretError("missing secret")
|
||||
}
|
||||
|
||||
switch c.ForgeType {
|
||||
case GithubEndpointType, GiteaEndpointType, AutoEndpointType:
|
||||
break
|
||||
default:
|
||||
return runnerErrors.NewBadRequestError("invalid forge type")
|
||||
}
|
||||
|
||||
switch c.PoolBalancerType {
|
||||
case PoolBalancerTypeRoundRobin, PoolBalancerTypePack, PoolBalancerTypeNone:
|
||||
default:
|
||||
|
|
@ -90,15 +88,6 @@ type CreateOrgParams struct {
|
|||
ForgeType EndpointType `json:"forge_type,omitempty"`
|
||||
}
|
||||
|
||||
func (c CreateOrgParams) GetForgeType() EndpointType {
|
||||
switch c.ForgeType {
|
||||
case GithubEndpointType, GiteaEndpointType:
|
||||
return c.ForgeType
|
||||
default:
|
||||
return GithubEndpointType
|
||||
}
|
||||
}
|
||||
|
||||
func (c *CreateOrgParams) Validate() error {
|
||||
if c.Name == "" {
|
||||
return runnerErrors.NewBadRequestError("missing org name")
|
||||
|
|
@ -111,6 +100,13 @@ func (c *CreateOrgParams) Validate() error {
|
|||
return runnerErrors.NewMissingSecretError("missing secret")
|
||||
}
|
||||
|
||||
switch c.ForgeType {
|
||||
case GithubEndpointType, GiteaEndpointType, AutoEndpointType:
|
||||
break
|
||||
default:
|
||||
return runnerErrors.NewBadRequestError("invalid forge type")
|
||||
}
|
||||
|
||||
switch c.PoolBalancerType {
|
||||
case PoolBalancerTypeRoundRobin, PoolBalancerTypePack, PoolBalancerTypeNone:
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue