fix devops api import error

Signed-off-by: runzexia <runzexia@yunify.com>
This commit is contained in:
runzexia
2019-06-10 11:47:30 +08:00
committed by zryfish
parent 3e2693739d
commit e86b2a4dcc
3 changed files with 15 additions and 7 deletions

View File

@@ -220,12 +220,12 @@ func addWebService(c *restful.Container) error {
Reads([]devops.JenkinsCredential{}))
// match Jenkisn api "/blue/rest/organizations/jenkins/pipelines/{projectName}/{pipelineName}"
webservice.Route(webservice.GET("/devops/{projectName}/pipelines/{pipelineName}").
webservice.Route(webservice.GET("/devops/{devops}/pipelines/{pipelines}").
To(devopsapi.GetPipeline).
Metadata(restfulspec.KeyOpenAPITags, tags).
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.")).
Param(webservice.PathParameter("pipelines", "the name of pipeline, which helps to deliver continuous integration continuous deployment.")).
Param(webservice.PathParameter("devops", "the name of devops project.")).
Returns(http.StatusOK, RespOK, devops.Pipeline{}).
Writes(devops.Pipeline{}))
@@ -752,7 +752,7 @@ func addWebService(c *restful.Container) error {
// Gitlab or some other scm managers can only use HTTP method. match /git/notifyCommit/?url=
webservice.Route(webservice.POST("/devops/notifycommit").
To(devopsapi.GetNotifyCommit).
To(devopsapi.PostNotifyCommit).
Metadata(restfulspec.KeyOpenAPITags, tags).
Doc("Get notify commit by HTTP POST method.").
Consumes("application/json").

View File

@@ -585,6 +585,14 @@ func GetNotifyCommit(req *restful.Request, resp *restful.Response) {
resp.Write(res)
}
func PostNotifyCommit(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 {

View File

@@ -26,12 +26,12 @@ import (
"github.com/emicklei/go-restful-openapi"
"github.com/go-openapi/spec"
"io/ioutil"
_ "kubesphere.io/kubesphere/pkg/apis/iam/install"
_ "kubesphere.io/kubesphere/pkg/apis/logging/install"
"kubesphere.io/kubesphere/pkg/apiserver/runtime"
"log"
// Install apis
_ "kubesphere.io/kubesphere/pkg/apis/devops/install"
_ "kubesphere.io/kubesphere/pkg/apis/iam/install"
_ "kubesphere.io/kubesphere/pkg/apis/logging/install"
_ "kubesphere.io/kubesphere/pkg/apis/monitoring/install"
_ "kubesphere.io/kubesphere/pkg/apis/operations/install"
_ "kubesphere.io/kubesphere/pkg/apis/resources/install"
@@ -78,7 +78,7 @@ func enrichSwaggerObject(swo *spec.Swagger) {
Contact: &spec.ContactInfo{
Name: "kubesphere",
Email: "kubesphere@yunify.com",
URL: "kubesphere.io",
URL: "https://kubesphere.io",
},
License: &spec.License{
Name: "Apache",