validate pipeline config

Signed-off-by: runzexia <runzexia@yunify.com>
This commit is contained in:
runzexia
2020-02-05 10:55:30 +08:00
parent 88da4f7809
commit 751eff2da7
3 changed files with 143 additions and 0 deletions

View File

@@ -39,6 +39,12 @@ func CreateDevOpsProjectPipelineHandler(request *restful.Request, resp *restful.
errors.ParseSvcErr(restful.NewError(http.StatusForbidden, err.Error()), resp)
return
}
err = devops.ValidatePipelineConfig(pipeline)
if err != nil {
klog.Errorf("%+v", err)
errors.ParseSvcErr(restful.NewError(http.StatusBadRequest, err.Error()), resp)
return
}
pipelineName, err := devops.CreateProjectPipeline(projectId, pipeline)
if err != nil {
@@ -96,6 +102,12 @@ func UpdateDevOpsProjectPipelineHandler(request *restful.Request, resp *restful.
errors.ParseSvcErr(restful.NewError(http.StatusForbidden, err.Error()), resp)
return
}
err = devops.ValidatePipelineConfig(pipeline)
if err != nil {
klog.Errorf("%+v", err)
errors.ParseSvcErr(restful.NewError(http.StatusBadRequest, err.Error()), resp)
return
}
pipelineName, err := devops.UpdateProjectPipeline(projectId, pipelineId, pipeline)
if err != nil {