klesh commented on code in PR #3052:
URL: https://github.com/apache/incubator-devlake/pull/3052#discussion_r971593073


##########
plugins/webhook/api/cicd_pipeline.go:
##########
@@ -53,6 +58,51 @@ func PostCicdPipeline(input *core.ApiResourceInput) 
(*core.ApiResourceOutput, er
        if err != nil {
                return nil, err
        }
-       // TODO save pipeline
+       // get request
+       request := &WebhookPipelineRequest{}
+       err = helper.DecodeMapStruct(input.Body, request)
+       if err != nil {
+               return &core.ApiResourceOutput{Body: err.Error(), Status: 
http.StatusBadRequest}, nil
+       }
+       // validate
+       vld = validator.New()
+       err = errors.Convert(vld.Struct(request))
+       if err != nil {
+               return &core.ApiResourceOutput{Body: err.Error(), Status: 
http.StatusBadRequest}, nil
+       }
+
+       db := basicRes.GetDal()
+       domainPipeline := &devops.CICDPipeline{
+               DomainEntity: domainlayer.DomainEntity{
+                       Id: fmt.Sprintf("%s:%d:%s:%s:%s:%s", "webhook", 
connection.ID, request.Repo, request.Branch, request.CommitSha, request.Id),
+               },
+               Name:         request.Id,

Review Comment:
   Why use different naming? can we rename `request.Id` to `Name`?
   



##########
plugins/webhook/api/cicd_pipeline.go:
##########
@@ -18,9 +18,14 @@ limitations under the License.
 package api
 

Review Comment:
   According to the latest discussion, we decided `deployment` should be a 
`type` of `cicd_tasks`.
   We have to rename this webhook to  `cicd_tasks`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to