Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"encoding/json"
"fmt"
"log"

"go.uber.org/zap"

Expand Down Expand Up @@ -288,6 +289,7 @@ func (c *ApisixJobCtl) executeServiceTask(client *apisix.Client, task *commonmod
}

func (c *ApisixJobCtl) executeProtoTask(client *apisix.Client, task *commonmodels.ApisixItemUpdateSpec) error {
log.Printf("execute proto task: %v", task.UserSpec)
proto, err := convertToProto(task.UserSpec)

if err != nil {
Expand All @@ -296,6 +298,7 @@ func (c *ApisixJobCtl) executeProtoTask(client *apisix.Client, task *commonmodel

switch task.Action {
case config.ApisixActionTypeCreate:
log.Printf("create proto: %v", proto)
resp, err := client.UpdateProto(proto.ID, proto)
if err != nil {
return err
Expand All @@ -306,6 +309,7 @@ func (c *ApisixJobCtl) executeProtoTask(client *apisix.Client, task *commonmodel
return nil

case config.ApisixActionTypeUpdate:
log.Printf("update proto: %v", proto)
if proto.ID == "" {
return fmt.Errorf("proto id is required for update operation")
}
Expand Down Expand Up @@ -399,6 +403,18 @@ func convertToProto(spec interface{}) (*apisix.Proto, error) {
if err := json.Unmarshal(data, proto); err != nil {
return nil, fmt.Errorf("failed to unmarshal to proto: %v", err)
}

log.Printf("userSpec convertToProto: %v", proto)

// bug point dont touch it!
// if delete it , proto in apisix will fail to run
if proto.Name == "" {
proto.Desc = proto.ID
proto.Name = proto.ID
log.Printf("proto for name is empty: %v", proto)
return proto, nil
}

proto.Desc = proto.Name
proto.ID = proto.Name

Expand Down
1 change: 1 addition & 0 deletions pkg/microservice/aslan/core/system/service/apisix.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func ListApisixProtos(id string, page, pageSize int, log *zap.SugaredLogger) (*S
// Extract only the values from the response
protos := make([]*apisix.Proto, 0, len(resp.List))
for _, item := range resp.List {
log.Infof("proto response key: %s, value: %+v", item.Key, item.Value)
if item.Value != nil {
protos = append(protos, item.Value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func CreateWorkflowTaskV4(c *gin.Context) {
}

ticketID := c.Query("approval_ticket_id")
ctx.Logger.Infof("CreateWorkflowTaskV4 request params: projectName=%s, approvalTicketID=%s, workflowName=%s, workflowDisplayName=%s, userName=%s, userID=%s, isSystemAdmin=%v, body=%s", c.Query("projectName"), ticketID, args.Name, args.DisplayName, ctx.UserName, ctx.UserID, ctx.Resources.IsSystemAdmin, data)

internalhandler.InsertOperationLog(c, ctx.UserName, args.Project, "新建", "工作流任务", args.Name, args.Name, data, types.RequestBodyTypeJSON, ctx.Logger)

Expand Down Expand Up @@ -283,6 +284,7 @@ func CloneWorkflowTaskV4(c *gin.Context) {
ctx.RespErr = e.ErrInvalidParam.AddDesc("invalid task id")
return
}
ctx.Logger.Infof("CloneWorkflowTaskV4 request params: projectName=%s, workflowName=%s, taskID=%d, userName=%s, userID=%s, isSystemAdmin=%v", projectKey, workflowName, taskID, ctx.UserName, ctx.UserID, ctx.Resources.IsSystemAdmin)
internalhandler.InsertOperationLog(c, ctx.UserName, projectKey, "克隆", "工作流任务", c.Param("workflowName"), c.Param("workflowName"), "", types.RequestBodyTypeJSON, ctx.Logger)

// authorization check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,8 @@ func CreateWorkflowTaskV4ByBuildInTrigger(triggerName string, args *commonmodels
}

func CreateWorkflowTaskV4(args *CreateWorkflowTaskV4Args, workflow *commonmodels.WorkflowV4, log *zap.SugaredLogger) (*CreateTaskV4Resp, error) {
log.Infof("CreateWorkflowTaskV4 service params: workflowName=%s, projectName=%s, creator=%s, creatorID=%s, type=%s, approvalTicketID=%s, skipWorkflowUpdate=%v", workflow.Name, workflow.Project, args.Name, args.UserID, args.Type, args.ApprovalTicketID, args.SkipWorkflowUpdate)

resp := &CreateTaskV4Resp{
ProjectName: workflow.Project,
WorkflowName: workflow.Name,
Expand Down Expand Up @@ -914,6 +916,8 @@ func GetManualExecWorkflowTaskV4Info(workflowName string, taskID int64, logger *
}

func CloneWorkflowTaskV4(workflowName string, taskID int64, isView bool, logger *zap.SugaredLogger) (*commonmodels.WorkflowV4, error) {
logger.Infof("CloneWorkflowTaskV4 service params: workflowName=%s, taskID=%d, isView=%v", workflowName, taskID, isView)

originalWorkflow, err := commonrepo.NewWorkflowV4Coll().Find(workflowName)
if err != nil {
logger.Errorf("find workflowV4 error: %s", err)
Expand Down
Loading