From 6b3b0aa4f184865a0f6a8fe03d40647bb70606f7 Mon Sep 17 00:00:00 2001 From: soulseen Date: Wed, 15 May 2019 15:52:34 +0800 Subject: [PATCH 01/10] update jenkins log Signed-off-by: soulseen --- pkg/models/devops/devops.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/models/devops/devops.go b/pkg/models/devops/devops.go index 461d469a7..f91c5ef10 100644 --- a/pkg/models/devops/devops.go +++ b/pkg/models/devops/devops.go @@ -683,7 +683,6 @@ func sendJenkinsRequest(baseUrl string, req *http.Request) ([]byte, error) { defer resp.Body.Close() resBody, _ := getRespBody(resp) - log.Info(string(resBody)) if resp.StatusCode >= http.StatusBadRequest { jkerr := new(JkError) jkerr.Code = resp.StatusCode From d9cce21f051800bdcd7a70fc679bd0e69ad11a92 Mon Sep 17 00:00:00 2001 From: Jeff Date: Wed, 15 May 2019 15:53:28 +0800 Subject: [PATCH 02/10] add quota left to namespace quota --- pkg/apis/resources/v1alpha2/register.go | 1 + pkg/models/quotas/quotas.go | 83 ++++++++++++++++++------- 2 files changed, 62 insertions(+), 22 deletions(-) diff --git a/pkg/apis/resources/v1alpha2/register.go b/pkg/apis/resources/v1alpha2/register.go index 729fc2a42..0f0445917 100644 --- a/pkg/apis/resources/v1alpha2/register.go +++ b/pkg/apis/resources/v1alpha2/register.go @@ -180,6 +180,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/quotas"). To(quotas.GetClusterQuotas). + Deprecate(). Doc("get whole cluster's resource usage"). Writes(models.ResourceQuota{}). Metadata(restfulspec.KeyOpenAPITags, tags)) diff --git a/pkg/models/quotas/quotas.go b/pkg/models/quotas/quotas.go index b1cc20087..d85686a33 100644 --- a/pkg/models/quotas/quotas.go +++ b/pkg/models/quotas/quotas.go @@ -37,18 +37,33 @@ const ( servicesKey = "count/services" statefulsetsKey = "count/statefulsets.apps" persistentvolumeclaimsKey = "persistentvolumeclaims" - storageClassesKey = "count/storageClass" - namespaceKey = "count/namespace" jobsKey = "count/jobs.batch" cronJobsKey = "count/cronjobs.batch" ) +type NamespacedResourceQuota struct { + Namespace string `json:"namespace,omitempty"` + + Data struct { + v1.ResourceQuotaStatus + + // quota left status, do the math on the side, cause it's + // a lot easier with go-client library + Left v1.ResourceList `json:"left,omitempty"` + } `json:"data,omitempty"` +} + var ( - resourceMap = map[string]string{daemonsetsKey: resources.DaemonSets, deploymentsKey: resources.Deployments, - ingressKey: resources.Ingresses, servicesKey: resources.Services, - statefulsetsKey: resources.StatefulSets, persistentvolumeclaimsKey: resources.PersistentVolumeClaims, podsKey: resources.Pods, - namespaceKey: resources.Namespaces, storageClassesKey: resources.StorageClasses, - jobsKey: resources.Jobs, cronJobsKey: resources.CronJobs} + resourceMap = map[string]string{ + daemonsetsKey: resources.DaemonSets, + deploymentsKey: resources.Deployments, + ingressKey: resources.Ingresses, + servicesKey: resources.Services, + statefulsetsKey: resources.StatefulSets, + persistentvolumeclaimsKey: resources.PersistentVolumeClaims, + podsKey: resources.Pods, + jobsKey: resources.Jobs, + cronJobsKey: resources.CronJobs} ) func getUsage(namespace, resource string) (int, error) { @@ -61,12 +76,14 @@ func getUsage(namespace, resource string) (int, error) { } if err != nil { + glog.Error(err) return 0, err } return result.TotalCount, nil } +// no one use this api anymore, marked as deprecated func GetClusterQuotas() (*models.ResourceQuota, error) { quota := v1.ResourceQuotaStatus{Hard: make(v1.ResourceList), Used: make(v1.ResourceList)} @@ -85,7 +102,7 @@ func GetClusterQuotas() (*models.ResourceQuota, error) { } -func GetNamespaceQuotas(namespace string) (*models.ResourceQuota, error) { +func GetNamespaceQuotas(namespace string) (*NamespacedResourceQuota, error) { quota, err := getNamespaceResourceQuota(namespace) if err != nil { glog.Error(err) @@ -95,23 +112,43 @@ func GetNamespaceQuotas(namespace string) (*models.ResourceQuota, error) { quota = &v1.ResourceQuotaStatus{Hard: make(v1.ResourceList), Used: make(v1.ResourceList)} } - for k, v := range resourceMap { - if _, exist := quota.Used[v1.ResourceName(k)]; !exist { - if k == namespaceKey || k == storageClassesKey { - continue + var resourceQuotaLeft = v1.ResourceList{} + + for key, hardLimit := range quota.Hard { + if used, ok := quota.Used[key]; ok { + left := hardLimit.DeepCopy() + left.Sub(used) + if hardLimit.Cmp(used) < 0 { + left = resource.MustParse("0") } - used, err := getUsage(namespace, v) - if err != nil { - return nil, err - } - var quantity resource.Quantity - quantity.Set(int64(used)) - quota.Used[v1.ResourceName(k)] = quantity + resourceQuotaLeft[key] = left } } - return &models.ResourceQuota{Namespace: namespace, Data: *quota}, nil + // add extra quota usage, cause user may not specify them + for key, val := range resourceMap { + // only add them when they don't exist in quotastatus + if _, ok := quota.Used[v1.ResourceName(key)]; !ok { + used, err := getUsage(namespace, val) + if err != nil { + glog.Error(err) + return nil, err + } + + quota.Used[v1.ResourceName(key)] = *(resource.NewQuantity(int64(used), resource.DecimalSI)) + } + } + + var result = NamespacedResourceQuota{ + Namespace: namespace, + } + result.Data.Hard = quota.Hard + result.Data.Used = quota.Used + result.Data.Left = resourceQuotaLeft + + return &result, nil + } func updateNamespaceQuota(tmpResourceList, resourceList v1.ResourceList) { @@ -127,14 +164,16 @@ func updateNamespaceQuota(tmpResourceList, resourceList v1.ResourceList) { tmpResourceList[res] = usage } } - } func getNamespaceResourceQuota(namespace string) (*v1.ResourceQuotaStatus, error) { resourceQuotaLister := informers.SharedInformerFactory().Core().V1().ResourceQuotas().Lister() quotaList, err := resourceQuotaLister.ResourceQuotas(namespace).List(labels.Everything()) - if err != nil || len(quotaList) == 0 { + if err != nil { + glog.Error(err) return nil, err + } else if len(quotaList) == 0 { + return nil, nil } quotaStatus := v1.ResourceQuotaStatus{Hard: make(v1.ResourceList), Used: make(v1.ResourceList)} From 2259924e17c0eb6ca78dbf5008ce28ad84c9ed36 Mon Sep 17 00:00:00 2001 From: runzexia Date: Mon, 13 May 2019 17:56:39 +0800 Subject: [PATCH 03/10] delete all devops project when delete ws Signed-off-by: runzexia --- .../workspace/workspace_controller.go | 39 ++++++++++ pkg/models/devops/project.go | 5 ++ .../client/kubesphere/kubesphereclient.go | 72 ++++++++++++++++++- 3 files changed, 115 insertions(+), 1 deletion(-) diff --git a/pkg/controller/workspace/workspace_controller.go b/pkg/controller/workspace/workspace_controller.go index 72d3a5ee0..b1f6dff19 100644 --- a/pkg/controller/workspace/workspace_controller.go +++ b/pkg/controller/workspace/workspace_controller.go @@ -43,6 +43,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" "sigs.k8s.io/controller-runtime/pkg/source" + "sync" ) const ( @@ -137,6 +138,10 @@ func (r *ReconcileWorkspace) Reconcile(request reconcile.Request) (reconcile.Res return reconcile.Result{}, err } + if err := r.deleteDevOpsProjects(instance); err != nil { + return reconcile.Result{}, err + } + // remove our finalizer from the list and update it. instance.ObjectMeta.Finalizers = sliceutil.RemoveString(instance.ObjectMeta.Finalizers, func(item string) bool { return item == finalizer @@ -327,6 +332,40 @@ func (r *ReconcileWorkspace) deleteGroup(instance *tenantv1alpha1.Workspace) err return nil } +func (r *ReconcileWorkspace) deleteDevOpsProjects(instance *tenantv1alpha1.Workspace) error { + var wg sync.WaitGroup + + log.Info("Delete DevOps Projects") + for { + errChan := make(chan error, 10) + projects, err := r.ksclient.ListWorkspaceDevOpsProjects(instance.Name) + if err != nil { + log.Error(err, "Failed to Get Workspace's DevOps Projects", "ws", instance.Name) + return err + } + if projects.TotalCount == 0 { + return nil + } + for _, project := range projects.Items { + wg.Add(1) + go func(workspace, devops string) { + err := r.ksclient.DeleteWorkspaceDevOpsProjects(workspace, devops) + errChan <- err + wg.Done() + }(instance.Name, project.ProjectId) + } + wg.Wait() + close(errChan) + for err := range errChan { + if err != nil { + log.Error(err, "delete devops project error") + return err + } + } + + } +} + func (r *ReconcileWorkspace) createWorkspaceRoleBindings(instance *tenantv1alpha1.Workspace) error { adminRoleBinding := &rbac.ClusterRoleBinding{} diff --git a/pkg/models/devops/project.go b/pkg/models/devops/project.go index e62271499..37111f3e5 100644 --- a/pkg/models/devops/project.go +++ b/pkg/models/devops/project.go @@ -31,6 +31,11 @@ const ( DevOpsProjectCreateTimeColumn = "project.create_time" ) +type PageableDevOpsProject struct { + Items []*DevOpsProject `json:"items"` + TotalCount int `json:"total_count"` +} + type DevOpsProject struct { ProjectId string `json:"project_id" db:"project_id"` Name string `json:"name"` diff --git a/pkg/simple/client/kubesphere/kubesphereclient.go b/pkg/simple/client/kubesphere/kubesphereclient.go index f7040e2da..f5880525a 100644 --- a/pkg/simple/client/kubesphere/kubesphereclient.go +++ b/pkg/simple/client/kubesphere/kubesphereclient.go @@ -23,7 +23,9 @@ import ( "flag" "fmt" "io/ioutil" + "kubesphere.io/kubesphere/pkg/constants" "kubesphere.io/kubesphere/pkg/models" + "kubesphere.io/kubesphere/pkg/models/devops" "log" "net/http" "strings" @@ -32,7 +34,7 @@ import ( var ( accountAPIServer string - devopsAPIServer string + ksAPIServer string once sync.Once c client ) @@ -43,6 +45,8 @@ type Interface interface { DescribeGroup(name string) (*models.Group, error) DeleteGroup(name string) error ListUsers() (*models.PageableResponse, error) + ListWorkspaceDevOpsProjects(workspace string) (*devops.PageableDevOpsProject, error) + DeleteWorkspaceDevOpsProjects(workspace, devops string) error } type client struct { @@ -51,6 +55,7 @@ type client struct { func init() { flag.StringVar(&accountAPIServer, "ks-account-api-server", "http://ks-account.kubesphere-system.svc", "kubesphere account api server") + flag.StringVar(&ksAPIServer, "ks-api-server", "http://ks-apiserver.kubesphere-system.svc", "kubesphere api server") } func Client() Interface { @@ -248,6 +253,71 @@ func (c client) ListUsers() (*models.PageableResponse, error) { return &result, nil } +func (c client) ListWorkspaceDevOpsProjects(workspace string) (*devops.PageableDevOpsProject, error) { + req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/kapis/tenant.kubesphere.io/v1alpha2/workspaces/%s/devops", ksAPIServer, workspace), nil) + + if err != nil { + return nil, err + } + req.Header.Add(constants.UserNameHeader, constants.AdminUserName) + if err != nil { + return nil, err + } + log.Println(req.Method, req.URL) + resp, err := c.client.Do(req) + + if err != nil { + return nil, err + } + defer resp.Body.Close() + data, err := ioutil.ReadAll(resp.Body) + + if err != nil { + return nil, err + } + if resp.StatusCode > http.StatusOK { + return nil, Error{resp.StatusCode, string(data)} + } + + var result devops.PageableDevOpsProject + err = json.Unmarshal(data, &result) + + if err != nil { + return nil, err + } + return &result, nil + +} + +func (c client) DeleteWorkspaceDevOpsProjects(workspace, devops string) error { + req, err := http.NewRequest(http.MethodDelete, fmt.Sprintf("%s/kapis/tenant.kubesphere.io/v1alpha2/workspaces/%s/devops/%s", ksAPIServer, workspace, devops), nil) + + if err != nil { + return err + } + req.Header.Add(constants.UserNameHeader, constants.AdminUserName) + if err != nil { + return err + } + log.Println(req.Method, req.URL) + resp, err := c.client.Do(req) + + if err != nil { + return err + } + defer resp.Body.Close() + data, err := ioutil.ReadAll(resp.Body) + + if err != nil { + return err + } + if resp.StatusCode > http.StatusOK { + return Error{resp.StatusCode, string(data)} + } + + return nil +} + func IsNotFound(err error) bool { if e, ok := err.(Error); ok { if e.status == http.StatusNotFound { From dae04e2ad34ac4869f08d2902103f9a67c8ba307 Mon Sep 17 00:00:00 2001 From: runzexia Date: Wed, 15 May 2019 17:09:07 +0800 Subject: [PATCH 04/10] update Signed-off-by: runzexia --- .../client/kubesphere/kubesphereclient.go | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/pkg/simple/client/kubesphere/kubesphereclient.go b/pkg/simple/client/kubesphere/kubesphereclient.go index f5880525a..e5e6c9867 100644 --- a/pkg/simple/client/kubesphere/kubesphereclient.go +++ b/pkg/simple/client/kubesphere/kubesphereclient.go @@ -22,6 +22,7 @@ import ( "encoding/json" "flag" "fmt" + "github.com/golang/glog" "io/ioutil" "kubesphere.io/kubesphere/pkg/constants" "kubesphere.io/kubesphere/pkg/models" @@ -257,25 +258,28 @@ func (c client) ListWorkspaceDevOpsProjects(workspace string) (*devops.PageableD req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/kapis/tenant.kubesphere.io/v1alpha2/workspaces/%s/devops", ksAPIServer, workspace), nil) if err != nil { + glog.Error(err) return nil, err } + req.Header.Add(constants.UserNameHeader, constants.AdminUserName) - if err != nil { - return nil, err - } - log.Println(req.Method, req.URL) + + glog.Info(req.Method, req.URL) resp, err := c.client.Do(req) if err != nil { + glog.Error(err) return nil, err } defer resp.Body.Close() data, err := ioutil.ReadAll(resp.Body) if err != nil { + glog.Error(err) return nil, err } if resp.StatusCode > http.StatusOK { + glog.Error(req.Method, req.URL, resp.StatusCode, string(data)) return nil, Error{resp.StatusCode, string(data)} } @@ -283,6 +287,7 @@ func (c client) ListWorkspaceDevOpsProjects(workspace string) (*devops.PageableD err = json.Unmarshal(data, &result) if err != nil { + glog.Error(err) return nil, err } return &result, nil @@ -293,25 +298,27 @@ func (c client) DeleteWorkspaceDevOpsProjects(workspace, devops string) error { req, err := http.NewRequest(http.MethodDelete, fmt.Sprintf("%s/kapis/tenant.kubesphere.io/v1alpha2/workspaces/%s/devops/%s", ksAPIServer, workspace, devops), nil) if err != nil { + glog.Error(err) return err } req.Header.Add(constants.UserNameHeader, constants.AdminUserName) - if err != nil { - return err - } - log.Println(req.Method, req.URL) + + glog.Info(req.Method, req.URL) resp, err := c.client.Do(req) if err != nil { + glog.Error(err) return err } defer resp.Body.Close() data, err := ioutil.ReadAll(resp.Body) if err != nil { + glog.Error(err) return err } if resp.StatusCode > http.StatusOK { + glog.Error(req.Method, req.URL, resp.StatusCode, string(data)) return Error{resp.StatusCode, string(data)} } From 2b427b8e685222994b25598f2892936b0535ce94 Mon Sep 17 00:00:00 2001 From: soulseen Date: Wed, 15 May 2019 20:49:10 +0800 Subject: [PATCH 05/10] update jenkins api doc Signed-off-by: soulseen --- pkg/apis/devops/v1alpha2/register.go | 322 +++++++++++++-------------- 1 file changed, 161 insertions(+), 161 deletions(-) diff --git a/pkg/apis/devops/v1alpha2/register.go b/pkg/apis/devops/v1alpha2/register.go index 3d00249e7..e9db0ce7c 100644 --- a/pkg/apis/devops/v1alpha2/register.go +++ b/pkg/apis/devops/v1alpha2/register.go @@ -134,7 +134,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.UpdateDevOpsProjectPipelineHandler). Doc("update devops project pipeline"). Param(webservice.PathParameter("devops", "devops project's Id")). - Param(webservice.PathParameter("pipelines", "pipeline name")). + Param(webservice.PathParameter("pipelines", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Metadata(restfulspec.KeyOpenAPITags, tags). Returns(http.StatusOK, RespOK, devops.ProjectPipeline{}). Writes(devops.ProjectPipeline{}). @@ -145,7 +145,7 @@ func addWebService(c *restful.Container) error { Doc("get devops project pipeline config"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). - Param(webservice.PathParameter("pipelines", "pipeline name")). + Param(webservice.PathParameter("pipelines", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Returns(http.StatusOK, RespOK, devops.ProjectPipeline{}). Writes(devops.ProjectPipeline{})) @@ -154,7 +154,7 @@ func addWebService(c *restful.Container) error { Doc("get devops project pipeline sonarStatus"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). - Param(webservice.PathParameter("pipelines", "pipeline name")). + Param(webservice.PathParameter("pipelines", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Returns(http.StatusOK, RespOK, []devops.SonarStatus{}). Writes([]devops.SonarStatus{})) @@ -163,7 +163,7 @@ func addWebService(c *restful.Container) error { Doc("get devops project pipeline sonarStatus"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). - Param(webservice.PathParameter("pipelines", "pipeline name")). + Param(webservice.PathParameter("pipelines", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branches", "branch name")). Returns(http.StatusOK, RespOK, []devops.SonarStatus{}). Writes([]devops.SonarStatus{})) @@ -173,7 +173,7 @@ func addWebService(c *restful.Container) error { Doc("delete devops project pipeline"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). - Param(webservice.PathParameter("pipelines", "pipeline name"))) + Param(webservice.PathParameter("pipelines", "the name of pipeline, which helps to deliver continuous integration continuous deployment."))) webservice.Route(webservice.POST("/devops/{devops}/credentials"). To(devopsapi.CreateDevOpsProjectCredentialHandler). @@ -223,8 +223,8 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetPipeline). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get DevOps Pipelines."). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("projectName", "devops project name")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). Returns(http.StatusOK, RespOK, devops.Pipeline{}). Writes(devops.Pipeline{})) @@ -233,16 +233,16 @@ func addWebService(c *restful.Container) error { To(devopsapi.SearchPipelines). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Search DevOps resource."). - Param(webservice.QueryParameter("q", "query pipelines"). + Param(webservice.QueryParameter("q", "query pipelines, condition for filtering."). Required(false). DataFormat("q=%s")). - Param(webservice.QueryParameter("filter", "filter resource"). + Param(webservice.QueryParameter("filter", "Condition for filteringfilter folders or not.."). Required(false). DataFormat("filter=%s")). - Param(webservice.QueryParameter("start", "start page"). + Param(webservice.QueryParameter("start", "the count of item start."). Required(false). DataFormat("start=%d")). - Param(webservice.QueryParameter("limit", "limit count"). + Param(webservice.QueryParameter("limit", "the count of item limit."). Required(false). DataFormat("limit=%d")). Returns(http.StatusOK, RespOK, []devops.Pipeline{}). @@ -253,15 +253,15 @@ func addWebService(c *restful.Container) error { To(devopsapi.SearchPipelineRuns). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Search DevOps Pipelines runs in branch."). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.QueryParameter("start", "start page"). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.QueryParameter("start", "the count of item start."). Required(false). DataFormat("start=%d")). - Param(webservice.QueryParameter("limit", "limit count"). + Param(webservice.QueryParameter("limit", "the count of item limit."). Required(false). DataFormat("limit=%d")). - Param(webservice.QueryParameter("branch", "branch "). + Param(webservice.QueryParameter("branch", "the name of branch, same as repository brnach, will be filter by branch."). Required(false). DataFormat("branch=%s")). Returns(http.StatusOK, RespOK, []devops.BranchPipelineRun{}). @@ -272,11 +272,11 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetBranchPipelineRun). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get DevOps Pipelines run in branch."). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.QueryParameter("start", "start"). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.QueryParameter("start", "the count of item start."). Required(false). DataFormat("start=%d")). Returns(http.StatusOK, RespOK, devops.BranchPipelineRun{}). @@ -287,11 +287,11 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetPipelineRunNodesbyBranch). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get node on DevOps Pipelines run."). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.QueryParameter("limit", "limit"). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.QueryParameter("limit", "the count of item limit."). Required(false). DataFormat("limit=%d"). DefaultValue("limit=10000")). @@ -304,13 +304,13 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get pipelines step log."). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.PathParameter("nodeId", "pipeline runs node id")). - Param(webservice.PathParameter("stepId", "pipeline runs step id")). - Param(webservice.QueryParameter("start", "start"). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.PathParameter("nodeId", "pipeline node id, the one node in pipeline.")). + Param(webservice.PathParameter("stepId", "pipeline step id, the one step in pipeline.")). + Param(webservice.QueryParameter("start", "the count of item start."). Required(true). DataFormat("start=%d"). DefaultValue("start=0"))) @@ -321,12 +321,12 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get pipelines step log."). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.PathParameter("nodeId", "pipeline runs node id")). - Param(webservice.PathParameter("stepId", "pipeline runs step id")). - Param(webservice.QueryParameter("start", "start"). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.PathParameter("nodeId", "pipeline node id, the one node in pipeline.")). + Param(webservice.PathParameter("stepId", "pipeline step id, the one step in pipeline.")). + Param(webservice.QueryParameter("start", "the count of item start."). Required(true). DataFormat("start=%d"). DefaultValue("start=0"))) @@ -336,7 +336,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.Validate). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Validate Github personal access token."). - Param(webservice.PathParameter("scmId", "SCM id")). + Param(webservice.PathParameter("scmId", "the id of SCM.")). Returns(http.StatusOK, RespOK, devops.Validates{}). Writes(devops.Validates{})) @@ -345,8 +345,8 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetSCMOrg). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("List organizations of SCM"). - Param(webservice.PathParameter("scmId", "SCM id")). - Param(webservice.QueryParameter("credentialId", "credential id for SCM"). + Param(webservice.PathParameter("scmId", "the id of SCM.")). + Param(webservice.QueryParameter("credentialId", "credential id for SCM."). Required(true). DataFormat("credentialId=%s")). Returns(http.StatusOK, RespOK, []devops.SCMOrg{}). @@ -358,14 +358,14 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get SCM repositories in an organization"). Param(webservice.PathParameter("scmId", "SCM id")). - Param(webservice.PathParameter("organizationId", "organization Id, such as github username")). - Param(webservice.QueryParameter("credentialId", "credential id for SCM"). + Param(webservice.PathParameter("organizationId", "organization Id, such as github username.")). + Param(webservice.QueryParameter("credentialId", "credential id for SCM."). Required(true). DataFormat("credentialId=%s")). - Param(webservice.QueryParameter("pageNumber", "page number"). + Param(webservice.QueryParameter("pageNumber", "the number of page."). Required(true). DataFormat("pageNumber=%d")). - Param(webservice.QueryParameter("pageSize", "page size"). + Param(webservice.QueryParameter("pageSize", "the size of page."). Required(true). DataFormat("pageSize=%d")). Returns(http.StatusOK, RespOK, []devops.OrgRepo{}). @@ -376,15 +376,15 @@ func addWebService(c *restful.Container) error { To(devopsapi.StopBranchPipeline). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Stop pipeline in running"). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.QueryParameter("blocking", "stop and between each retries will sleep"). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.QueryParameter("blocking", "stop and between each retries will sleep."). Required(false). DataFormat("blocking=%t"). DefaultValue("blocking=false")). - Param(webservice.QueryParameter("timeOutInSecs", "the time of stop and between each retries sleep"). + Param(webservice.QueryParameter("timeOutInSecs", "the time of stop and between each retries sleep."). Required(false). DataFormat("timeOutInSecs=%d"). DefaultValue("timeOutInSecs=10")). @@ -396,14 +396,14 @@ func addWebService(c *restful.Container) error { To(devopsapi.StopPipeline). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Stop pipeline in running"). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.QueryParameter("blocking", "stop and between each retries will sleep"). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.QueryParameter("blocking", "stop and between each retries will sleep."). Required(false). DataFormat("blocking=%t"). DefaultValue("blocking=false")). - Param(webservice.QueryParameter("timeOutInSecs", "the time of stop and between each retries sleep"). + Param(webservice.QueryParameter("timeOutInSecs", "the time of stop and between each retries sleep."). Required(false). DataFormat("timeOutInSecs=%d"). DefaultValue("timeOutInSecs=10")). @@ -415,10 +415,10 @@ func addWebService(c *restful.Container) error { To(devopsapi.ReplayBranchPipeline). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Replay pipeline"). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). Returns(http.StatusOK, RespOK, devops.ReplayPipe{}). Writes(devops.ReplayPipe{})) @@ -427,9 +427,9 @@ func addWebService(c *restful.Container) error { To(devopsapi.ReplayPipeline). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Replay pipeline"). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). Returns(http.StatusOK, RespOK, devops.ReplayPipe{}). Writes(devops.ReplayPipe{})) @@ -439,11 +439,11 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get Pipelines run log."). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.QueryParameter("start", "start"). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.QueryParameter("start", "the count of item start."). Required(true). DataFormat("start=%d"). DefaultValue("start=0"))) @@ -454,10 +454,10 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get Pipelines run log."). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.QueryParameter("start", "start"). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.QueryParameter("start", "the count of item start."). Required(true). DataFormat("start=%d"). DefaultValue("start=0"))) @@ -467,14 +467,14 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetBranchArtifacts). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get pipeline artifacts."). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.QueryParameter("start", "start page"). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.QueryParameter("start", "the count of item start."). Required(false). DataFormat("start=%d")). - Param(webservice.QueryParameter("limit", "limit count"). + Param(webservice.QueryParameter("limit", "the count of item limit."). Required(false). DataFormat("limit=%d")). Returns(http.StatusOK, "The filed of \"Url\" in response can download artifacts", []devops.Artifacts{}). @@ -485,13 +485,13 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetArtifacts). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get pipeline artifacts."). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.QueryParameter("start", "start page"). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.QueryParameter("start", "the count of item start."). Required(false). DataFormat("start=%d")). - Param(webservice.QueryParameter("limit", "limit count"). + Param(webservice.QueryParameter("limit", "the count of item limit."). Required(false). DataFormat("limit=%d")). Returns(http.StatusOK, "The filed of \"Url\" in response can download artifacts", []devops.Artifacts{}). @@ -502,15 +502,15 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetPipeBranch). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get pipeline of branch."). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.QueryParameter("filter", "filter remote"). Required(true). DataFormat("filter=%s")). - Param(webservice.QueryParameter("start", "start"). + Param(webservice.QueryParameter("start", "the count of item start."). Required(true). DataFormat("start=%d")). - Param(webservice.QueryParameter("limit", "limit count"). + Param(webservice.QueryParameter("limit", "the count of item limit."). Required(true). DataFormat("limit=%d")). Returns(http.StatusOK, RespOK, []devops.PipeBranch{}). @@ -523,12 +523,12 @@ func addWebService(c *restful.Container) error { Doc("Pauses pipeline execution and allows the user to interact and control the flow of the build."). Reads(devops.CheckPlayload{}). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.PathParameter("nodeId", "pipeline node id")). - Param(webservice.PathParameter("stepId", "pipeline step id"))) + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.PathParameter("nodeId", "pipeline node id, the one node in pipeline.")). + Param(webservice.PathParameter("stepId", "pipeline step id, the one step in pipeline."))) // match /blue/rest/organizations/jenkins/pipelines/{projectName}/pipelines/{pipelineName}/runs/{runId}/nodes/{nodeId}/steps/{stepId} webservice.Route(webservice.POST("/devops/{projectName}/pipelines/{pipelineName}/runs/{runId}/nodes/{nodeId}/steps/{stepId}"). @@ -537,10 +537,10 @@ func addWebService(c *restful.Container) error { Doc("Pauses pipeline execution and allows the user to interact and control the flow of the build."). Reads(devops.CheckPlayload{}). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.PathParameter("nodeId", "pipeline node id")). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.PathParameter("nodeId", "pipeline node id, the one node in pipeline.")). Param(webservice.PathParameter("stepId", "pipeline step id"))) // match /job/project-8QnvykoJw4wZ/job/test-1/indexing/consoleText @@ -549,8 +549,8 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get index console log."). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name"))) + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment."))) // match /job/{projectName}/job/{pipelineName}/build?delay=0 webservice.Route(webservice.POST("/devops/{projectName}/pipelines/{pipelineName}/scan"). @@ -558,10 +558,10 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Start a build."). Produces("text/html; charset=utf-8"). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.QueryParameter("delay", "delay time"). - Required(true). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.QueryParameter("delay", "will be delay time to scan."). + Required(false). DataFormat("delay=%d"))) // match /blue/rest/organizations/jenkins/pipelines/{projectName}/{pipelineName}/branches/{}/runs/ @@ -570,9 +570,9 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Run pipeline."). Reads(devops.RunPayload{}). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Returns(http.StatusOK, RespOK, devops.QueuedBlueRun{}). Writes(devops.QueuedBlueRun{})) @@ -582,8 +582,8 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Run pipeline."). Reads(devops.RunPayload{}). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Returns(http.StatusOK, RespOK, devops.QueuedBlueRun{}). Writes(devops.QueuedBlueRun{})) @@ -592,12 +592,12 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetBranchStepsStatus). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get pipeline steps status."). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). - Param(webservice.PathParameter("runId", "pipeline run name")). - Param(webservice.PathParameter("nodeId", "pipeline node id")). - Param(webservice.QueryParameter("limit", "limit count"). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.PathParameter("nodeId", "pipeline node id, the one node in pipeline.")). + Param(webservice.QueryParameter("limit", "the count of item limit."). Required(true). DataFormat("limit=%d")). Returns(http.StatusOK, RespOK, []devops.QueuedBlueRun{}). @@ -608,11 +608,11 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetStepsStatus). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get pipeline steps status."). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("runId", "pipeline run name")). - Param(webservice.PathParameter("nodeId", "pipeline node id")). - Param(webservice.QueryParameter("limit", "limit count"). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.PathParameter("nodeId", "pipeline node id, the one node in pipeline.")). + Param(webservice.QueryParameter("limit", "the count of item limit."). Required(true). DataFormat("limit=%d")). Returns(http.StatusOK, RespOK, []devops.QueuedBlueRun{}). @@ -622,7 +622,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/crumbissuer"). To(devopsapi.GetCrumb). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get crumb"). + Doc("Get crumb issuer."). Returns(http.StatusOK, RespOK, devops.Crumb{}). Writes(devops.Crumb{})) @@ -643,7 +643,7 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Produces("application/json", "charset=utf-8"). Doc("Check cron script compile."). - Param(webservice.QueryParameter("value", "cpec value"). + Param(webservice.QueryParameter("value", "string of cron script."). Required(true). DataFormat("value=%s")). Returns(http.StatusOK, RespOK, []devops.QueuedBlueRun{}). @@ -655,9 +655,9 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetPipelineRun). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get run pipeline in project."). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("runId", "pipeline run id")). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). Returns(http.StatusOK, RespOK, devops.PipelineRun{}). Writes(devops.PipelineRun{})) @@ -665,10 +665,10 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}/branches/{branchName}"). To(devopsapi.GetBranchPipeline). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get Pipeline run in branch."). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). + Doc("Get Pipeline run by branch."). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach")). Returns(http.StatusOK, RespOK, devops.BranchPipeline{}). Writes(devops.BranchPipeline{})) @@ -677,10 +677,10 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetPipelineRunNodes). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get Pipeline run nodes."). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("runId", "pipeline run id")). - Param(webservice.QueryParameter("limit", "limit count"). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build")). + Param(webservice.QueryParameter("limit", "the count of item limit"). Required(false). DataFormat("limit=%d")). Returns(http.StatusOK, RespOK, []devops.PipelineRunNodes{}). @@ -690,13 +690,13 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}/branches/{branchName}/runs/{runId}/nodes/{nodeId}/steps"). To(devopsapi.GetBranchNodeSteps). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get steps in node."). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). - Param(webservice.PathParameter("runId", "pipeline run id")). - Param(webservice.PathParameter("nodeId", "pipeline node id")). - Param(webservice.QueryParameter("limit", "limit count"). + Doc("Get steps in node by branch."). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.PathParameter("nodeId", "pipeline node id, the one node in pipeline.")). + Param(webservice.QueryParameter("limit", "the count of item limit."). Required(false). DataFormat("limit=%d")). Returns(http.StatusOK, RespOK, []devops.NodeSteps{}). @@ -707,11 +707,11 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetNodeSteps). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get steps in node."). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("runId", "pipeline run id")). - Param(webservice.PathParameter("nodeId", "pipeline node id")). - Param(webservice.QueryParameter("limit", "limit count"). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build")). + Param(webservice.PathParameter("nodeId", "pipeline node id, the one node in pipeline.")). + Param(webservice.QueryParameter("limit", "the count of item limit."). Required(false). DataFormat("limit=%d")). Returns(http.StatusOK, RespOK, []devops.NodeSteps{}). @@ -723,7 +723,7 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Consumes("application/x-www-form-urlencoded"). Produces("application/json", "charset=utf-8"). - Doc("Json to Jenkinsfile."). + Doc("Convert json to jenkinsfile format."). Reads(devops.ReqJson{}). Returns(http.StatusOK, RespOK, devops.NodeSteps{}). Writes(devops.ResJenkinsfile{})) @@ -734,7 +734,7 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Consumes("application/x-www-form-urlencoded"). Produces("application/json", "charset=utf-8"). - Doc("Jenkinsfile to Json."). + Doc("Convert jenkinsfile to json format."). Reads(devops.ReqJenkinsfile{}). Returns(http.StatusOK, RespOK, devops.ResJson{}). Writes(devops.ResJson{})) @@ -743,7 +743,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/notifycommit"). To(devopsapi.GetNotifyCommit). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get Notify Commit by GET HTTP method."). + Doc("Get notify commit by GET HTTP method."). Produces("text/plain; charset=utf-8"). Param(webservice.QueryParameter("url", "the url for webhook to push."). Required(true). @@ -753,7 +753,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.POST("/devops/notifycommit"). To(devopsapi.GetNotifyCommit). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get Notify Commit by POST HTTP method."). + Doc("Get notify commit by POST HTTP method."). Consumes("application/json"). Produces("text/plain; charset=utf-8"). Param(webservice.QueryParameter("url", "the url for webhook to push."). @@ -769,12 +769,12 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}/branches/{branchName}/runs/{runId}/nodesdetail"). To(devopsapi.GetBranchNodesDetail). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get pipeline nodes stages detail"). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.QueryParameter("limit", "limit count"). + Doc("Gives steps details inside a pipeline node by branch. For a Stage, the steps will include all the steps defined inside the stage."). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.QueryParameter("limit", "the count of item limit."). Required(true). DataFormat("limit=%d")). Returns(http.StatusOK, RespOK, []devops.NodesDetail{}). @@ -784,12 +784,12 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}/runs/{runId}/nodesdetail"). To(devopsapi.GetNodesDetail). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get pipeline nodes stages detail"). - Param(webservice.PathParameter("pipelineName", "pipeline name")). - Param(webservice.PathParameter("projectName", "devops project name")). - Param(webservice.PathParameter("branchName", "pipeline branch name")). - Param(webservice.PathParameter("runId", "pipeline runs id")). - Param(webservice.QueryParameter("limit", "limit count"). + Doc("Gives steps details inside a pipeline node. For a Stage, the steps will include all the steps defined inside the stage."). + Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). + Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). + Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). + Param(webservice.QueryParameter("limit", "the count of item limit."). Required(true). DataFormat("limit=%d")). Returns(http.StatusOK, RespOK, []devops.NodesDetail{}). From fd530f4c1ecc4a81946c35419132a56a95b58f08 Mon Sep 17 00:00:00 2001 From: runzexia Date: Wed, 5 Jun 2019 14:09:39 +0800 Subject: [PATCH 06/10] tmp commit Signed-off-by: runzexia --- pkg/apis/devops/v1alpha2/register.go | 4 +- pkg/models/devops/common.go | 4 +- pkg/models/devops/membership.go | 10 +-- pkg/models/devops/project.go | 26 ++++-- pkg/models/devops/project_credential.go | 8 +- pkg/models/devops/project_pipeline.go | 110 ++++++++++++------------ 6 files changed, 85 insertions(+), 77 deletions(-) diff --git a/pkg/apis/devops/v1alpha2/register.go b/pkg/apis/devops/v1alpha2/register.go index 3d00249e7..b1ae75ac7 100644 --- a/pkg/apis/devops/v1alpha2/register.go +++ b/pkg/apis/devops/v1alpha2/register.go @@ -58,7 +58,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.PATCH("/devops/{devops}"). To(devopsapi.UpdateProjectHandler). - Doc("get devops project"). + Doc("update devops project"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Returns(http.StatusOK, RespOK, devops.DevOpsProject{}). @@ -66,7 +66,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{devops}/defaultroles"). To(devopsapi.GetDevOpsProjectDefaultRoles). - Doc("get devops project defaultroles"). + Doc("get devops project default roles"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Returns(http.StatusOK, RespOK, []devops.Role{}). diff --git a/pkg/models/devops/common.go b/pkg/models/devops/common.go index 2419945e3..f2c51ed07 100644 --- a/pkg/models/devops/common.go +++ b/pkg/models/devops/common.go @@ -79,8 +79,8 @@ const ( ) type Role struct { - Name string `json:"name"` - Description string `json:"description"` + Name string `json:"name" description:"role's name'"` + Description string `json:"description" description:"role 's description'"` } var DefaultRoles = []*Role{ diff --git a/pkg/models/devops/membership.go b/pkg/models/devops/membership.go index cbce69e31..8f48a92d7 100644 --- a/pkg/models/devops/membership.go +++ b/pkg/models/devops/membership.go @@ -21,11 +21,11 @@ const ( ) type DevOpsProjectMembership struct { - Username string `json:"username"` - ProjectId string `json:"project_id" db:"project_id"` - Role string `json:"role"` - Status string `json:"status"` - GrantBy string `json:"grand_by,omitempty"` + Username string `json:"username" description:"member's username,username can uniquely identify a user"` + ProjectId string `json:"project_id" db:"project_id" description:"the devops projects which project membership belongs to"` + Role string `json:"role" description:"devops project membership's role type'"` + Status string `json:"status" description:"Desperated, status of project membership"` + GrantBy string `json:"grand_by,omitempty" description:"Username of the user who assigned the role"` } var DevOpsProjectMembershipColumns = GetColumnsFromStruct(&DevOpsProjectMembership{}) diff --git a/pkg/models/devops/project.go b/pkg/models/devops/project.go index 37111f3e5..222b2f01b 100644 --- a/pkg/models/devops/project.go +++ b/pkg/models/devops/project.go @@ -37,15 +37,23 @@ type PageableDevOpsProject struct { } type DevOpsProject struct { - ProjectId string `json:"project_id" db:"project_id"` - Name string `json:"name"` - Description string `json:"description,omitempty"` - Creator string `json:"creator"` - CreateTime time.Time `json:"create_time"` - Status string `json:"status"` - Visibility string `json:"visibility,omitempty"` - Extra string `json:"extra,omitempty"` - Workspace string `json:"workspace"` + 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:"DevOps Projects's Name'"` + + Description string `json:"description,omitempty" description:"DevOps Projets's Description, used to describe the DevOps Project'"` + + Creator string `json:"creator" description:"Creator's username'"` + + 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 { diff --git a/pkg/models/devops/project_credential.go b/pkg/models/devops/project_credential.go index dd08a4dab..7b6b49f65 100644 --- a/pkg/models/devops/project_credential.go +++ b/pkg/models/devops/project_credential.go @@ -26,9 +26,9 @@ const ( ) type JenkinsCredential struct { - Id string `json:"id"` - Type string `json:"type"` - DisplayName string `json:"display_name,omitempty"` + Id string `json:"id" description:"id of credential"` + Type string `json:"type" description:"type of credential,such as ssh/kubeconfig"` + DisplayName string `json:"display_name,omitempty" description:"credential's display name'"` Fingerprint *struct { FileName string `json:"file_name,omitempty"` Hash string `json:"hash,omitempty"` @@ -41,7 +41,7 @@ type JenkinsCredential struct { } `json:"ranges,omitempty"` } `json:"ranges,omitempty"` } `json:"usage,omitempty"` - } `json:"fingerprint,omitempty"` + } `json:"fingerprint,omitempty" description:""` Description string `json:"description,omitempty"` Domain string `json:"domain,omitempty"` CreateTime *time.Time `json:"create_time,omitempty"` diff --git a/pkg/models/devops/project_pipeline.go b/pkg/models/devops/project_pipeline.go index 08ea84596..ad876ebac 100644 --- a/pkg/models/devops/project_pipeline.go +++ b/pkg/models/devops/project_pipeline.go @@ -53,99 +53,99 @@ type SonarStatus struct { } type ProjectPipeline struct { - Type string `json:"type"` - Pipeline *NoScmPipeline `json:"pipeline,omitempty"` - MultiBranchPipeline *MultiBranchPipeline `json:"multi_branch_pipeline,omitempty"` + Type string `json:"type" description:"type of devops pipeline, in scm or no scm"` + Pipeline *NoScmPipeline `json:"pipeline,omitempty" description:"no scm pipeline structs"` + MultiBranchPipeline *MultiBranchPipeline `json:"multi_branch_pipeline,omitempty" description:"in scm pipeline structs"` } type NoScmPipeline struct { - Name string `json:"name"` - Description string `json:"descriptio,omitempty"` - Discarder *DiscarderProperty `json:"discarder,omitempty"` - Parameters []*Parameter `json:"parameters,omitempty"` - DisableConcurrent bool `json:"disable_concurrent,omitempty" mapstructure:"disable_concurrent"` - TimerTrigger *TimerTrigger `json:"timer_trigger,omitempty" mapstructure:"timer_trigger"` - RemoteTrigger *RemoteTrigger `json:"remote_trigger,omitempty" mapstructure:"remote_trigger"` - Jenkinsfile string `json:"jenkinsfile,omitempty"` + Name string `json:"name" description:"name of pipeline"` + Description string `json:"descriptio,omitempty" description:"description of pipeline"` + Discarder *DiscarderProperty `json:"discarder,omitempty" description:"Discarder of pipeline, managing when to drop a pipeline"` + 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" description:"Whether to prohibit the pipeline from running in parallel"` + TimerTrigger *TimerTrigger `json:"timer_trigger,omitempty" mapstructure:"timer_trigger" description:"Timer to trigger pipeline run"` + RemoteTrigger *RemoteTrigger `json:"remote_trigger,omitempty" mapstructure:"remote_trigger" description:"Remote api define to trigger pipeline run"` + Jenkinsfile string `json:"jenkinsfile,omitempty" description:"Jenkinsfile's content'"` } type MultiBranchPipeline struct { - Name string `json:"name"` - Description string `json:"description,omitempty"` - Discarder *DiscarderProperty `json:"discarder,omitempty"` - TimerTrigger *TimerTrigger `json:"timer_trigger,omitempty" mapstructure:"timer_trigger"` - SourceType string `json:"source_type"` - GitSource *GitSource `json:"git_source,omitempty"` - GitHubSource *GithubSource `json:"github_source,omitempty"` - SvnSource *SvnSource `json:"svn_source,omitempty"` - SingleSvnSource *SingleSvnSource `json:"single_svn_source,omitempty"` - ScriptPath string `json:"script_path" mapstructure:"script_path"` + Name string `json:"name" description:"name of pipeline"` + Description string `json:"descriptio,omitempty" description:"description of pipeline"` + Discarder *DiscarderProperty `json:"discarder,omitempty" description:"Discarder of pipeline, managing when to drop a pipeline"` + TimerTrigger *TimerTrigger `json:"timer_trigger,omitempty" mapstructure:"timer_trigger" description:"Timer to trigger pipeline run"` + SourceType string `json:"source_type" description:"type of scm, such as github/git/svn"` + GitSource *GitSource `json:"git_source,omitempty" description:"git scm define"` + GitHubSource *GithubSource `json:"github_source,omitempty" description:"github scm define"` + SvnSource *SvnSource `json:"svn_source,omitempty" description:"multi branch svn scm define"` + SingleSvnSource *SingleSvnSource `json:"single_svn_source,omitempty" description:"single branch svn scm define"` + ScriptPath string `json:"script_path" mapstructure:"script_path" description:"script path in scm"` } type GitSource struct { - Url string `json:"url,omitempty" mapstructure:"url"` - CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id"` - DiscoverBranches bool `json:"discover_branches,omitempty" mapstructure:"discover_branches"` - CloneOption *GitCloneOption `json:"git_clone_option,omitempty" mapstructure:"git_clone_option"` - RegexFilter string `json:"regex_filter,omitempty" mapstructure:"regex_filter"` + Url string `json:"url,omitempty" mapstructure:"url" description:"url of git source"` + 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" description:"Whether to discover a branch"` + 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" description:"Regex used to match the name of the branch that needs to be run"` } type GithubSource struct { - Owner string `json:"owner,omitempty" mapstructure:"owner"` - Repo string `json:"repo,omitempty" mapstructure:"repo"` - CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id"` - ApiUri string `json:"api_uri,omitempty" mapstructure:"api_uri"` - DiscoverBranches int `json:"discover_branches,omitempty" mapstructure:"discover_branches"` - DiscoverPRFromOrigin int `json:"discover_pr_from_origin,omitempty" mapstructure:"discover_pr_from_origin"` - DiscoverPRFromForks *GithubDiscoverPRFromForks `json:"discover_pr_from_forks,omitempty" mapstructure:"discover_pr_from_forks"` - CloneOption *GitCloneOption `json:"git_clone_option,omitempty" mapstructure:"git_clone_option"` - RegexFilter string `json:"regex_filter,omitempty" mapstructure:"regex_filter"` + Owner string `json:"owner,omitempty" mapstructure:"owner" description:"owner of github repo"` + Repo string `json:"repo,omitempty" mapstructure:"repo" description:"repo name of github repo"` + 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" 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" description:"Discover branch configuration"` + 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" description:"Discover fork PR configuration"` + 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" description:"Regex used to match the name of the branch that needs to be run"` } type GitCloneOption struct { - Shallow bool `json:"shallow,omitempty" mapstructure:"shallow"` - Timeout int `json:"timeout,omitempty" mapstructure:"timeout"` - Depth int `json:"depth,omitempty" mapstructure:"depth"` + Shallow bool `json:"shallow,omitempty" mapstructure:"shallow" description:"Whether to use git shallow clone"` + Timeout int `json:"timeout,omitempty" mapstructure:"timeout" description:"git clone timeout mins"` + Depth int `json:"depth,omitempty" mapstructure:"depth" description:"git clone depth"` } type SvnSource struct { - Remote string `json:"remote,omitempty"` - CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id"` - Includes string `json:"includes,omitempty"` - Excludes string `json:"excludes,omitempty"` + Remote string `json:"remote,omitempty" description:"remote address url"` + CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id" description:"credential id to access svn source"` + Includes string `json:"includes,omitempty" description:"branches to run pipeline"` + Excludes string `json:"excludes,omitempty" description:"branches do not run pipeline"` } type SingleSvnSource struct { - Remote string `json:"remote,omitempty"` - CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id"` + Remote string `json:"remote,omitempty" description:"remote address url"` + CredentialId string `json:"credential_id,omitempty" mapstructure:"credential_id" description:"credential id to access svn source"` } type GithubDiscoverPRFromForks struct { - Strategy int `json:"strategy,omitempty" mapstructure:"strategy"` - Trust int `json:"trust,omitempty" mapstructure:"trust"` + Strategy int `json:"strategy,omitempty" mapstructure:"strategy" description:"github discover startegy"` + Trust int `json:"trust,omitempty" mapstructure:"trust" description:"trust user type"` } type DiscarderProperty struct { - DaysToKeep string `json:"days_to_keep,omitempty" mapstructure:"days_to_keep"` - NumToKeep string `json:"num_to_keep,omitempty" mapstructure:"num_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" description:"nums to keep pipeline"` } type Parameter struct { - Name string `json:"name"` - DefaultValue string `json:"default_value,omitempty" mapstructure:"default_value"` - Type string `json:"type"` - Description string `json:"description,omitempty"` + Name string `json:"name" description:"name of param"` + DefaultValue string `json:"default_value,omitempty" mapstructure:"default_value" description:"default value of param"` + Type string `json:"type" description:"type of param"` + Description string `json:"description,omitempty" description:"description of pipeline"` } type TimerTrigger struct { // user in no scm job - Cron string `json:"cron,omitempty"` + Cron string `json:"cron,omitempty" description:"jenkins cron script"` // use in multi-branch job - Interval string `json:"interval,omitempty"` + Interval string `json:"interval,omitempty" description:"interval ms"` } type RemoteTrigger struct { - Token string `json:"token,omitempty"` + Token string `json:"token,omitempty" description:"remote trigger token"` } func replaceXmlVersion(config, oldVersion, targetVersion string) string { From 1b3e80519d9bb144910c92abb4e693790a7ea8e4 Mon Sep 17 00:00:00 2001 From: runzexia Date: Wed, 5 Jun 2019 15:47:38 +0800 Subject: [PATCH 07/10] update docs Signed-off-by: runzexia --- pkg/apis/devops/v1alpha2/register.go | 37 ++++++++------- pkg/apis/tenant/v1alpha2/register.go | 30 +++++++++++- pkg/gojenkins/credential.go | 16 +++---- pkg/models/devops/project_credential.go | 47 +++++++++---------- .../devops/project_credential_handler.go | 16 +++---- 5 files changed, 87 insertions(+), 59 deletions(-) diff --git a/pkg/apis/devops/v1alpha2/register.go b/pkg/apis/devops/v1alpha2/register.go index b1ae75ac7..69637263c 100644 --- a/pkg/apis/devops/v1alpha2/register.go +++ b/pkg/apis/devops/v1alpha2/register.go @@ -50,7 +50,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{devops}"). To(devopsapi.GetDevOpsProjectHandler). - Doc("get devops project"). + Doc("Get devops project"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Returns(http.StatusOK, RespOK, devops.DevOpsProject{}). @@ -58,15 +58,16 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.PATCH("/devops/{devops}"). To(devopsapi.UpdateProjectHandler). - Doc("update devops project"). + Doc("Update devops project"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). + Reads(devops.DevOpsProject{}). Returns(http.StatusOK, RespOK, devops.DevOpsProject{}). Writes(devops.DevOpsProject{})) webservice.Route(webservice.GET("/devops/{devops}/defaultroles"). To(devopsapi.GetDevOpsProjectDefaultRoles). - Doc("get devops project default roles"). + Doc("Get devops project default roles"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Returns(http.StatusOK, RespOK, []devops.Role{}). @@ -74,7 +75,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{devops}/members"). To(devopsapi.GetDevOpsProjectMembersHandler). - Doc("get devops project members"). + Doc("Get devops project members"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Param(webservice.QueryParameter(params.PagingParam, "page"). @@ -89,7 +90,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{devops}/members/{members}"). To(devopsapi.GetDevOpsProjectMemberHandler). - Doc("get devops project member"). + Doc("Get devops project member"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Param(webservice.PathParameter("members", "member's username")). @@ -98,7 +99,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.POST("/devops/{devops}/members"). To(devopsapi.AddDevOpsProjectMemberHandler). - Doc("add devops project members"). + Doc("Add devops project members"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Returns(http.StatusOK, RespOK, devops.DevOpsProjectMembership{}). @@ -106,7 +107,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.PATCH("/devops/{devops}/members/{members}"). To(devopsapi.UpdateDevOpsProjectMemberHandler). - Doc("update devops project members"). + Doc("Update devops project members"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Param(webservice.PathParameter("members", "member's username")). @@ -115,7 +116,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.DELETE("/devops/{devops}/members/{members}"). To(devopsapi.DeleteDevOpsProjectMemberHandler). - Doc("delete devops project members"). + Doc("Delete devops project members"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Param(webservice.PathParameter("members", "member's username")). @@ -123,7 +124,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.POST("/devops/{devops}/pipelines"). To(devopsapi.CreateDevOpsProjectPipelineHandler). - Doc("add devops project pipeline"). + Doc("Add devops project pipeline"). Param(webservice.PathParameter("devops", "devops project's Id")). Metadata(restfulspec.KeyOpenAPITags, tags). Returns(http.StatusOK, RespOK, devops.ProjectPipeline{}). @@ -132,7 +133,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.PUT("/devops/{devops}/pipelines/{pipelines}"). To(devopsapi.UpdateDevOpsProjectPipelineHandler). - Doc("update devops project pipeline"). + Doc("Update devops project pipeline"). Param(webservice.PathParameter("devops", "devops project's Id")). Param(webservice.PathParameter("pipelines", "pipeline name")). Metadata(restfulspec.KeyOpenAPITags, tags). @@ -142,7 +143,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipelines}/config"). To(devopsapi.GetDevOpsProjectPipelineHandler). - Doc("get devops project pipeline config"). + Doc("Get devops project pipeline config"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Param(webservice.PathParameter("pipelines", "pipeline name")). @@ -151,7 +152,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipelines}/sonarStatus"). To(devopsapi.GetPipelineSonarStatusHandler). - Doc("get devops project pipeline sonarStatus"). + Doc("Get devops project pipeline sonarStatus"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Param(webservice.PathParameter("pipelines", "pipeline name")). @@ -160,7 +161,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipelines}/branches/{branches}/sonarStatus"). To(devopsapi.GetMultiBranchesPipelineSonarStatusHandler). - Doc("get devops project pipeline sonarStatus"). + Doc("Get devops project pipeline sonarStatus"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Param(webservice.PathParameter("pipelines", "pipeline name")). @@ -170,21 +171,21 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.DELETE("/devops/{devops}/pipelines/{pipelines}"). To(devopsapi.DeleteDevOpsProjectPipelineHandler). - Doc("delete devops project pipeline"). + Doc("Delete devops project pipeline"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Param(webservice.PathParameter("pipelines", "pipeline name"))) webservice.Route(webservice.POST("/devops/{devops}/credentials"). To(devopsapi.CreateDevOpsProjectCredentialHandler). - Doc("add project credential pipeline"). + Doc("Add project credential pipeline"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Reads(devops.JenkinsCredential{})) webservice.Route(webservice.PUT("/devops/{devops}/credentials/{credentials}"). To(devopsapi.UpdateDevOpsProjectCredentialHandler). - Doc("update project credential pipeline"). + Doc("Update project credential pipeline"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Param(webservice.PathParameter("credentials", "credential's Id")). @@ -199,7 +200,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{devops}/credentials/{credentials}"). To(devopsapi.GetDevOpsProjectCredentialHandler). - Doc("get project credential pipeline"). + Doc("Get project credential pipeline"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Param(webservice.PathParameter("credentials", "credential's Id")). @@ -210,7 +211,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{devops}/credentials"). To(devopsapi.GetDevOpsProjectCredentialsHandler). - Doc("get project credential pipeline"). + Doc("Get project credential pipeline"). Metadata(restfulspec.KeyOpenAPITags, tags). Param(webservice.PathParameter("devops", "devops project's Id")). Param(webservice.PathParameter("credentials", "credential's Id")). diff --git a/pkg/apis/tenant/v1alpha2/register.go b/pkg/apis/tenant/v1alpha2/register.go index 85684aff6..0af2b21c5 100644 --- a/pkg/apis/tenant/v1alpha2/register.go +++ b/pkg/apis/tenant/v1alpha2/register.go @@ -23,9 +23,15 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "kubesphere.io/kubesphere/pkg/apiserver/runtime" "kubesphere.io/kubesphere/pkg/apiserver/tenant" + "kubesphere.io/kubesphere/pkg/models/devops" + "kubesphere.io/kubesphere/pkg/params" + "net/http" ) -const GroupName = "tenant.kubesphere.io" +const ( + GroupName = "tenant.kubesphere.io" + RespOK = "ok" +) var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"} @@ -87,23 +93,45 @@ func addWebService(c *restful.Container) error { ws.Route(ws.GET("/workspaces/{workspace}/devops"). To(tenant.ListDevopsProjects). Param(ws.PathParameter("workspace", "workspace name")). + Param(ws.QueryParameter(params.PagingParam, "page"). + Required(false). + DataFormat("limit=%d,page=%d"). + DefaultValue("limit=10,page=1")). + Param(ws.QueryParameter(params.ConditionsParam, "query conditions"). + Required(false). + DataFormat("key=%s,key~%s")). Doc("List devops projects for the current user"). + Writes([]devops.DevOpsProject{}). + Returns(http.StatusOK, RespOK, []devops.DevOpsProject{}). Metadata(restfulspec.KeyOpenAPITags, tags)) ws.Route(ws.GET("/workspaces/{workspace}/members/{username}/devops"). To(tenant.ListDevopsProjects). Param(ws.PathParameter("workspace", "workspace name")). Param(ws.PathParameter("username", "workspace member's username")). + Param(ws.QueryParameter(params.PagingParam, "page"). + Required(false). + DataFormat("limit=%d,page=%d"). + DefaultValue("limit=10,page=1")). + Param(ws.QueryParameter(params.ConditionsParam, "query conditions"). + Required(false). + DataFormat("key=%s,key~%s")). Doc("List the devops projects for the workspace member"). + Writes([]devops.DevOpsProject{}). + Returns(http.StatusOK, RespOK, []devops.DevOpsProject{}). Metadata(restfulspec.KeyOpenAPITags, tags)) ws.Route(ws.POST("/workspaces/{workspace}/devops"). To(tenant.CreateDevopsProject). Param(ws.PathParameter("workspace", "workspace name")). Doc("Create devops project"). + Reads(devops.DevOpsProject{}). + Returns(http.StatusOK, RespOK, devops.DevOpsProject{}). Metadata(restfulspec.KeyOpenAPITags, tags)) ws.Route(ws.DELETE("/workspaces/{workspace}/devops/{id}"). To(tenant.DeleteDevopsProject). Param(ws.PathParameter("workspace", "workspace name")). + Param(ws.PathParameter("id", "devops project id")). Doc("Delete devops project"). + Returns(http.StatusOK, RespOK, devops.DevOpsProject{}). Metadata(restfulspec.KeyOpenAPITags, tags)) ws.Route(ws.GET("/logging"). To(tenant.LogQuery). diff --git a/pkg/gojenkins/credential.go b/pkg/gojenkins/credential.go index 22576b013..0fc8f937c 100644 --- a/pkg/gojenkins/credential.go +++ b/pkg/gojenkins/credential.go @@ -87,18 +87,18 @@ type CredentialResponse struct { TypeName string `json:"typeName"` DisplayName string `json:"displayName"` Fingerprint *struct { - FileName string `json:"fileName,omitempty"` - Hash string `json:"hash,omitempty"` + FileName string `json:"file_name,omitempty" description:"credential's display name and description"` + Hash string `json:"hash,omitempty" description:"credential's hash'"` Usage []*struct { - Name string `json:"name,omitempty"` + Name string `json:"name,omitempty" description:"jenkins pipeline full name"` Ranges struct { Ranges []*struct { - Start int `json:"start,omitempty"` - End int `json:"end,omitempty"` + Start int `json:"start,omitempty" description:"start build number"` + End int `json:"end,omitempty" description:"end build number"` } `json:"ranges,omitempty"` - } `json:"ranges,omitempty"` - } `json:"usage,omitempty"` - } `json:"fingerprint,omitempty"` + } `json:"ranges,omitempty" description:"all build num using credential"` + } `json:"usage,omitempty" description:"all usage of credential"` + } `json:"fingerprint,omitempty" description:"usage of credential"` Description string `json:"description,omitempty"` Domain string `json:"domain"` } diff --git a/pkg/models/devops/project_credential.go b/pkg/models/devops/project_credential.go index 7b6b49f65..f0a8663e3 100644 --- a/pkg/models/devops/project_credential.go +++ b/pkg/models/devops/project_credential.go @@ -30,46 +30,45 @@ type JenkinsCredential struct { Type string `json:"type" description:"type of credential,such as ssh/kubeconfig"` DisplayName string `json:"display_name,omitempty" description:"credential's display name'"` Fingerprint *struct { - FileName string `json:"file_name,omitempty"` - Hash string `json:"hash,omitempty"` + FileName string `json:"file_name,omitempty" description:"credential's display name and description"` + Hash string `json:"hash,omitempty" description:"credential's hash'"` Usage []*struct { - Name string `json:"name,omitempty"` + Name string `json:"name,omitempty" description:"jenkins pipeline full name"` Ranges struct { Ranges []*struct { - Start int `json:"start,omitempty"` - End int `json:"end,omitempty"` + Start int `json:"start,omitempty" description:"start build number"` + End int `json:"end,omitempty" description:"end build number"` } `json:"ranges,omitempty"` - } `json:"ranges,omitempty"` - } `json:"usage,omitempty"` - } `json:"fingerprint,omitempty" description:""` - Description string `json:"description,omitempty"` - Domain string `json:"domain,omitempty"` - CreateTime *time.Time `json:"create_time,omitempty"` - Creator string `json:"creator,omitempty"` - UsernamePasswordCredential *UsernamePasswordCredential `json:"username_password,omitempty"` - SshCredential *SshCredential `json:"ssh,omitempty"` - SecretTextCredential *SecretTextCredential `json:"secret_text,omitempty"` - KubeconfigCredential *KubeconfigCredential `json:"kubeconfig,omitempty"` + } `json:"ranges,omitempty" description:"all build num using credential"` + } `json:"usage,omitempty" description:"all usage of credential"` + } `json:"fingerprint,omitempty" description:"usage of credential"` + Description string `json:"description,omitempty" description:"credential's description'"` + Domain string `json:"domain,omitempty" description:"credential's domain, default '_''"` + CreateTime *time.Time `json:"create_time,omitempty" description:"credential's create_time'"` + Creator string `json:"creator,omitempty" description:"creator's username"` + UsernamePasswordCredential *UsernamePasswordCredential `json:"username_password,omitempty" description:"username password credential struct"` + SshCredential *SshCredential `json:"ssh,omitempty" description:"ssh credential struct"` + SecretTextCredential *SecretTextCredential `json:"secret_text,omitempty" description:"secret_text credential struct"` + KubeconfigCredential *KubeconfigCredential `json:"kubeconfig,omitempty" description:"kubeconfig credential struct"` } type UsernamePasswordCredential struct { - Username string `json:"username,omitempty"` - Password string `json:"password,omitempty"` + Username string `json:"username,omitempty" description:"username of username_password credential"` + Password string `json:"password,omitempty" description:"password of username_password credential"` } type SshCredential struct { - Username string `json:"username,omitempty"` - Passphrase string `json:"passphrase,omitempty"` - PrivateKey string `json:"private_key,omitempty" mapstructure:"private_key"` + Username string `json:"username,omitempty" description:"username of ssh credential"` + Passphrase string `json:"passphrase,omitempty" description:"passphrase of ssh credential, password of ssh credential"` + PrivateKey string `json:"private_key,omitempty" mapstructure:"private_key" description:"private key of ssh credential"` } type SecretTextCredential struct { - Secret string `json:"secret,omitempty"` - Description string `json:"description,omitempty"` + Secret string `json:"secret,omitempty" description:"secret content of credential"` } type KubeconfigCredential struct { - Content string `json:"content,omitempty"` + Content string `json:"content,omitempty" description:"content of kubeconfig"` } const ( diff --git a/pkg/models/devops/project_credential_handler.go b/pkg/models/devops/project_credential_handler.go index cc7d08f11..dce8416c7 100644 --- a/pkg/models/devops/project_credential_handler.go +++ b/pkg/models/devops/project_credential_handler.go @@ -205,7 +205,7 @@ func UpdateProjectCredential(projectId, credentialId string, credentialRequest * credentialId, err := jenkinsClient.UpdateSecretTextCredentialInFolder(credentialRequest.Domain, credentialId, credentialRequest.SecretTextCredential.Secret, - credentialRequest.SecretTextCredential.Description, + credentialRequest.Description, projectId) if err != nil { glog.Errorf("%+v", err) @@ -421,17 +421,17 @@ func formatCredentialResponse( response.DisplayName = jenkinsCredentialResponse.DisplayName if jenkinsCredentialResponse.Fingerprint != nil && jenkinsCredentialResponse.Fingerprint.Hash != "" { response.Fingerprint = &struct { - FileName string `json:"file_name,omitempty"` - Hash string `json:"hash,omitempty"` + FileName string `json:"file_name,omitempty" description:"credential's display name and description"` + Hash string `json:"hash,omitempty" description:"credential's hash'"` Usage []*struct { - Name string `json:"name,omitempty"` + Name string `json:"name,omitempty" description:"jenkins pipeline full name"` Ranges struct { Ranges []*struct { - Start int `json:"start,omitempty"` - End int `json:"end,omitempty"` + Start int `json:"start,omitempty" description:"start build number"` + End int `json:"end,omitempty" description:"end build number"` } `json:"ranges,omitempty"` - } `json:"ranges,omitempty"` - } `json:"usage,omitempty"` + } `json:"ranges,omitempty" description:"all build num using credential"` + } `json:"usage,omitempty" description:"all usage of credential"` }{} response.Fingerprint.FileName = jenkinsCredentialResponse.Fingerprint.FileName response.Fingerprint.Hash = jenkinsCredentialResponse.Fingerprint.Hash From 8fe88f23b7f30d3d1ec5a7f091333d567a0cb255 Mon Sep 17 00:00:00 2001 From: soulseen Date: Wed, 5 Jun 2019 21:55:59 +0800 Subject: [PATCH 08/10] update devops api doc Signed-off-by: soulseen --- pkg/models/devops/json.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/models/devops/json.go b/pkg/models/devops/json.go index 8c14c3313..6c6c72bce 100644 --- a/pkg/models/devops/json.go +++ b/pkg/models/devops/json.go @@ -226,7 +226,7 @@ type BranchPipelineRunNodes struct { URLName string `json:"urlName,omitempty"` } `json:"actions,omitempty" description:"references the reachable path to this resource"` DisplayDescription interface{} `json:"displayDescription,omitempty" description:"display description"` - DisplayName string `json:"displayName,omitempty",description:"display name"` + DisplayName string `json:"displayName,omitempty" description:"display name"` DurationInMillis int `json:"durationInMillis,omitempty" description:"duration time in millis"` ID string `json:"id,omitempty" description:"id"` Input interface{} `json:"input,omitempty" description:"input"` From a9237a5c72d58d3b1c6577f1f9eae26c0cfe673b Mon Sep 17 00:00:00 2001 From: runzexia Date: Thu, 6 Jun 2019 17:59:17 +0800 Subject: [PATCH 09/10] update docs Signed-off-by: runzexia --- pkg/apis/devops/v1alpha2/register.go | 90 ++++++++++++------------- pkg/models/devops/json.go | 20 +++--- pkg/models/devops/membership.go | 2 +- pkg/models/devops/project.go | 2 +- pkg/models/devops/project_credential.go | 2 +- 5 files changed, 58 insertions(+), 58 deletions(-) diff --git a/pkg/apis/devops/v1alpha2/register.go b/pkg/apis/devops/v1alpha2/register.go index bfc2e3df8..d88be27a1 100644 --- a/pkg/apis/devops/v1alpha2/register.go +++ b/pkg/apis/devops/v1alpha2/register.go @@ -223,9 +223,9 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}"). To(devopsapi.GetPipeline). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get DevOps Pipelines."). + Doc("Get a Pipeline Inside a DevOps Project"). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Returns(http.StatusOK, RespOK, devops.Pipeline{}). Writes(devops.Pipeline{})) @@ -255,7 +255,7 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Search DevOps Pipelines runs in branch."). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.QueryParameter("start", "the count of item start."). Required(false). DataFormat("start=%d")). @@ -272,9 +272,9 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}/branches/{branchName}/runs/{runId}"). To(devopsapi.GetBranchPipelineRun). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get DevOps Pipelines run in branch."). + Doc("Get all runs in a branch"). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). Param(webservice.QueryParameter("start", "the count of item start."). @@ -287,8 +287,8 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}/branches/{branchName}/runs/{runId}/nodes"). To(devopsapi.GetPipelineRunNodesbyBranch). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get node on DevOps Pipelines run."). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Doc("Get MultiBranch Pipeline run nodes."). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). @@ -305,7 +305,7 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get pipelines step log."). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). @@ -322,7 +322,7 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get pipelines step log."). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). Param(webservice.PathParameter("nodeId", "pipeline node id, the one node in pipeline.")). @@ -377,7 +377,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.StopBranchPipeline). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Stop pipeline in running"). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). @@ -397,7 +397,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.StopPipeline). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Stop pipeline in running"). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). Param(webservice.QueryParameter("blocking", "stop and between each retries will sleep."). @@ -416,7 +416,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.ReplayBranchPipeline). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Replay pipeline"). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). @@ -428,7 +428,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.ReplayPipeline). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Replay pipeline"). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). Returns(http.StatusOK, RespOK, devops.ReplayPipe{}). @@ -440,7 +440,7 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get Pipelines run log."). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). @@ -455,7 +455,7 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get Pipelines run log."). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). Param(webservice.QueryParameter("start", "the count of item start."). @@ -468,7 +468,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetBranchArtifacts). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get pipeline artifacts."). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). @@ -486,7 +486,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetArtifacts). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get pipeline artifacts."). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). Param(webservice.QueryParameter("start", "the count of item start."). @@ -502,16 +502,16 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}/branches"). To(devopsapi.GetPipeBranch). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get pipeline of branch."). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Doc("Get MultiBranch pipeline branches."). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). - Param(webservice.QueryParameter("filter", "filter remote"). + Param(webservice.QueryParameter("filter", "filter remote scm. e.g. origin"). Required(true). DataFormat("filter=%s")). - Param(webservice.QueryParameter("start", "the count of item start."). + Param(webservice.QueryParameter("start", "the count of branches start."). Required(true). DataFormat("start=%d")). - Param(webservice.QueryParameter("limit", "the count of item limit."). + Param(webservice.QueryParameter("limit", "the count of branches limit."). Required(true). DataFormat("limit=%d")). Returns(http.StatusOK, RespOK, []devops.PipeBranch{}). @@ -524,7 +524,7 @@ func addWebService(c *restful.Container) error { Doc("Pauses pipeline execution and allows the user to interact and control the flow of the build."). Reads(devops.CheckPlayload{}). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). @@ -538,7 +538,7 @@ func addWebService(c *restful.Container) error { Doc("Pauses pipeline execution and allows the user to interact and control the flow of the build."). Reads(devops.CheckPlayload{}). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). Param(webservice.PathParameter("nodeId", "pipeline node id, the one node in pipeline.")). @@ -550,7 +550,7 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get index console log."). Produces("text/plain; charset=utf-8"). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment."))) // match /job/{projectName}/job/{pipelineName}/build?delay=0 @@ -559,7 +559,7 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Start a build."). Produces("text/html; charset=utf-8"). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.QueryParameter("delay", "will be delay time to scan."). Required(false). @@ -571,7 +571,7 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Run pipeline."). Reads(devops.RunPayload{}). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Returns(http.StatusOK, RespOK, devops.QueuedBlueRun{}). @@ -583,7 +583,7 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Run pipeline."). Reads(devops.RunPayload{}). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Returns(http.StatusOK, RespOK, devops.QueuedBlueRun{}). Writes(devops.QueuedBlueRun{})) @@ -593,7 +593,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetBranchStepsStatus). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get pipeline steps status."). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). @@ -609,7 +609,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetStepsStatus). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get pipeline steps status."). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). Param(webservice.PathParameter("nodeId", "pipeline node id, the one node in pipeline.")). @@ -623,7 +623,7 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/crumbissuer"). To(devopsapi.GetCrumb). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get crumb issuer."). + Doc("Get crumb issuer. A CrumbIssuer represents an algorithm to generate a nonce value, known as a crumb, to counter cross site request forgery exploits. Crumbs are typically hashes incorporating information that uniquely identifies an agent that sends a request, along with a guarded secret so that the crumb value cannot be forged by a third party."). Returns(http.StatusOK, RespOK, devops.Crumb{}). Writes(devops.Crumb{})) @@ -656,7 +656,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetPipelineRun). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get run pipeline in project."). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). Returns(http.StatusOK, RespOK, devops.PipelineRun{}). @@ -667,7 +667,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetBranchPipeline). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get Pipeline run by branch."). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach")). Returns(http.StatusOK, RespOK, devops.BranchPipeline{}). @@ -678,7 +678,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetPipelineRunNodes). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get Pipeline run nodes."). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build")). Param(webservice.QueryParameter("limit", "the count of item limit"). @@ -692,7 +692,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetBranchNodeSteps). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get steps in node by branch."). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). @@ -708,7 +708,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetNodeSteps). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get steps in node."). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build")). Param(webservice.PathParameter("nodeId", "pipeline node id, the one node in pipeline.")). @@ -724,9 +724,9 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Consumes("application/x-www-form-urlencoded"). Produces("application/json", "charset=utf-8"). - Doc("Convert json to jenkinsfile format."). + Doc("Convert json to jenkinsfile format. Usually the frontend uses json to edit jenkinsfile"). Reads(devops.ReqJson{}). - Returns(http.StatusOK, RespOK, devops.NodeSteps{}). + Returns(http.StatusOK, RespOK, devops.ResJenkinsfile{}). Writes(devops.ResJenkinsfile{})) // match /pipeline-model-converter/toJson @@ -735,7 +735,7 @@ func addWebService(c *restful.Container) error { Metadata(restfulspec.KeyOpenAPITags, tags). Consumes("application/x-www-form-urlencoded"). Produces("application/json", "charset=utf-8"). - Doc("Convert jenkinsfile to json format."). + Doc("Convert jenkinsfile to json format. Usually the frontend uses json to edit jenkinsfile"). Reads(devops.ReqJenkinsfile{}). Returns(http.StatusOK, RespOK, devops.ResJson{}). Writes(devops.ResJson{})) @@ -744,9 +744,9 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.GET("/devops/notifycommit"). To(devopsapi.GetNotifyCommit). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get notify commit by GET HTTP method."). + Doc("Get notification commit by HTTP GET method."). Produces("text/plain; charset=utf-8"). - Param(webservice.QueryParameter("url", "the url for webhook to push."). + Param(webservice.QueryParameter("url", "url of git scm"). Required(true). DataFormat("url=%s"))) @@ -754,10 +754,10 @@ func addWebService(c *restful.Container) error { webservice.Route(webservice.POST("/devops/notifycommit"). To(devopsapi.GetNotifyCommit). Metadata(restfulspec.KeyOpenAPITags, tags). - Doc("Get notify commit by POST HTTP method."). + Doc("Get notify commit by HTTP POST method."). Consumes("application/json"). Produces("text/plain; charset=utf-8"). - Param(webservice.QueryParameter("url", "the url for webhook to push."). + Param(webservice.QueryParameter("url", "url of git scm"). Required(true). DataFormat("url=%s"))) @@ -771,7 +771,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetBranchNodesDetail). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Gives steps details inside a pipeline node by branch. For a Stage, the steps will include all the steps defined inside the stage."). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). @@ -786,7 +786,7 @@ func addWebService(c *restful.Container) error { To(devopsapi.GetNodesDetail). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Gives steps details inside a pipeline node. For a Stage, the steps will include all the steps defined inside the stage."). - Param(webservice.PathParameter("projectName", "the name of devops project, the project set of software development practices that combines software development (Dev) and information technology operations (Ops) to shorten the systems development life cycle while delivering features, fixes, and updates frequently in close alignment with business objectives.")). + Param(webservice.PathParameter("projectName", "the name of devops project.")). Param(webservice.PathParameter("pipelineName", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")). Param(webservice.PathParameter("branchName", "the name of branch, same as repository brnach.")). Param(webservice.PathParameter("runId", "pipeline run id, the unique id for a pipeline once build.")). diff --git a/pkg/models/devops/json.go b/pkg/models/devops/json.go index 6c6c72bce..0d351dc7c 100644 --- a/pkg/models/devops/json.go +++ b/pkg/models/devops/json.go @@ -247,17 +247,17 @@ type SCMOrg struct { Class string `json:"_class,omitempty" description:"It’s a fully qualified name and is an identifier of the producer of this resource's capability."` Links struct { Repositories struct { - Class string `json:"_class,omitempty"` - Href string `json:"href,omitempty"` + Class string `json:"_class,omitempty" description:"It’s a fully qualified name and is an identifier of the producer of this resource's capability."` + Href string `json:"href,omitempty" description:"url in api"` } `json:"repositories,omitempty"` Self struct { - Class string `json:"_class,omitempty"` - Href string `json:"href,omitempty"` - } `json:"self,omitempty"` + Class string `json:"_class,omitempty" description:"It’s a fully qualified name and is an identifier of the producer of this resource's capability."` + Href string `json:"href,omitempty" description:"self url in api"` + } `json:"self,omitempty" description:"scm org self info"` } `json:"_links,omitempty" description:"references the reachable path to this resource"` Avatar string `json:"avatar,omitempty" description:"avatar url"` JenkinsOrganizationPipeline bool `json:"jenkinsOrganizationPipeline,omitempty" description:"jenkins organization pipeline"` - Name string `json:"name,omitempty" description:"name "` + Name string `json:"name,omitempty" description:"org name "` } // GetOrgRepo @@ -733,10 +733,10 @@ type Crumb struct { // CheckScriptCompile type CheckScript struct { - Column int `json:"column,omitempty" description:"column"` - Line int `json:"line,omitempty" description:"line"` - Message string `json:"message,omitempty" description:"message"` - Status string `json:"status,omitempty" description:"statue"` + Column int `json:"column,omitempty" description:"column e.g. 0"` + Line int `json:"line,omitempty" description:"line e.g. 0"` + Message string `json:"message,omitempty" description:"message e.g. success"` + Status string `json:"status,omitempty" description:"status e.g. success"` } // CheckCron diff --git a/pkg/models/devops/membership.go b/pkg/models/devops/membership.go index 8f48a92d7..9e9234cd6 100644 --- a/pkg/models/devops/membership.go +++ b/pkg/models/devops/membership.go @@ -23,7 +23,7 @@ const ( type DevOpsProjectMembership struct { Username string `json:"username" description:"member's username,username can uniquely identify a user"` ProjectId string `json:"project_id" db:"project_id" description:"the devops projects which project membership belongs to"` - Role string `json:"role" description:"devops project membership's role type'"` + Role string `json:"role" description:"devops project membership's role type. e.g. owner '"` Status string `json:"status" description:"Desperated, status of project membership"` GrantBy string `json:"grand_by,omitempty" description:"Username of the user who assigned the role"` } diff --git a/pkg/models/devops/project.go b/pkg/models/devops/project.go index 222b2f01b..fb906a126 100644 --- a/pkg/models/devops/project.go +++ b/pkg/models/devops/project.go @@ -47,7 +47,7 @@ type DevOpsProject struct { CreateTime time.Time `json:"create_time" description:"DevOps Project's Creation time'"` - Status string `json:"status" description:"DevOps project's status"` + Status string `json:"status" description:"DevOps project's status. e.g. active"` Visibility string `json:"visibility,omitempty" description:"Desperated Field"` diff --git a/pkg/models/devops/project_credential.go b/pkg/models/devops/project_credential.go index f0a8663e3..6425e9780 100644 --- a/pkg/models/devops/project_credential.go +++ b/pkg/models/devops/project_credential.go @@ -43,7 +43,7 @@ type JenkinsCredential struct { } `json:"usage,omitempty" description:"all usage of credential"` } `json:"fingerprint,omitempty" description:"usage of credential"` Description string `json:"description,omitempty" description:"credential's description'"` - Domain string `json:"domain,omitempty" description:"credential's domain, default '_''"` + Domain string `json:"domain,omitempty" description:"credential's domain,In ks we only use the default domain, default '_''"` CreateTime *time.Time `json:"create_time,omitempty" description:"credential's create_time'"` Creator string `json:"creator,omitempty" description:"creator's username"` UsernamePasswordCredential *UsernamePasswordCredential `json:"username_password,omitempty" description:"username password credential struct"` From a4d25f15dd8c9bfddc9f09107c169e99b3835d3b Mon Sep 17 00:00:00 2001 From: runzexia Date: Mon, 10 Jun 2019 10:26:18 +0800 Subject: [PATCH 10/10] update api docs --- pkg/apis/devops/v1alpha2/register.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/apis/devops/v1alpha2/register.go b/pkg/apis/devops/v1alpha2/register.go index d88be27a1..f864ada2e 100644 --- a/pkg/apis/devops/v1alpha2/register.go +++ b/pkg/apis/devops/v1alpha2/register.go @@ -237,7 +237,7 @@ func addWebService(c *restful.Container) error { Param(webservice.QueryParameter("q", "query pipelines, condition for filtering."). Required(false). DataFormat("q=%s")). - Param(webservice.QueryParameter("filter", "Condition for filteringfilter folders or not.."). + Param(webservice.QueryParameter("filter", "Filter some types of jobs. e.g. no-folder,will not get a job of type folder"). Required(false). DataFormat("filter=%s")). Param(webservice.QueryParameter("start", "the count of item start.").