@@ -58,7 +58,7 @@ func addWebService(c *restful.Container) error {
|
|||||||
|
|
||||||
webservice.Route(webservice.PATCH("/devops/{devops}").
|
webservice.Route(webservice.PATCH("/devops/{devops}").
|
||||||
To(devopsapi.UpdateProjectHandler).
|
To(devopsapi.UpdateProjectHandler).
|
||||||
Doc("get devops project").
|
Doc("update devops project").
|
||||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||||
Param(webservice.PathParameter("devops", "devops project's Id")).
|
Param(webservice.PathParameter("devops", "devops project's Id")).
|
||||||
Returns(http.StatusOK, RespOK, devops.DevOpsProject{}).
|
Returns(http.StatusOK, RespOK, devops.DevOpsProject{}).
|
||||||
@@ -66,7 +66,7 @@ func addWebService(c *restful.Container) error {
|
|||||||
|
|
||||||
webservice.Route(webservice.GET("/devops/{devops}/defaultroles").
|
webservice.Route(webservice.GET("/devops/{devops}/defaultroles").
|
||||||
To(devopsapi.GetDevOpsProjectDefaultRoles).
|
To(devopsapi.GetDevOpsProjectDefaultRoles).
|
||||||
Doc("get devops project defaultroles").
|
Doc("get devops project default roles").
|
||||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||||
Param(webservice.PathParameter("devops", "devops project's Id")).
|
Param(webservice.PathParameter("devops", "devops project's Id")).
|
||||||
Returns(http.StatusOK, RespOK, []devops.Role{}).
|
Returns(http.StatusOK, RespOK, []devops.Role{}).
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Role struct {
|
type Role struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name" description:"role's name'"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description" description:"role 's description'"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var DefaultRoles = []*Role{
|
var DefaultRoles = []*Role{
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type DevOpsProjectMembership struct {
|
type DevOpsProjectMembership struct {
|
||||||
Username string `json:"username"`
|
Username string `json:"username" description:"member's username,username can uniquely identify a user"`
|
||||||
ProjectId string `json:"project_id" db:"project_id"`
|
ProjectId string `json:"project_id" db:"project_id" description:"the devops projects which project membership belongs to"`
|
||||||
Role string `json:"role"`
|
Role string `json:"role" description:"devops project membership's role type'"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status" description:"Desperated, status of project membership"`
|
||||||
GrantBy string `json:"grand_by,omitempty"`
|
GrantBy string `json:"grand_by,omitempty" description:"Username of the user who assigned the role"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var DevOpsProjectMembershipColumns = GetColumnsFromStruct(&DevOpsProjectMembership{})
|
var DevOpsProjectMembershipColumns = GetColumnsFromStruct(&DevOpsProjectMembership{})
|
||||||
|
|||||||
@@ -37,15 +37,23 @@ type PageableDevOpsProject struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DevOpsProject struct {
|
type DevOpsProject struct {
|
||||||
ProjectId string `json:"project_id" db:"project_id"`
|
ProjectId string `json:"project_id" db:"project_id" description:"ProjectId must be unique within a namespace, it is generated by kubesphere."`
|
||||||
Name string `json:"name"`
|
|
||||||
Description string `json:"description,omitempty"`
|
Name string `json:"name" description:"DevOps Projects's Name'"`
|
||||||
Creator string `json:"creator"`
|
|
||||||
CreateTime time.Time `json:"create_time"`
|
Description string `json:"description,omitempty" description:"DevOps Projets's Description, used to describe the DevOps Project'"`
|
||||||
Status string `json:"status"`
|
|
||||||
Visibility string `json:"visibility,omitempty"`
|
Creator string `json:"creator" description:"Creator's username'"`
|
||||||
Extra string `json:"extra,omitempty"`
|
|
||||||
Workspace string `json:"workspace"`
|
CreateTime time.Time `json:"create_time" description:"DevOps Project's Creation time'"`
|
||||||
|
|
||||||
|
Status string `json:"status" description:"DevOps project's status"`
|
||||||
|
|
||||||
|
Visibility string `json:"visibility,omitempty" description:"Desperated Field"`
|
||||||
|
|
||||||
|
Extra string `json:"extra,omitempty" description:"Internal Use"`
|
||||||
|
|
||||||
|
Workspace string `json:"workspace" description:"The workspace to which the devops project belongs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDevOpsProject(name, description, creator, extra, workspace string) *DevOpsProject {
|
func NewDevOpsProject(name, description, creator, extra, workspace string) *DevOpsProject {
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type JenkinsCredential struct {
|
type JenkinsCredential struct {
|
||||||
Id string `json:"id"`
|
Id string `json:"id" description:"id of credential"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type" description:"type of credential,such as ssh/kubeconfig"`
|
||||||
DisplayName string `json:"display_name,omitempty"`
|
DisplayName string `json:"display_name,omitempty" description:"credential's display name'"`
|
||||||
Fingerprint *struct {
|
Fingerprint *struct {
|
||||||
FileName string `json:"file_name,omitempty"`
|
FileName string `json:"file_name,omitempty"`
|
||||||
Hash string `json:"hash,omitempty"`
|
Hash string `json:"hash,omitempty"`
|
||||||
@@ -41,7 +41,7 @@ type JenkinsCredential struct {
|
|||||||
} `json:"ranges,omitempty"`
|
} `json:"ranges,omitempty"`
|
||||||
} `json:"ranges,omitempty"`
|
} `json:"ranges,omitempty"`
|
||||||
} `json:"usage,omitempty"`
|
} `json:"usage,omitempty"`
|
||||||
} `json:"fingerprint,omitempty"`
|
} `json:"fingerprint,omitempty" description:""`
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"description,omitempty"`
|
||||||
Domain string `json:"domain,omitempty"`
|
Domain string `json:"domain,omitempty"`
|
||||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||||
|
|||||||
@@ -53,99 +53,99 @@ type SonarStatus struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ProjectPipeline struct {
|
type ProjectPipeline struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type" description:"type of devops pipeline, in scm or no scm"`
|
||||||
Pipeline *NoScmPipeline `json:"pipeline,omitempty"`
|
Pipeline *NoScmPipeline `json:"pipeline,omitempty" description:"no scm pipeline structs"`
|
||||||
MultiBranchPipeline *MultiBranchPipeline `json:"multi_branch_pipeline,omitempty"`
|
MultiBranchPipeline *MultiBranchPipeline `json:"multi_branch_pipeline,omitempty" description:"in scm pipeline structs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NoScmPipeline struct {
|
type NoScmPipeline struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name" description:"name of pipeline"`
|
||||||
Description string `json:"descriptio,omitempty"`
|
Description string `json:"descriptio,omitempty" description:"description of pipeline"`
|
||||||
Discarder *DiscarderProperty `json:"discarder,omitempty"`
|
Discarder *DiscarderProperty `json:"discarder,omitempty" description:"Discarder of pipeline, managing when to drop a pipeline"`
|
||||||
Parameters []*Parameter `json:"parameters,omitempty"`
|
Parameters []*Parameter `json:"parameters,omitempty" description:"Parameters define of pipeline,user could pass param when run pipeline"`
|
||||||
DisableConcurrent bool `json:"disable_concurrent,omitempty" mapstructure:"disable_concurrent"`
|
DisableConcurrent bool `json:"disable_concurrent,omitempty" mapstructure:"disable_concurrent" description:"Whether to prohibit the pipeline from running in parallel"`
|
||||||
TimerTrigger *TimerTrigger `json:"timer_trigger,omitempty" mapstructure:"timer_trigger"`
|
TimerTrigger *TimerTrigger `json:"timer_trigger,omitempty" mapstructure:"timer_trigger" description:"Timer to trigger pipeline run"`
|
||||||
RemoteTrigger *RemoteTrigger `json:"remote_trigger,omitempty" mapstructure:"remote_trigger"`
|
RemoteTrigger *RemoteTrigger `json:"remote_trigger,omitempty" mapstructure:"remote_trigger" description:"Remote api define to trigger pipeline run"`
|
||||||
Jenkinsfile string `json:"jenkinsfile,omitempty"`
|
Jenkinsfile string `json:"jenkinsfile,omitempty" description:"Jenkinsfile's content'"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MultiBranchPipeline struct {
|
type MultiBranchPipeline struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name" description:"name of pipeline"`
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"descriptio,omitempty" description:"description of pipeline"`
|
||||||
Discarder *DiscarderProperty `json:"discarder,omitempty"`
|
Discarder *DiscarderProperty `json:"discarder,omitempty" description:"Discarder of pipeline, managing when to drop a pipeline"`
|
||||||
TimerTrigger *TimerTrigger `json:"timer_trigger,omitempty" mapstructure:"timer_trigger"`
|
TimerTrigger *TimerTrigger `json:"timer_trigger,omitempty" mapstructure:"timer_trigger" description:"Timer to trigger pipeline run"`
|
||||||
SourceType string `json:"source_type"`
|
SourceType string `json:"source_type" description:"type of scm, such as github/git/svn"`
|
||||||
GitSource *GitSource `json:"git_source,omitempty"`
|
GitSource *GitSource `json:"git_source,omitempty" description:"git scm define"`
|
||||||
GitHubSource *GithubSource `json:"github_source,omitempty"`
|
GitHubSource *GithubSource `json:"github_source,omitempty" description:"github scm define"`
|
||||||
SvnSource *SvnSource `json:"svn_source,omitempty"`
|
SvnSource *SvnSource `json:"svn_source,omitempty" description:"multi branch svn scm define"`
|
||||||
SingleSvnSource *SingleSvnSource `json:"single_svn_source,omitempty"`
|
SingleSvnSource *SingleSvnSource `json:"single_svn_source,omitempty" description:"single branch svn scm define"`
|
||||||
ScriptPath string `json:"script_path" mapstructure:"script_path"`
|
ScriptPath string `json:"script_path" mapstructure:"script_path" description:"script path in scm"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GitSource struct {
|
type GitSource struct {
|
||||||
Url string `json:"url,omitempty" mapstructure:"url"`
|
Url string `json:"url,omitempty" mapstructure:"url" description:"url of git source"`
|
||||||
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id"`
|
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id" description:"credential id to access git source"`
|
||||||
DiscoverBranches bool `json:"discover_branches,omitempty" mapstructure:"discover_branches"`
|
DiscoverBranches bool `json:"discover_branches,omitempty" mapstructure:"discover_branches" description:"Whether to discover a branch"`
|
||||||
CloneOption *GitCloneOption `json:"git_clone_option,omitempty" mapstructure:"git_clone_option"`
|
CloneOption *GitCloneOption `json:"git_clone_option,omitempty" mapstructure:"git_clone_option" description:"advavced git clone options"`
|
||||||
RegexFilter string `json:"regex_filter,omitempty" mapstructure:"regex_filter"`
|
RegexFilter string `json:"regex_filter,omitempty" mapstructure:"regex_filter" description:"Regex used to match the name of the branch that needs to be run"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GithubSource struct {
|
type GithubSource struct {
|
||||||
Owner string `json:"owner,omitempty" mapstructure:"owner"`
|
Owner string `json:"owner,omitempty" mapstructure:"owner" description:"owner of github repo"`
|
||||||
Repo string `json:"repo,omitempty" mapstructure:"repo"`
|
Repo string `json:"repo,omitempty" mapstructure:"repo" description:"repo name of github repo"`
|
||||||
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id"`
|
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id" description:"credential id to access github source"`
|
||||||
ApiUri string `json:"api_uri,omitempty" mapstructure:"api_uri"`
|
ApiUri string `json:"api_uri,omitempty" mapstructure:"api_uri" description:"The api url can specify the location of the github apiserver.For private cloud configuration"`
|
||||||
DiscoverBranches int `json:"discover_branches,omitempty" mapstructure:"discover_branches"`
|
DiscoverBranches int `json:"discover_branches,omitempty" mapstructure:"discover_branches" description:"Discover branch configuration"`
|
||||||
DiscoverPRFromOrigin int `json:"discover_pr_from_origin,omitempty" mapstructure:"discover_pr_from_origin"`
|
DiscoverPRFromOrigin int `json:"discover_pr_from_origin,omitempty" mapstructure:"discover_pr_from_origin" description:"Discover origin PR configuration"`
|
||||||
DiscoverPRFromForks *GithubDiscoverPRFromForks `json:"discover_pr_from_forks,omitempty" mapstructure:"discover_pr_from_forks"`
|
DiscoverPRFromForks *GithubDiscoverPRFromForks `json:"discover_pr_from_forks,omitempty" mapstructure:"discover_pr_from_forks" description:"Discover fork PR configuration"`
|
||||||
CloneOption *GitCloneOption `json:"git_clone_option,omitempty" mapstructure:"git_clone_option"`
|
CloneOption *GitCloneOption `json:"git_clone_option,omitempty" mapstructure:"git_clone_option" description:"advavced git clone options"`
|
||||||
RegexFilter string `json:"regex_filter,omitempty" mapstructure:"regex_filter"`
|
RegexFilter string `json:"regex_filter,omitempty" mapstructure:"regex_filter" description:"Regex used to match the name of the branch that needs to be run"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GitCloneOption struct {
|
type GitCloneOption struct {
|
||||||
Shallow bool `json:"shallow,omitempty" mapstructure:"shallow"`
|
Shallow bool `json:"shallow,omitempty" mapstructure:"shallow" description:"Whether to use git shallow clone"`
|
||||||
Timeout int `json:"timeout,omitempty" mapstructure:"timeout"`
|
Timeout int `json:"timeout,omitempty" mapstructure:"timeout" description:"git clone timeout mins"`
|
||||||
Depth int `json:"depth,omitempty" mapstructure:"depth"`
|
Depth int `json:"depth,omitempty" mapstructure:"depth" description:"git clone depth"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SvnSource struct {
|
type SvnSource struct {
|
||||||
Remote string `json:"remote,omitempty"`
|
Remote string `json:"remote,omitempty" description:"remote address url"`
|
||||||
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id"`
|
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id" description:"credential id to access svn source"`
|
||||||
Includes string `json:"includes,omitempty"`
|
Includes string `json:"includes,omitempty" description:"branches to run pipeline"`
|
||||||
Excludes string `json:"excludes,omitempty"`
|
Excludes string `json:"excludes,omitempty" description:"branches do not run pipeline"`
|
||||||
}
|
}
|
||||||
type SingleSvnSource struct {
|
type SingleSvnSource struct {
|
||||||
Remote string `json:"remote,omitempty"`
|
Remote string `json:"remote,omitempty" description:"remote address url"`
|
||||||
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id"`
|
CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id" description:"credential id to access svn source"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GithubDiscoverPRFromForks struct {
|
type GithubDiscoverPRFromForks struct {
|
||||||
Strategy int `json:"strategy,omitempty" mapstructure:"strategy"`
|
Strategy int `json:"strategy,omitempty" mapstructure:"strategy" description:"github discover startegy"`
|
||||||
Trust int `json:"trust,omitempty" mapstructure:"trust"`
|
Trust int `json:"trust,omitempty" mapstructure:"trust" description:"trust user type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DiscarderProperty struct {
|
type DiscarderProperty struct {
|
||||||
DaysToKeep string `json:"days_to_keep,omitempty" mapstructure:"days_to_keep"`
|
DaysToKeep string `json:"days_to_keep,omitempty" mapstructure:"days_to_keep" description:"days to keep pipeline"`
|
||||||
NumToKeep string `json:"num_to_keep,omitempty" mapstructure:"num_to_keep"`
|
NumToKeep string `json:"num_to_keep,omitempty" mapstructure:"num_to_keep" description:"nums to keep pipeline"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Parameter struct {
|
type Parameter struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name" description:"name of param"`
|
||||||
DefaultValue string `json:"default_value,omitempty" mapstructure:"default_value"`
|
DefaultValue string `json:"default_value,omitempty" mapstructure:"default_value" description:"default value of param"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type" description:"type of param"`
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"description,omitempty" description:"description of pipeline"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TimerTrigger struct {
|
type TimerTrigger struct {
|
||||||
// user in no scm job
|
// user in no scm job
|
||||||
Cron string `json:"cron,omitempty"`
|
Cron string `json:"cron,omitempty" description:"jenkins cron script"`
|
||||||
|
|
||||||
// use in multi-branch job
|
// use in multi-branch job
|
||||||
Interval string `json:"interval,omitempty"`
|
Interval string `json:"interval,omitempty" description:"interval ms"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RemoteTrigger struct {
|
type RemoteTrigger struct {
|
||||||
Token string `json:"token,omitempty"`
|
Token string `json:"token,omitempty" description:"remote trigger token"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func replaceXmlVersion(config, oldVersion, targetVersion string) string {
|
func replaceXmlVersion(config, oldVersion, targetVersion string) string {
|
||||||
|
|||||||
Reference in New Issue
Block a user