From 2857071bdd94071bd21dd9b120a57168b8942d86 Mon Sep 17 00:00:00 2001 From: Zhuxiaoyang Date: Sun, 5 May 2019 15:48:03 +0800 Subject: [PATCH] Dev (#9) * add tag & add webhook api Signed-off-by: soulseen --- pkg/apis/devops/v1alpha2/register.go | 54 +- pkg/apiserver/devops/devops.go | 78 +- pkg/models/devops/devops.go | 104 +- pkg/models/devops/json.go | 1506 +++++++++++++------------- pkg/models/devops/urlconfig.go | 2 + 5 files changed, 911 insertions(+), 833 deletions(-) diff --git a/pkg/apis/devops/v1alpha2/register.go b/pkg/apis/devops/v1alpha2/register.go index 73de60451..e3f0a39c2 100644 --- a/pkg/apis/devops/v1alpha2/register.go +++ b/pkg/apis/devops/v1alpha2/register.go @@ -271,12 +271,12 @@ func addWebService(c *restful.Container) error { Param(webservice.QueryParameter("branch", "branch "). Required(false). DataFormat("branch=%s")). - Returns(http.StatusOK, RespOK, []devops.PipeBranchRun{}). - Writes([]devops.PipeBranchRun{})) + Returns(http.StatusOK, RespOK, []devops.BranchPipelineRun{}). + Writes([]devops.BranchPipelineRun{})) // match Jenkins api "/blue/rest/organizations/jenkins/pipelines/{projectName}/{pipelineName}/branches/{branchName}/runs/{runId}/" webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}/branches/{branchName}/runs/{runId}"). - To(devopsapi.GetPipeBranchRun). + To(devopsapi.GetBranchPipelineRun). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get DevOps Pipelines run in branch."). Param(webservice.PathParameter("pipelineName", "pipeline name")). @@ -286,12 +286,12 @@ func addWebService(c *restful.Container) error { Param(webservice.QueryParameter("start", "start"). Required(false). DataFormat("start=%d")). - Returns(http.StatusOK, RespOK, devops.PipeBranchRun{}). - Writes(devops.PipeBranchRun{})) + Returns(http.StatusOK, RespOK, devops.BranchPipelineRun{}). + Writes(devops.BranchPipelineRun{})) // match Jenkins api "/blue/rest/organizations/jenkins/pipelines/{projectName}/{pipelineName}/branches/{branchName}/runs/{runId}/nodes" webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}/branches/{branchName}/runs/{runId}/nodes"). - To(devopsapi.GetBranchPipeRunNodes). + To(devopsapi.GetPipelineRunNodesbyBranch). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get node on DevOps Pipelines run."). Param(webservice.PathParameter("projectName", "devops project name")). @@ -302,8 +302,8 @@ func addWebService(c *restful.Container) error { Required(false). DataFormat("limit=%d"). DefaultValue("limit=10000")). - Returns(http.StatusOK, RespOK, []devops.BranchPipeRunNodes{}). - Writes([]devops.BranchPipeRunNodes{})) + Returns(http.StatusOK, RespOK, []devops.BranchPipelineRunNodes{}). + Writes([]devops.BranchPipelineRunNodes{})) // match "/blue/rest/organizations/jenkins/pipelines/{projectName}/{pipelineName}/branches/{branchName}/runs/{runId}/nodes/{nodeId}/steps/{stepId}/log/?start=0" webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}/branches/{branchName}/runs/{runId}/nodes/{nodeId}/steps/{stepId}/log"). @@ -554,18 +554,18 @@ func addWebService(c *restful.Container) error { // match /blue/rest/organizations/jenkins/pipelines/{projectName}/pipelines/{pipelineName}/branches/{branchName} webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}/branches/{branchName}"). - To(devopsapi.GetBranchPipe). + 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")). - Returns(http.StatusOK, RespOK, devops.BranchPipe{}). - Writes(devops.BranchPipe{})) + Returns(http.StatusOK, RespOK, devops.BranchPipeline{}). + Writes(devops.BranchPipeline{})) // match /blue/rest/organizations/jenkins/pipelines/{projectName}/pipelines/{pipelineName}/runs/{runId}/nodes/?limit=10000 webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}/runs/{runId}/nodes"). - To(devopsapi.GetPipeRunNodes). + To(devopsapi.GetPipelineRunNodes). Metadata(restfulspec.KeyOpenAPITags, tags). Doc("Get Pipeline run nodes."). Param(webservice.PathParameter("projectName", "devops project name")). @@ -574,8 +574,8 @@ func addWebService(c *restful.Container) error { Param(webservice.QueryParameter("limit", "limit count"). Required(false). DataFormat("limit=%d")). - Returns(http.StatusOK, RespOK, []devops.PipeRunNodes{}). - Writes([]devops.PipeRunNodes{})) + Returns(http.StatusOK, RespOK, []devops.PipelineRunNodes{}). + Writes([]devops.PipelineRunNodes{})) // match /blue/rest/organizations/jenkins/pipelines/%s/%s/branches/%s/runs/%s/nodes/%s/steps/?limit= webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}/branches/{branchName}/runs/{runId}/nodes/{nodeId}/steps"). @@ -615,6 +615,32 @@ func addWebService(c *restful.Container) error { Returns(http.StatusOK, RespOK,devops.ResJson{}). Writes(devops.ResJson{})) + // match /git/notifyCommit/?url= + webservice.Route(webservice.GET("/devops/notifycommit"). + To(devopsapi.GetNotifyCommit). + Metadata(restfulspec.KeyOpenAPITags, tags). + 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). + DataFormat("url=%s"))) + + // Gitlab or some other scm managers can only use HTTP method. match /git/notifyCommit/?url= + webservice.Route(webservice.POST("/devops/notifycommit"). + To(devopsapi.GetNotifyCommit). + Metadata(restfulspec.KeyOpenAPITags, tags). + 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."). + Required(true). + DataFormat("url=%s"))) + + webservice.Route(webservice.POST("/devops/github/webhook"). + To(devopsapi.GithubWebhook). + Metadata(restfulspec.KeyOpenAPITags, tags). + Doc("receive webhook request.")) + c.Add(webservice) return nil diff --git a/pkg/apiserver/devops/devops.go b/pkg/apiserver/devops/devops.go index b7c2b5245..8c0006623 100644 --- a/pkg/apiserver/devops/devops.go +++ b/pkg/apiserver/devops/devops.go @@ -46,7 +46,7 @@ func SearchPipelines(req *restful.Request, resp *restful.Response) { return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } @@ -60,39 +60,39 @@ func SearchPipelineRuns(req *restful.Request, resp *restful.Response) { return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } -func GetPipeBranchRun(req *restful.Request, resp *restful.Response) { +func GetBranchPipelineRun(req *restful.Request, resp *restful.Response) { projectName := req.PathParameter("projectName") pipelineName := req.PathParameter("pipelineName") branchName := req.PathParameter("branchName") runId := req.PathParameter("runId") - res, err := devops.GetPipeBranchRun(projectName, pipelineName, branchName, runId, req.Request) + res, err := devops.GetBranchPipelineRun(projectName, pipelineName, branchName, runId, req.Request) if err != nil { parseErr(err, resp) return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } -func GetBranchPipeRunNodes(req *restful.Request, resp *restful.Response) { +func GetPipelineRunNodesbyBranch(req *restful.Request, resp *restful.Response) { projectName := req.PathParameter("projectName") pipelineName := req.PathParameter("pipelineName") branchName := req.PathParameter("branchName") runId := req.PathParameter("runId") - res, err := devops.GetBranchPipeRunNodes(projectName, pipelineName, branchName, runId, req.Request) + res, err := devops.GetPipelineRunNodesbyBranch(projectName, pipelineName, branchName, runId, req.Request) if err != nil { parseErr(err, resp) return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } @@ -121,7 +121,7 @@ func Validate(req *restful.Request, resp *restful.Response) { return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } @@ -134,7 +134,7 @@ func GetSCMOrg(req *restful.Request, resp *restful.Response) { return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } @@ -148,7 +148,7 @@ func GetOrgRepo(req *restful.Request, resp *restful.Response) { return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } @@ -164,7 +164,7 @@ func StopPipeline(req *restful.Request, resp *restful.Response) { return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } @@ -180,7 +180,7 @@ func ReplayPipeline(req *restful.Request, resp *restful.Response) { return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } @@ -210,7 +210,7 @@ func GetArtifacts(req *restful.Request, resp *restful.Response) { parseErr(err, resp) return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } @@ -223,7 +223,7 @@ func GetPipeBranch(req *restful.Request, resp *restful.Response) { parseErr(err, resp) return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } @@ -281,7 +281,7 @@ func RunPipeline(req *restful.Request, resp *restful.Response) { return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } @@ -298,7 +298,7 @@ func GetStepsStatus(req *restful.Request, resp *restful.Response) { return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } @@ -309,7 +309,7 @@ func GetCrumb(req *restful.Request, resp *restful.Response) { return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } @@ -344,7 +344,7 @@ func CheckCron(req *restful.Request, resp *restful.Response) { return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.WriteAsJson(res) } @@ -359,36 +359,36 @@ func GetPipelineRun(req *restful.Request, resp *restful.Response) { return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } -func GetBranchPipe(req *restful.Request, resp *restful.Response) { +func GetBranchPipeline(req *restful.Request, resp *restful.Response) { projectName := req.PathParameter("projectName") pipelineName := req.PathParameter("pipelineName") branchName := req.PathParameter("branchName") - res, err := devops.GetBranchPipe(projectName, pipelineName, branchName, req.Request) + res, err := devops.GetBranchPipeline(projectName, pipelineName, branchName, req.Request) if err != nil { parseErr(err, resp) return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } -func GetPipeRunNodes(req *restful.Request, resp *restful.Response) { +func GetPipelineRunNodes(req *restful.Request, resp *restful.Response) { projectName := req.PathParameter("projectName") pipelineName := req.PathParameter("pipelineName") runId := req.PathParameter("runId") - res, err := devops.GetPipeRunNodes(projectName, pipelineName, runId, req.Request) + res, err := devops.GetPipelineRunNodes(projectName, pipelineName, runId, req.Request) if err != nil { parseErr(err, resp) return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } @@ -404,29 +404,45 @@ func GetNodeSteps(req *restful.Request, resp *restful.Response) { parseErr(err, resp) return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } func ToJenkinsfile(req *restful.Request, resp *restful.Response) { - res, err := devops.ToJenkinsfile(req.Request) if err != nil { parseErr(err, resp) return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) resp.Write(res) } func ToJson(req *restful.Request, resp *restful.Response) { - res, err := devops.ToJson(req.Request) if err != nil { parseErr(err, resp) return } - resp.Header().Set(restful.HEADER_ContentType, "application/json") + resp.Header().Set(restful.HEADER_ContentType, restful.MIME_JSON) + resp.Write(res) +} + +func GetNotifyCommit(req *restful.Request, resp *restful.Response) { + res, err := devops.GetNotifyCommit(req.Request) + if err != nil { + parseErr(err, resp) + return + } + resp.Write(res) +} + +func GithubWebhook(req *restful.Request, resp *restful.Response) { + res, err := devops.GithubWebhook(req.Request) + if err != nil { + parseErr(err, resp) + return + } resp.Write(res) } diff --git a/pkg/models/devops/devops.go b/pkg/models/devops/devops.go index 520151b3e..2e91de173 100644 --- a/pkg/models/devops/devops.go +++ b/pkg/models/devops/devops.go @@ -30,14 +30,20 @@ import ( "time" ) -var JenkinsUrl string +var ( + jenkinsUrl string + jenkinsAdminUsername string + jenkinsAdminPassword string +) func init() { - flag.StringVar(&JenkinsUrl, "jenkins-url", "http://ks-jenkins.kubesphere-devops-system.svc.cluster.local:80", "jenkins server host") + flag.StringVar(&jenkinsUrl, "jenkins-url", "http://ks-jenkins.kubesphere-devops-system.svc.cluster.local:80", "jenkins server host") + flag.StringVar(&jenkinsAdminUsername, "jenkins-adminusername", "admin", "admin username of jenkins") + flag.StringVar(&jenkinsAdminPassword, "jenkins-adminpassword", "passw0rd", "admin password of jenkins") } func GetPipeline(projectName, pipelineName string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetPipelineUrl, projectName, pipelineName) + baseUrl := fmt.Sprintf(jenkinsUrl+GetPipelineUrl, projectName, pipelineName) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -50,7 +56,7 @@ func GetPipeline(projectName, pipelineName string, req *http.Request) ([]byte, e } func SearchPipelines(req *http.Request) ([]byte, error) { - baseUrl := JenkinsUrl + SearchPipelineUrl + req.URL.RawQuery + baseUrl := jenkinsUrl + SearchPipelineUrl + req.URL.RawQuery log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -63,7 +69,7 @@ func SearchPipelines(req *http.Request) ([]byte, error) { } func SearchPipelineRuns(projectName, pipelineName string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+SearchPipelineRunUrl+req.URL.RawQuery, projectName, pipelineName) + baseUrl := fmt.Sprintf(jenkinsUrl+SearchPipelineRunUrl+req.URL.RawQuery, projectName, pipelineName) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -75,8 +81,8 @@ func SearchPipelineRuns(projectName, pipelineName string, req *http.Request) ([] return res, err } -func GetPipeBranchRun(projectName, pipelineName, branchName, runId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetPipeBranchRunUrl, projectName, pipelineName, branchName, runId) +func GetBranchPipelineRun(projectName, pipelineName, branchName, runId string, req *http.Request) ([]byte, error) { + baseUrl := fmt.Sprintf(jenkinsUrl+GetPipeBranchRunUrl, projectName, pipelineName, branchName, runId) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -88,8 +94,8 @@ func GetPipeBranchRun(projectName, pipelineName, branchName, runId string, req * return res, err } -func GetBranchPipeRunNodes(projectName, pipelineName, branchName, runId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetBranchPipeRunNodesUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId) +func GetPipelineRunNodesbyBranch(projectName, pipelineName, branchName, runId string, req *http.Request) ([]byte, error) { + baseUrl := fmt.Sprintf(jenkinsUrl+GetBranchPipeRunNodesUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -102,7 +108,7 @@ func GetBranchPipeRunNodes(projectName, pipelineName, branchName, runId string, } func GetStepLog(projectName, pipelineName, branchName, runId, nodeId, stepId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetStepLogUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId, nodeId, stepId) + baseUrl := fmt.Sprintf(jenkinsUrl+GetStepLogUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId, nodeId, stepId) log.Infof("Jenkins-url: " + baseUrl) resBody, err := sendJenkinsRequest(baseUrl, req) @@ -115,7 +121,7 @@ func GetStepLog(projectName, pipelineName, branchName, runId, nodeId, stepId str } func Validate(scmId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+ValidateUrl, scmId) + baseUrl := fmt.Sprintf(jenkinsUrl+ValidateUrl, scmId) log.Infof("Jenkins-url: " + baseUrl) resBody, err := sendJenkinsRequest(baseUrl, req) @@ -128,7 +134,7 @@ func Validate(scmId string, req *http.Request) ([]byte, error) { } func GetSCMOrg(scmId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetSCMOrgUrl+req.URL.RawQuery, scmId) + baseUrl := fmt.Sprintf(jenkinsUrl+GetSCMOrgUrl+req.URL.RawQuery, scmId) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -141,7 +147,7 @@ func GetSCMOrg(scmId string, req *http.Request) ([]byte, error) { } func GetOrgRepo(scmId, organizationId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetOrgRepoUrl+req.URL.RawQuery, scmId, organizationId) + baseUrl := fmt.Sprintf(jenkinsUrl+GetOrgRepoUrl+req.URL.RawQuery, scmId, organizationId) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -154,7 +160,7 @@ func GetOrgRepo(scmId, organizationId string, req *http.Request) ([]byte, error) } func StopPipeline(projectName, pipelineName, branchName, runId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+StopPipelineUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId) + baseUrl := fmt.Sprintf(jenkinsUrl+StopPipelineUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -167,7 +173,7 @@ func StopPipeline(projectName, pipelineName, branchName, runId string, req *http } func ReplayPipeline(projectName, pipelineName, branchName, runId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+ReplayPipelineUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId) + baseUrl := fmt.Sprintf(jenkinsUrl+ReplayPipelineUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -180,7 +186,7 @@ func ReplayPipeline(projectName, pipelineName, branchName, runId string, req *ht } func GetRunLog(projectName, pipelineName, branchName, runId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetRunLogUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId) + baseUrl := fmt.Sprintf(jenkinsUrl+GetRunLogUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -193,7 +199,7 @@ func GetRunLog(projectName, pipelineName, branchName, runId string, req *http.Re } func GetArtifacts(projectName, pipelineName, branchName, runId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetArtifactsUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId) + baseUrl := fmt.Sprintf(jenkinsUrl+GetArtifactsUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -206,7 +212,7 @@ func GetArtifacts(projectName, pipelineName, branchName, runId string, req *http } func GetPipeBranch(projectName, pipelineName string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetPipeBranchUrl+req.URL.RawQuery, projectName, pipelineName) + baseUrl := fmt.Sprintf(jenkinsUrl+GetPipeBranchUrl+req.URL.RawQuery, projectName, pipelineName) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -219,7 +225,7 @@ func GetPipeBranch(projectName, pipelineName string, req *http.Request) ([]byte, } func CheckPipeline(projectName, pipelineName, branchName, runId, nodeId, stepId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+CheckPipelineUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId, nodeId, stepId) + baseUrl := fmt.Sprintf(jenkinsUrl+CheckPipelineUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId, nodeId, stepId) log.Infof("Jenkins-url: " + baseUrl) resBody, err := sendJenkinsRequest(baseUrl, req) @@ -232,7 +238,7 @@ func CheckPipeline(projectName, pipelineName, branchName, runId, nodeId, stepId } func GetConsoleLog(projectName, pipelineName string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetConsoleLogUrl+req.URL.RawQuery, projectName, pipelineName) + baseUrl := fmt.Sprintf(jenkinsUrl+GetConsoleLogUrl+req.URL.RawQuery, projectName, pipelineName) log.Infof("Jenkins-url: " + baseUrl) resBody, err := sendJenkinsRequest(baseUrl, req) @@ -245,7 +251,7 @@ func GetConsoleLog(projectName, pipelineName string, req *http.Request) ([]byte, } func ScanBranch(projectName, pipelineName string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+ScanBranchUrl+req.URL.RawQuery, projectName, pipelineName) + baseUrl := fmt.Sprintf(jenkinsUrl+ScanBranchUrl+req.URL.RawQuery, projectName, pipelineName) log.Infof("Jenkins-url: " + baseUrl) resBody, err := sendJenkinsRequest(baseUrl, req) @@ -258,7 +264,7 @@ func ScanBranch(projectName, pipelineName string, req *http.Request) ([]byte, er } func RunPipeline(projectName, pipelineName, branchName string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+RunPipelineUrl+req.URL.RawQuery, projectName, pipelineName, branchName) + baseUrl := fmt.Sprintf(jenkinsUrl+RunPipelineUrl+req.URL.RawQuery, projectName, pipelineName, branchName) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -271,7 +277,7 @@ func RunPipeline(projectName, pipelineName, branchName string, req *http.Request } func GetStepsStatus(projectName, pipelineName, branchName, runId, nodeId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetStepsStatusUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId, nodeId) + baseUrl := fmt.Sprintf(jenkinsUrl+GetStepsStatusUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId, nodeId) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -284,7 +290,7 @@ func GetStepsStatus(projectName, pipelineName, branchName, runId, nodeId string, } func GetCrumb(req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl + GetCrumbUrl) + baseUrl := fmt.Sprintf(jenkinsUrl + GetCrumbUrl) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -297,8 +303,9 @@ func GetCrumb(req *http.Request) ([]byte, error) { } func CheckScriptCompile(req *http.Request) ([]byte, error) { - baseUrl := JenkinsUrl + CheckScriptCompileUrl + baseUrl := jenkinsUrl + CheckScriptCompileUrl log.Infof("Jenkins-url: " + baseUrl) + req.SetBasicAuth(jenkinsAdminUsername, jenkinsAdminPassword) resBody, err := sendJenkinsRequest(baseUrl, req) if err != nil { @@ -310,8 +317,9 @@ func CheckScriptCompile(req *http.Request) ([]byte, error) { } func CheckCron(req *http.Request) (*CheckCronRes, error) { - baseUrl := JenkinsUrl + CheckCronUrl + req.URL.RawQuery + baseUrl := jenkinsUrl + CheckCronUrl + req.URL.RawQuery log.Infof("Jenkins-url: " + baseUrl) + req.SetBasicAuth(jenkinsAdminUsername, jenkinsAdminPassword) var res = new(CheckCronRes) resp, err := http.Get(baseUrl) @@ -334,7 +342,7 @@ func CheckCron(req *http.Request) (*CheckCronRes, error) { } func GetPipelineRun(projectName, pipelineName, runId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetPipelineRunUrl, projectName, pipelineName, runId) + baseUrl := fmt.Sprintf(jenkinsUrl+GetPipelineRunUrl, projectName, pipelineName, runId) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -346,8 +354,8 @@ func GetPipelineRun(projectName, pipelineName, runId string, req *http.Request) return res, err } -func GetBranchPipe(projectName, pipelineName, branchName string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetBranchPipeUrl, projectName, pipelineName, branchName) +func GetBranchPipeline(projectName, pipelineName, branchName string, req *http.Request) ([]byte, error) { + baseUrl := fmt.Sprintf(jenkinsUrl+GetBranchPipeUrl, projectName, pipelineName, branchName) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -359,8 +367,8 @@ func GetBranchPipe(projectName, pipelineName, branchName string, req *http.Reque return res, err } -func GetPipeRunNodes(projectName, pipelineName, runId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetPipeRunNodesUrl+req.URL.RawQuery, projectName, pipelineName, runId) +func GetPipelineRunNodes(projectName, pipelineName, runId string, req *http.Request) ([]byte, error) { + baseUrl := fmt.Sprintf(jenkinsUrl+GetPipeRunNodesUrl+req.URL.RawQuery, projectName, pipelineName, runId) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -373,9 +381,8 @@ func GetPipeRunNodes(projectName, pipelineName, runId string, req *http.Request) } func GetNodeSteps(projectName, pipelineName, branchName, runId, nodeId string, req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl+GetNodeStepsUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId, nodeId) + baseUrl := fmt.Sprintf(jenkinsUrl+GetNodeStepsUrl+req.URL.RawQuery, projectName, pipelineName, branchName, runId, nodeId) log.Infof("Jenkins-url: " + baseUrl) - //var res = new(NodeSteps) res, err := sendJenkinsRequest(baseUrl, req) if err != nil { @@ -387,7 +394,7 @@ func GetNodeSteps(projectName, pipelineName, branchName, runId, nodeId string, r } func ToJenkinsfile(req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl + ToJenkinsfileUrl) + baseUrl := fmt.Sprintf(jenkinsUrl + ToJenkinsfileUrl) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) @@ -400,7 +407,34 @@ func ToJenkinsfile(req *http.Request) ([]byte, error) { } func ToJson(req *http.Request) ([]byte, error) { - baseUrl := fmt.Sprintf(JenkinsUrl + ToJsonUrl) + baseUrl := fmt.Sprintf(jenkinsUrl + ToJsonUrl) + log.Infof("Jenkins-url: " + baseUrl) + + res, err := sendJenkinsRequest(baseUrl, req) + if err != nil { + log.Error(err) + return nil, err + } + + return res, err +} + +func GetNotifyCommit(req *http.Request) ([]byte, error) { + baseUrl := fmt.Sprintf(jenkinsUrl + GetNotifyCommitUrl + req.URL.RawQuery) + log.Infof("Jenkins-url: " + baseUrl) + req.Method = "GET" + + res, err := sendJenkinsRequest(baseUrl, req) + if err != nil { + log.Error(err) + return nil, err + } + + return res, err +} + +func GithubWebhook(req *http.Request) ([]byte, error) { + baseUrl := fmt.Sprintf(jenkinsUrl + GithubWebhookUrl + req.URL.RawQuery) log.Infof("Jenkins-url: " + baseUrl) res, err := sendJenkinsRequest(baseUrl, req) diff --git a/pkg/models/devops/json.go b/pkg/models/devops/json.go index e401f2867..2e9e22908 100644 --- a/pkg/models/devops/json.go +++ b/pkg/models/devops/json.go @@ -19,222 +19,222 @@ package devops // GetPipeline & SearchPipelines type Pipeline struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` Scm struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"scm"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"scm,omitempty"` Branches struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"branches"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"branches,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` Runs struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"runs"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"runs,omitempty"` Trends struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"trends"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"trends,omitempty"` Queue struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"queue"` - } `json:"_links"` - Actions []interface{} `json:"actions"` - Disabled interface{} `json:"disabled"` - DisplayName string `json:"displayName"` - FullDisplayName string `json:"fullDisplayName"` - FullName string `json:"fullName"` - Name string `json:"name"` - Organization string `json:"organization"` - Parameters interface{} `json:"parameters"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"queue,omitempty"` + } `json:"_links,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + Disabled interface{} `json:"disabled,omitempty"` + DisplayName string `json:"displayName,omitempty"` + FullDisplayName string `json:"fullDisplayName,omitempty"` + FullName string `json:"fullName,omitempty"` + Name string `json:"name,omitempty"` + Organization string `json:"organization,omitempty"` + Parameters interface{} `json:"parameters,omitempty"` Permissions struct { - Create bool `json:"create"` - Configure bool `json:"configure"` - Read bool `json:"read"` - Start bool `json:"start"` - Stop bool `json:"stop"` - } `json:"permissions"` - EstimatedDurationInMillis int `json:"estimatedDurationInMillis"` - NumberOfFolders int `json:"numberOfFolders"` - NumberOfPipelines int `json:"numberOfPipelines"` - PipelineFolderNames []interface{} `json:"pipelineFolderNames"` - WeatherScore int `json:"weatherScore"` - BranchNames []string `json:"branchNames"` - NumberOfFailingBranches int `json:"numberOfFailingBranches"` - NumberOfFailingPullRequests int `json:"numberOfFailingPullRequests"` - NumberOfSuccessfulBranches int `json:"numberOfSuccessfulBranches"` - NumberOfSuccessfulPullRequests int `json:"numberOfSuccessfulPullRequests"` + Create bool `json:"create,omitempty"` + Configure bool `json:"configure,omitempty"` + Read bool `json:"read,omitempty"` + Start bool `json:"start,omitempty"` + Stop bool `json:"stop,omitempty"` + } `json:"permissions,omitempty"` + EstimatedDurationInMillis int `json:"estimatedDurationInMillis,omitempty"` + NumberOfFolders int `json:"numberOfFolders,omitempty"` + NumberOfPipelines int `json:"numberOfPipelines,omitempty"` + PipelineFolderNames []interface{} `json:"pipelineFolderNames,omitempty"` + WeatherScore int `json:"weatherScore,omitempty"` + BranchNames []string `json:"branchNames,omitempty"` + NumberOfFailingBranches int `json:"numberOfFailingBranches,omitempty"` + NumberOfFailingPullRequests int `json:"numberOfFailingPullRequests,omitempty"` + NumberOfSuccessfulBranches int `json:"numberOfSuccessfulBranches,omitempty"` + NumberOfSuccessfulPullRequests int `json:"numberOfSuccessfulPullRequests,omitempty"` ScmSource struct { - Class string `json:"_class"` - APIURL interface{} `json:"apiUrl"` - ID string `json:"id"` - } `json:"scmSource"` - TotalNumberOfBranches int `json:"totalNumberOfBranches"` - TotalNumberOfPullRequests int `json:"totalNumberOfPullRequests"` + Class string `json:"_class,omitempty"` + APIURL interface{} `json:"apiUrl,omitempty"` + ID string `json:"id,omitempty"` + } `json:"scmSource,omitempty"` + TotalNumberOfBranches int `json:"totalNumberOfBranches,omitempty"` + TotalNumberOfPullRequests int `json:"totalNumberOfPullRequests,omitempty"` } // GetPipeBranchRun & SearchPipelineRuns -type PipeBranchRun struct { - Class string `json:"_class"` +type BranchPipelineRun struct { + Class string `json:"_class,omitempty"` Links struct { PrevRun struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"prevRun"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"prevRun,omitempty"` Parent struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"parent"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"parent,omitempty"` Tests struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"tests"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"tests,omitempty"` Nodes struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"nodes"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"nodes,omitempty"` Log struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"log"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"log,omitempty"` Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` BlueTestSummary struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"blueTestSummary"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"blueTestSummary,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` Steps struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"steps"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"steps,omitempty"` Artifacts struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"artifacts"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"artifacts,omitempty"` NextRun struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"nextRun"` - } `json:"_links"` - Actions []interface{} `json:"actions"` - ArtifactsZipFile interface{} `json:"artifactsZipFile"` - CauseOfBlockage interface{} `json:"causeOfBlockage"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"nextRun,omitempty"` + } `json:"_links,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + ArtifactsZipFile interface{} `json:"artifactsZipFile,omitempty"` + CauseOfBlockage interface{} `json:"causeOfBlockage,omitempty"` Causes []struct { - Class string `json:"_class"` - ShortDescription string `json:"shortDescription"` - UserID string `json:"userId"` - UserName string `json:"userName"` - } `json:"causes"` - ChangeSet []interface{} `json:"changeSet"` - Description interface{} `json:"description"` - DurationInMillis int `json:"durationInMillis"` - EnQueueTime string `json:"enQueueTime"` - EndTime string `json:"endTime"` - EstimatedDurationInMillis int `json:"estimatedDurationInMillis"` - ID string `json:"id"` - Name interface{} `json:"name"` - Organization string `json:"organization"` - Pipeline string `json:"pipeline"` - Replayable bool `json:"replayable"` - Result string `json:"result"` - RunSummary string `json:"runSummary"` - StartTime string `json:"startTime"` - State string `json:"state"` - Type string `json:"type"` + Class string `json:"_class,omitempty"` + ShortDescription string `json:"shortDescription,omitempty"` + UserID string `json:"userId,omitempty"` + UserName string `json:"userName,omitempty"` + } `json:"causes,omitempty"` + ChangeSet []interface{} `json:"changeSet,omitempty"` + Description interface{} `json:"description,omitempty"` + DurationInMillis int `json:"durationInMillis,omitempty"` + EnQueueTime string `json:"enQueueTime,omitempty"` + EndTime string `json:"endTime,omitempty"` + EstimatedDurationInMillis int `json:"estimatedDurationInMillis,omitempty"` + ID string `json:"id,omitempty"` + Name interface{} `json:"name,omitempty"` + Organization string `json:"organization,omitempty"` + Pipeline string `json:"pipeline,omitempty"` + Replayable bool `json:"replayable,omitempty"` + Result string `json:"result,omitempty"` + RunSummary string `json:"runSummary,omitempty"` + StartTime string `json:"startTime,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` Branch struct { - IsPrimary bool `json:"isPrimary"` - Issues []interface{} `json:"issues"` - URL string `json:"url"` - } `json:"branch"` - CommitID string `json:"commitId"` - CommitURL interface{} `json:"commitUrl"` - PullRequest interface{} `json:"pullRequest"` + IsPrimary bool `json:"isPrimary,omitempty"` + Issues []interface{} `json:"issues,omitempty"` + URL string `json:"url,omitempty"` + } `json:"branch,omitempty"` + CommitID string `json:"commitId,omitempty"` + CommitURL interface{} `json:"commitUrl,omitempty"` + PullRequest interface{} `json:"pullRequest,omitempty"` } // GetBranchPipeRunNodes -type BranchPipeRunNodes struct { - Class string `json:"_class"` +type BranchPipelineRunNodes struct { + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` Steps struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"steps"` - } `json:"_links"` - Actions []interface{} `json:"actions"` - DisplayDescription interface{} `json:"displayDescription"` - DisplayName string `json:"displayName"` - DurationInMillis int `json:"durationInMillis"` - ID string `json:"id"` - Input interface{} `json:"input"` - Result string `json:"result"` - StartTime string `json:"startTime"` - State string `json:"state"` - Type string `json:"type"` - CauseOfBlockage interface{} `json:"causeOfBlockage"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"steps,omitempty"` + } `json:"_links,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + DisplayDescription interface{} `json:"displayDescription,omitempty"` + DisplayName string `json:"displayName,omitempty"` + DurationInMillis int `json:"durationInMillis,omitempty"` + ID string `json:"id,omitempty"` + Input interface{} `json:"input,omitempty"` + Result string `json:"result,omitempty"` + StartTime string `json:"startTime,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` + CauseOfBlockage interface{} `json:"causeOfBlockage,omitempty"` Edges []struct { - Class string `json:"_class"` - ID string `json:"id"` - Type string `json:"type"` - } `json:"edges"` - FirstParent interface{} `json:"firstParent"` - Restartable bool `json:"restartable"` + Class string `json:"_class,omitempty"` + ID string `json:"id,omitempty"` + Type string `json:"type,omitempty"` + } `json:"edges,omitempty"` + FirstParent interface{} `json:"firstParent,omitempty"` + Restartable bool `json:"restartable,omitempty"` Steps []struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` - } `json:"_links"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` + } `json:"_links,omitempty"` Actions []struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` - } `json:"_links"` - URLName string `json:"urlName"` - } `json:"actions"` - DisplayDescription interface{} `json:"displayDescription"` - DisplayName string `json:"displayName"` - DurationInMillis int `json:"durationInMillis"` - ID string `json:"id"` - Input interface{} `json:"input"` - Result string `json:"result"` - StartTime string `json:"startTime"` - State string `json:"state"` - Type string `json:"type"` - } `json:"steps"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` + } `json:"_links,omitempty"` + URLName string `json:"urlName,omitempty"` + } `json:"actions,omitempty"` + DisplayDescription interface{} `json:"displayDescription,omitempty"` + DisplayName string `json:"displayName,omitempty"` + DurationInMillis int `json:"durationInMillis,omitempty"` + ID string `json:"id,omitempty"` + Input interface{} `json:"input,omitempty"` + Result string `json:"result,omitempty"` + StartTime string `json:"startTime,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` + } `json:"steps,omitempty"` } // Validate @@ -244,474 +244,474 @@ type Validates struct { // GetSCMOrg type SCMOrg struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Repositories struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"repositories"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"repositories,omitempty"` Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` - } `json:"_links"` - Avatar string `json:"avatar"` - JenkinsOrganizationPipeline bool `json:"jenkinsOrganizationPipeline"` - Name string `json:"name"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` + } `json:"_links,omitempty"` + Avatar string `json:"avatar,omitempty"` + JenkinsOrganizationPipeline bool `json:"jenkinsOrganizationPipeline,omitempty"` + Name string `json:"name,omitempty"` } // GetOrgRepo type OrgRepo struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` - } `json:"_links"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` + } `json:"_links,omitempty"` Repositories struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` - } `json:"_links"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` + } `json:"_links,omitempty"` Items []struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` - } `json:"_links"` - DefaultBranch string `json:"defaultBranch"` - Description string `json:"description"` - Name string `json:"name"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` + } `json:"_links,omitempty"` + DefaultBranch string `json:"defaultBranch,omitempty"` + Description string `json:"description,omitempty"` + Name string `json:"name,omitempty"` Permissions struct { - Admin bool `json:"admin"` - Push bool `json:"push"` - Pull bool `json:"pull"` - } `json:"permissions"` - Private bool `json:"private"` - FullName string `json:"fullName"` - } `json:"items"` - LastPage interface{} `json:"lastPage"` - NextPage interface{} `json:"nextPage"` - PageSize int `json:"pageSize"` - } `json:"repositories"` + Admin bool `json:"admin,omitempty"` + Push bool `json:"push,omitempty"` + Pull bool `json:"pull,omitempty"` + } `json:"permissions,omitempty"` + Private bool `json:"private,omitempty"` + FullName string `json:"fullName,omitempty"` + } `json:"items,omitempty"` + LastPage interface{} `json:"lastPage,omitempty"` + NextPage interface{} `json:"nextPage,omitempty"` + PageSize int `json:"pageSize,omitempty"` + } `json:"repositories,omitempty"` } // StopPipeline type StopPipe struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Parent struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"parent"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"parent,omitempty"` Tests struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"tests"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"tests,omitempty"` Nodes struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"nodes"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"nodes,omitempty"` Log struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"log"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"log,omitempty"` Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` BlueTestSummary struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"blueTestSummary"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"blueTestSummary,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` Steps struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"steps"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"steps,omitempty"` Artifacts struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"artifacts"` - } `json:"_links"` - Actions []interface{} `json:"actions"` - ArtifactsZipFile interface{} `json:"artifactsZipFile"` - CauseOfBlockage interface{} `json:"causeOfBlockage"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"artifacts,omitempty"` + } `json:"_links,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + ArtifactsZipFile interface{} `json:"artifactsZipFile,omitempty"` + CauseOfBlockage interface{} `json:"causeOfBlockage,omitempty"` Causes []struct { - Class string `json:"_class"` - ShortDescription string `json:"shortDescription"` - } `json:"causes"` - ChangeSet []interface{} `json:"changeSet"` - Description interface{} `json:"description"` - DurationInMillis int `json:"durationInMillis"` - EnQueueTime string `json:"enQueueTime"` - EndTime string `json:"endTime"` - EstimatedDurationInMillis int `json:"estimatedDurationInMillis"` - ID string `json:"id"` - Name interface{} `json:"name"` - Organization string `json:"organization"` - Pipeline string `json:"pipeline"` - Replayable bool `json:"replayable"` - Result string `json:"result"` - RunSummary string `json:"runSummary"` - StartTime string `json:"startTime"` - State string `json:"state"` - Type string `json:"type"` + Class string `json:"_class,omitempty"` + ShortDescription string `json:"shortDescription,omitempty"` + } `json:"causes,omitempty"` + ChangeSet []interface{} `json:"changeSet,omitempty"` + Description interface{} `json:"description,omitempty"` + DurationInMillis int `json:"durationInMillis,omitempty"` + EnQueueTime string `json:"enQueueTime,omitempty"` + EndTime string `json:"endTime,omitempty"` + EstimatedDurationInMillis int `json:"estimatedDurationInMillis,omitempty"` + ID string `json:"id,omitempty"` + Name interface{} `json:"name,omitempty"` + Organization string `json:"organization,omitempty"` + Pipeline string `json:"pipeline,omitempty"` + Replayable bool `json:"replayable,omitempty"` + Result string `json:"result,omitempty"` + RunSummary string `json:"runSummary,omitempty"` + StartTime string `json:"startTime,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` Branch struct { - IsPrimary bool `json:"isPrimary"` - Issues []interface{} `json:"issues"` - URL string `json:"url"` - } `json:"branch"` - CommitID string `json:"commitId"` - CommitURL interface{} `json:"commitUrl"` - PullRequest interface{} `json:"pullRequest"` + IsPrimary bool `json:"isPrimary,omitempty"` + Issues []interface{} `json:"issues,omitempty"` + URL string `json:"url,omitempty"` + } `json:"branch,omitempty"` + CommitID string `json:"commitId,omitempty"` + CommitURL interface{} `json:"commitUrl,omitempty"` + PullRequest interface{} `json:"pullRequest,omitempty"` } // ReplayPipeline type ReplayPipe struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Parent struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"parent"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"parent,omitempty"` Tests struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"tests"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"tests,omitempty"` Log struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"log"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"log,omitempty"` Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` BlueTestSummary struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"blueTestSummary"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"blueTestSummary,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` Artifacts struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"artifacts"` - } `json:"_links"` - Actions []interface{} `json:"actions"` - ArtifactsZipFile interface{} `json:"artifactsZipFile"` - CauseOfBlockage string `json:"causeOfBlockage"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"artifacts,omitempty"` + } `json:"_links,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + ArtifactsZipFile interface{} `json:"artifactsZipFile,omitempty"` + CauseOfBlockage string `json:"causeOfBlockage,omitempty"` Causes []struct { - Class string `json:"_class"` - ShortDescription string `json:"shortDescription"` + Class string `json:"_class,omitempty"` + ShortDescription string `json:"shortDescription,omitempty"` UserID string `json:"userId,omitempty"` UserName string `json:"userName,omitempty"` - } `json:"causes"` - ChangeSet []interface{} `json:"changeSet"` - Description interface{} `json:"description"` - DurationInMillis interface{} `json:"durationInMillis"` - EnQueueTime interface{} `json:"enQueueTime"` - EndTime interface{} `json:"endTime"` - EstimatedDurationInMillis interface{} `json:"estimatedDurationInMillis"` - ID string `json:"id"` - Name interface{} `json:"name"` - Organization string `json:"organization"` - Pipeline string `json:"pipeline"` - Replayable bool `json:"replayable"` - Result string `json:"result"` - RunSummary interface{} `json:"runSummary"` - StartTime interface{} `json:"startTime"` - State string `json:"state"` - Type string `json:"type"` - QueueID string `json:"queueId"` + } `json:"causes,omitempty"` + ChangeSet []interface{} `json:"changeSet,omitempty"` + Description interface{} `json:"description,omitempty"` + DurationInMillis interface{} `json:"durationInMillis,omitempty"` + EnQueueTime interface{} `json:"enQueueTime,omitempty"` + EndTime interface{} `json:"endTime,omitempty"` + EstimatedDurationInMillis interface{} `json:"estimatedDurationInMillis,omitempty"` + ID string `json:"id,omitempty"` + Name interface{} `json:"name,omitempty"` + Organization string `json:"organization,omitempty"` + Pipeline string `json:"pipeline,omitempty"` + Replayable bool `json:"replayable,omitempty"` + Result string `json:"result,omitempty"` + RunSummary interface{} `json:"runSummary,omitempty"` + StartTime interface{} `json:"startTime,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` + QueueID string `json:"queueId,omitempty"` } // GetArtifacts type Artifacts struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` - } `json:"_links"` - Downloadable bool `json:"downloadable"` - ID string `json:"id"` - Name string `json:"name"` - Path string `json:"path"` - Size int `json:"size"` - URL string `json:"url"` // The url for Download artifacts + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` + } `json:"_links,omitempty"` + Downloadable bool `json:"downloadable,omitempty"` + ID string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Path string `json:"path,omitempty"` + Size int `json:"size,omitempty"` + URL string `json:"url,omitempty"` // The url for Download artifacts } // GetPipeBranch type PipeBranch struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` Scm struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"scm"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"scm,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` Runs struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"runs"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"runs,omitempty"` Trends struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"trends"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"trends,omitempty"` Queue struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"queue"` - } `json:"_links"` - Actions []interface{} `json:"actions"` - Disabled bool `json:"disabled"` - DisplayName string `json:"displayName"` - EstimatedDurationInMillis int `json:"estimatedDurationInMillis"` - FullDisplayName string `json:"fullDisplayName"` - FullName string `json:"fullName"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"queue,omitempty"` + } `json:"_links,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + Disabled bool `json:"disabled,omitempty"` + DisplayName string `json:"displayName,omitempty"` + EstimatedDurationInMillis int `json:"estimatedDurationInMillis,omitempty"` + FullDisplayName string `json:"fullDisplayName,omitempty"` + FullName string `json:"fullName,omitempty"` LatestRun struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { PrevRun struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"prevRun"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"prevRun,omitempty"` Parent struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"parent"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"parent,omitempty"` Tests struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"tests"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"tests,omitempty"` Log struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"log"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"log,omitempty"` Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` BlueTestSummary struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"blueTestSummary"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"blueTestSummary,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` Artifacts struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"artifacts"` - } `json:"_links"` - Actions []interface{} `json:"actions"` - ArtifactsZipFile string `json:"artifactsZipFile"` - CauseOfBlockage interface{} `json:"causeOfBlockage"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"artifacts,omitempty"` + } `json:"_links,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + ArtifactsZipFile string `json:"artifactsZipFile,omitempty"` + CauseOfBlockage interface{} `json:"causeOfBlockage,omitempty"` Causes []struct { - Class string `json:"_class"` - ShortDescription string `json:"shortDescription"` - } `json:"causes"` - ChangeSet []interface{} `json:"changeSet"` - Description interface{} `json:"description"` - DurationInMillis int `json:"durationInMillis"` - EnQueueTime string `json:"enQueueTime"` - EndTime string `json:"endTime"` - EstimatedDurationInMillis int `json:"estimatedDurationInMillis"` - ID string `json:"id"` - Name interface{} `json:"name"` - Organization string `json:"organization"` - Pipeline string `json:"pipeline"` - Replayable bool `json:"replayable"` - Result string `json:"result"` - RunSummary string `json:"runSummary"` - StartTime string `json:"startTime"` - State string `json:"state"` - Type string `json:"type"` - } `json:"latestRun"` - Name string `json:"name"` - Organization string `json:"organization"` + Class string `json:"_class,omitempty"` + ShortDescription string `json:"shortDescription,omitempty"` + } `json:"causes,omitempty"` + ChangeSet []interface{} `json:"changeSet,omitempty"` + Description interface{} `json:"description,omitempty"` + DurationInMillis int `json:"durationInMillis,omitempty"` + EnQueueTime string `json:"enQueueTime,omitempty"` + EndTime string `json:"endTime,omitempty"` + EstimatedDurationInMillis int `json:"estimatedDurationInMillis,omitempty"` + ID string `json:"id,omitempty"` + Name interface{} `json:"name,omitempty"` + Organization string `json:"organization,omitempty"` + Pipeline string `json:"pipeline,omitempty"` + Replayable bool `json:"replayable,omitempty"` + Result string `json:"result,omitempty"` + RunSummary string `json:"runSummary,omitempty"` + StartTime string `json:"startTime,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` + } `json:"latestRun,omitempty"` + Name string `json:"name,omitempty"` + Organization string `json:"organization,omitempty"` Parameters []struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` DefaultParameterValue struct { - Class string `json:"_class"` - Name string `json:"name"` - Value string `json:"value"` - } `json:"defaultParameterValue"` - Description string `json:"description"` - Name string `json:"name"` - Type string `json:"type"` - } `json:"parameters"` + Class string `json:"_class,omitempty"` + Name string `json:"name,omitempty"` + Value string `json:"value,omitempty"` + } `json:"defaultParameterValue,omitempty"` + Description string `json:"description,omitempty"` + Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` + } `json:"parameters,omitempty"` Permissions struct { - Create bool `json:"create"` - Configure bool `json:"configure"` - Read bool `json:"read"` - Start bool `json:"start"` - Stop bool `json:"stop"` - } `json:"permissions"` - WeatherScore int `json:"weatherScore"` + Create bool `json:"create,omitempty"` + Configure bool `json:"configure,omitempty"` + Read bool `json:"read,omitempty"` + Start bool `json:"start,omitempty"` + Stop bool `json:"stop,omitempty"` + } `json:"permissions,omitempty"` + WeatherScore int `json:"weatherScore,omitempty"` Branch struct { - IsPrimary bool `json:"isPrimary"` - Issues []interface{} `json:"issues"` - URL string `json:"url"` - } `json:"branch"` + IsPrimary bool `json:"isPrimary,omitempty"` + Issues []interface{} `json:"issues,omitempty"` + URL string `json:"url,omitempty"` + } `json:"branch,omitempty"` } // RunPipeline type RunPayload struct { Parameters []struct { - Name string `json:"name"` - Value string `json:"value"` - } `json:"parameters"` + Name string `json:"name,omitempty"` + Value string `json:"value,omitempty"` + } `json:"parameters,omitempty"` } type QueuedBlueRun struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Parent struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"parent"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"parent,omitempty"` Tests struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"tests"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"tests,omitempty"` Log struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"log"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"log,omitempty"` Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` BlueTestSummary struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"blueTestSummary"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"blueTestSummary,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` Artifacts struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"artifacts"` - } `json:"_links"` - Actions []interface{} `json:"actions"` - ArtifactsZipFile interface{} `json:"artifactsZipFile"` - CauseOfBlockage string `json:"causeOfBlockage"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"artifacts,omitempty"` + } `json:"_links,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + ArtifactsZipFile interface{} `json:"artifactsZipFile,omitempty"` + CauseOfBlockage string `json:"causeOfBlockage,omitempty"` Causes []struct { - Class string `json:"_class"` - ShortDescription string `json:"shortDescription"` - UserID string `json:"userId"` - UserName string `json:"userName"` - } `json:"causes"` - ChangeSet []interface{} `json:"changeSet"` - Description interface{} `json:"description"` - DurationInMillis interface{} `json:"durationInMillis"` - EnQueueTime interface{} `json:"enQueueTime"` - EndTime interface{} `json:"endTime"` - EstimatedDurationInMillis interface{} `json:"estimatedDurationInMillis"` - ID string `json:"id"` - Name interface{} `json:"name"` - Organization string `json:"organization"` - Pipeline string `json:"pipeline"` - Replayable bool `json:"replayable"` - Result string `json:"result"` - RunSummary interface{} `json:"runSummary"` - StartTime interface{} `json:"startTime"` - State string `json:"state"` - Type string `json:"type"` - QueueID string `json:"queueId"` + Class string `json:"_class,omitempty"` + ShortDescription string `json:"shortDescription,omitempty"` + UserID string `json:"userId,omitempty"` + UserName string `json:"userName,omitempty"` + } `json:"causes,omitempty"` + ChangeSet []interface{} `json:"changeSet,omitempty"` + Description interface{} `json:"description,omitempty"` + DurationInMillis interface{} `json:"durationInMillis,omitempty"` + EnQueueTime interface{} `json:"enQueueTime,omitempty"` + EndTime interface{} `json:"endTime,omitempty"` + EstimatedDurationInMillis interface{} `json:"estimatedDurationInMillis,omitempty"` + ID string `json:"id,omitempty"` + Name interface{} `json:"name,omitempty"` + Organization string `json:"organization,omitempty"` + Pipeline string `json:"pipeline,omitempty"` + Replayable bool `json:"replayable,omitempty"` + Result string `json:"result,omitempty"` + RunSummary interface{} `json:"runSummary,omitempty"` + StartTime interface{} `json:"startTime,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` + QueueID string `json:"queueId,omitempty"` } // GetNodeStatus -type NodeStatus []struct { - Class string `json:"_class"` +type NodeStatus struct { + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` Steps struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"steps"` - } `json:"_links"` - Actions []interface{} `json:"actions"` - DisplayDescription interface{} `json:"displayDescription"` - DisplayName string `json:"displayName"` - DurationInMillis int `json:"durationInMillis"` - ID string `json:"id"` - Input interface{} `json:"input"` - Result string `json:"result"` - StartTime string `json:"startTime"` - State string `json:"state"` - Type string `json:"type"` - CauseOfBlockage interface{} `json:"causeOfBlockage"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"steps,omitempty"` + } `json:"_links,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + DisplayDescription interface{} `json:"displayDescription,omitempty"` + DisplayName string `json:"displayName,omitempty"` + DurationInMillis int `json:"durationInMillis,omitempty"` + ID string `json:"id,omitempty"` + Input interface{} `json:"input,omitempty"` + Result string `json:"result,omitempty"` + StartTime string `json:"startTime,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` + CauseOfBlockage interface{} `json:"causeOfBlockage,omitempty"` Edges []struct { - Class string `json:"_class"` - ID string `json:"id"` - Type string `json:"type"` - } `json:"edges"` - FirstParent interface{} `json:"firstParent"` - Restartable bool `json:"restartable"` + Class string `json:"_class,omitempty"` + ID string `json:"id,omitempty"` + Type string `json:"type,omitempty"` + } `json:"edges,omitempty"` + FirstParent interface{} `json:"firstParent,omitempty"` + Restartable bool `json:"restartable,omitempty"` Steps []struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` - } `json:"_links"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` + } `json:"_links,omitempty"` Actions []struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` - } `json:"_links"` - URLName string `json:"urlName"` - } `json:"actions"` - DisplayDescription interface{} `json:"displayDescription"` - DisplayName string `json:"displayName"` - DurationInMillis int `json:"durationInMillis"` - ID string `json:"id"` - Input interface{} `json:"input"` - Result string `json:"result"` - StartTime string `json:"startTime"` - State string `json:"state"` - Type string `json:"type"` - } `json:"steps"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` + } `json:"_links,omitempty"` + URLName string `json:"urlName,omitempty"` + } `json:"actions,omitempty"` + DisplayDescription interface{} `json:"displayDescription,omitempty"` + DisplayName string `json:"displayName,omitempty"` + DurationInMillis int `json:"durationInMillis,omitempty"` + ID string `json:"id,omitempty"` + Input interface{} `json:"input,omitempty"` + Result string `json:"result,omitempty"` + StartTime string `json:"startTime,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` + } `json:"steps,omitempty"` } // CheckPipeline @@ -726,296 +726,296 @@ type CheckPlayload struct { // Getcrumb type Crumb struct { - Class string `json:"_class"` - Crumb string `json:"crumb"` - CrumbRequestField string `json:"crumbRequestField"` + Class string `json:"_class,omitempty"` + Crumb string `json:"crumb,omitempty"` + CrumbRequestField string `json:"crumbRequestField,omitempty"` } // CheckScriptCompile type CheckScript struct { - Column int `json:"column"` - Line int `json:"line"` - Message string `json:"message"` - Status string `json:"status"` + Column int `json:"column,omitempty"` + Line int `json:"line,omitempty"` + Message string `json:"message,omitempty"` + Status string `json:"status,omitempty"` } // CheckCron type CheckCronRes struct { - Result string `json:"result"` - Message string `json:"message"` + Result string `json:"result,omitempty"` + Message string `json:"message,omitempty"` } // GetPipelineRun type PipelineRun struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { PrevRun struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"prevRun"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"prevRun,omitempty"` Parent struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"parent"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"parent,omitempty"` Tests struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"tests"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"tests,omitempty"` Nodes struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"nodes"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"nodes,omitempty"` Log struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"log"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"log,omitempty"` Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` BlueTestSummary struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"blueTestSummary"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"blueTestSummary,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` Steps struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"steps"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"steps,omitempty"` Artifacts struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"artifacts"` - } `json:"_links"` - Actions []interface{} `json:"actions"` - ArtifactsZipFile interface{} `json:"artifactsZipFile"` - CauseOfBlockage interface{} `json:"causeOfBlockage"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"artifacts,omitempty"` + } `json:"_links,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + ArtifactsZipFile interface{} `json:"artifactsZipFile,omitempty"` + CauseOfBlockage interface{} `json:"causeOfBlockage,omitempty"` Causes []struct { - Class string `json:"_class"` - ShortDescription string `json:"shortDescription"` - UserID string `json:"userId"` - UserName string `json:"userName"` - } `json:"causes"` - ChangeSet []interface{} `json:"changeSet"` - Description interface{} `json:"description"` - DurationInMillis int `json:"durationInMillis"` - EnQueueTime string `json:"enQueueTime"` - EndTime string `json:"endTime"` - EstimatedDurationInMillis int `json:"estimatedDurationInMillis"` - ID string `json:"id"` - Name interface{} `json:"name"` - Organization string `json:"organization"` - Pipeline string `json:"pipeline"` - Replayable bool `json:"replayable"` - Result string `json:"result"` - RunSummary string `json:"runSummary"` - StartTime string `json:"startTime"` - State string `json:"state"` - Type string `json:"type"` - Branch interface{} `json:"branch"` - CommitID interface{} `json:"commitId"` - CommitURL interface{} `json:"commitUrl"` - PullRequest interface{} `json:"pullRequest"` + Class string `json:"_class,omitempty"` + ShortDescription string `json:"shortDescription,omitempty"` + UserID string `json:"userId,omitempty"` + UserName string `json:"userName,omitempty"` + } `json:"causes,omitempty"` + ChangeSet []interface{} `json:"changeSet,omitempty"` + Description interface{} `json:"description,omitempty"` + DurationInMillis int `json:"durationInMillis,omitempty"` + EnQueueTime string `json:"enQueueTime,omitempty"` + EndTime string `json:"endTime,omitempty"` + EstimatedDurationInMillis int `json:"estimatedDurationInMillis,omitempty"` + ID string `json:"id,omitempty"` + Name interface{} `json:"name,omitempty"` + Organization string `json:"organization,omitempty"` + Pipeline string `json:"pipeline,omitempty"` + Replayable bool `json:"replayable,omitempty"` + Result string `json:"result,omitempty"` + RunSummary string `json:"runSummary,omitempty"` + StartTime string `json:"startTime,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` + Branch interface{} `json:"branch,omitempty"` + CommitID interface{} `json:"commitId,omitempty"` + CommitURL interface{} `json:"commitUrl,omitempty"` + PullRequest interface{} `json:"pullRequest,omitempty"` } // GetBranchPipeRun -type BranchPipe struct { - Class string `json:"_class"` +type BranchPipeline struct { + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` Scm struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"scm"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"scm,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` Runs struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"runs"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"runs,omitempty"` Trends struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"trends"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"trends,omitempty"` Queue struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"queue"` - } `json:"_links"` - Actions []interface{} `json:"actions"` - Disabled bool `json:"disabled"` - DisplayName string `json:"displayName"` - EstimatedDurationInMillis int `json:"estimatedDurationInMillis"` - FullDisplayName string `json:"fullDisplayName"` - FullName string `json:"fullName"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"queue,omitempty"` + } `json:"_links,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + Disabled bool `json:"disabled,omitempty"` + DisplayName string `json:"displayName,omitempty"` + EstimatedDurationInMillis int `json:"estimatedDurationInMillis,omitempty"` + FullDisplayName string `json:"fullDisplayName,omitempty"` + FullName string `json:"fullName,omitempty"` LatestRun struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { PrevRun struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"prevRun"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"prevRun,omitempty"` Parent struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"parent"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"parent,omitempty"` Tests struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"tests"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"tests,omitempty"` Log struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"log"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"log,omitempty"` Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` BlueTestSummary struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"blueTestSummary"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"blueTestSummary,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` Artifacts struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"artifacts"` - } `json:"_links"` - Actions []interface{} `json:"actions"` - ArtifactsZipFile string `json:"artifactsZipFile"` - CauseOfBlockage interface{} `json:"causeOfBlockage"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"artifacts,omitempty"` + } `json:"_links,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + ArtifactsZipFile string `json:"artifactsZipFile,omitempty"` + CauseOfBlockage interface{} `json:"causeOfBlockage,omitempty"` Causes []struct { - Class string `json:"_class"` - ShortDescription string `json:"shortDescription"` - UserID string `json:"userId"` - UserName string `json:"userName"` - } `json:"causes"` - ChangeSet []interface{} `json:"changeSet"` - Description interface{} `json:"description"` - DurationInMillis int `json:"durationInMillis"` - EnQueueTime string `json:"enQueueTime"` - EndTime string `json:"endTime"` - EstimatedDurationInMillis int `json:"estimatedDurationInMillis"` - ID string `json:"id"` - Name interface{} `json:"name"` - Organization string `json:"organization"` - Pipeline string `json:"pipeline"` - Replayable bool `json:"replayable"` - Result string `json:"result"` - RunSummary string `json:"runSummary"` - StartTime string `json:"startTime"` - State string `json:"state"` - Type string `json:"type"` - } `json:"latestRun"` - Name string `json:"name"` - Organization string `json:"organization"` + Class string `json:"_class,omitempty"` + ShortDescription string `json:"shortDescription,omitempty"` + UserID string `json:"userId,omitempty"` + UserName string `json:"userName,omitempty"` + } `json:"causes,omitempty"` + ChangeSet []interface{} `json:"changeSet,omitempty"` + Description interface{} `json:"description,omitempty"` + DurationInMillis int `json:"durationInMillis,omitempty"` + EnQueueTime string `json:"enQueueTime,omitempty"` + EndTime string `json:"endTime,omitempty"` + EstimatedDurationInMillis int `json:"estimatedDurationInMillis,omitempty"` + ID string `json:"id,omitempty"` + Name interface{} `json:"name,omitempty"` + Organization string `json:"organization,omitempty"` + Pipeline string `json:"pipeline,omitempty"` + Replayable bool `json:"replayable,omitempty"` + Result string `json:"result,omitempty"` + RunSummary string `json:"runSummary,omitempty"` + StartTime string `json:"startTime,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` + } `json:"latestRun,omitempty"` + Name string `json:"name,omitempty"` + Organization string `json:"organization,omitempty"` Parameters []struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` DefaultParameterValue struct { - Class string `json:"_class"` - Name string `json:"name"` - Value string `json:"value"` - } `json:"defaultParameterValue"` - Description string `json:"description"` - Name string `json:"name"` - Type string `json:"type"` - } `json:"parameters"` + Class string `json:"_class,omitempty"` + Name string `json:"name,omitempty"` + Value string `json:"value,omitempty"` + } `json:"defaultParameterValue,omitempty"` + Description string `json:"description,omitempty"` + Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` + } `json:"parameters,omitempty"` Permissions struct { - Create bool `json:"create"` - Configure bool `json:"configure"` - Read bool `json:"read"` - Start bool `json:"start"` - Stop bool `json:"stop"` - } `json:"permissions"` - WeatherScore int `json:"weatherScore"` + Create bool `json:"create,omitempty"` + Configure bool `json:"configure,omitempty"` + Read bool `json:"read,omitempty"` + Start bool `json:"start,omitempty"` + Stop bool `json:"stop,omitempty"` + } `json:"permissions,omitempty"` + WeatherScore int `json:"weatherScore,omitempty"` Branch struct { - IsPrimary bool `json:"isPrimary"` - Issues []interface{} `json:"issues"` - URL string `json:"url"` - } `json:"branch"` + IsPrimary bool `json:"isPrimary,omitempty"` + Issues []interface{} `json:"issues,omitempty"` + URL string `json:"url,omitempty"` + } `json:"branch,omitempty"` } // GetPipeRunNodes -type PipeRunNodes []struct { - Class string `json:"_class"` +type PipelineRunNodes struct { + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` Steps struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"steps"` - } `json:"_links"` - Actions []interface{} `json:"actions"` - DisplayDescription interface{} `json:"displayDescription"` - DisplayName string `json:"displayName"` - DurationInMillis int `json:"durationInMillis"` - ID string `json:"id"` - Input interface{} `json:"input"` - Result string `json:"result"` - StartTime string `json:"startTime"` - State string `json:"state"` - Type string `json:"type"` - CauseOfBlockage interface{} `json:"causeOfBlockage"` - Edges []interface{} `json:"edges"` - FirstParent interface{} `json:"firstParent"` - Restartable bool `json:"restartable"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"steps,omitempty"` + } `json:"_links,omitempty"` + Actions []interface{} `json:"actions,omitempty"` + DisplayDescription interface{} `json:"displayDescription,omitempty"` + DisplayName string `json:"displayName,omitempty"` + DurationInMillis int `json:"durationInMillis,omitempty"` + ID string `json:"id,omitempty"` + Input interface{} `json:"input,omitempty"` + Result string `json:"result,omitempty"` + StartTime string `json:"startTime,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` + CauseOfBlockage interface{} `json:"causeOfBlockage,omitempty"` + Edges []interface{} `json:"edges,omitempty"` + FirstParent interface{} `json:"firstParent,omitempty"` + Restartable bool `json:"restartable,omitempty"` } // GetNodeSteps -type NodeSteps []struct { - Class string `json:"_class"` +type NodeSteps struct { + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` Actions struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"actions"` - } `json:"_links"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"actions,omitempty"` + } `json:"_links,omitempty"` Actions []struct { - Class string `json:"_class"` + Class string `json:"_class,omitempty"` Links struct { Self struct { - Class string `json:"_class"` - Href string `json:"href"` - } `json:"self"` - } `json:"_links"` - URLName string `json:"urlName"` - } `json:"actions"` - DisplayDescription string `json:"displayDescription"` - DisplayName string `json:"displayName"` - DurationInMillis int `json:"durationInMillis"` - ID string `json:"id"` - Input interface{} `json:"input"` - Result string `json:"result"` - StartTime string `json:"startTime"` - State string `json:"state"` - Type string `json:"type"` + Class string `json:"_class,omitempty"` + Href string `json:"href,omitempty"` + } `json:"self,omitempty"` + } `json:"_links,omitempty"` + URLName string `json:"urlName,omitempty"` + } `json:"actions,omitempty"` + DisplayDescription string `json:"displayDescription,omitempty"` + DisplayName string `json:"displayName,omitempty"` + DurationInMillis int `json:"durationInMillis,omitempty"` + ID string `json:"id,omitempty"` + Input interface{} `json:"input,omitempty"` + Result string `json:"result,omitempty"` + StartTime string `json:"startTime,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` } // ToJenkinsfile requests type ReqJson struct { - Json string `json:"json"` + Json string `json:"json,omitempty"` } // ToJenkinsfile response @@ -1032,7 +1032,7 @@ type ResJenkinsfile struct { } type ReqJenkinsfile struct { - Jenkinsfile string `json:"jenkinsfile"` + Jenkinsfile string `json:"jenkinsfile,omitempty"` } type ResJson struct { diff --git a/pkg/models/devops/urlconfig.go b/pkg/models/devops/urlconfig.go index 56e53ab4a..545b6f3fc 100644 --- a/pkg/models/devops/urlconfig.go +++ b/pkg/models/devops/urlconfig.go @@ -47,4 +47,6 @@ const ( GetNodeStepsUrl = "/blue/rest/organizations/jenkins/pipelines/%s/%s/branches/%s/runs/%s/nodes/%s/steps/?" ToJenkinsfileUrl = "/pipeline-model-converter/toJenkinsfile" ToJsonUrl = "/pipeline-model-converter/toJson" + GetNotifyCommitUrl = "/git/notifyCommit/?" + GithubWebhookUrl = "/github-webhook/" )