Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(gh-ost): task blocked by implementation (#1110)
p0ny6e46333402bd
diff --git a/api/task.go b/api/task.goindex 43fccdfa99..6b2e30ce88 100644--- a/api/task.go+++ b/api/task.go@@ -169,6 +169,7 @@ type TaskRaw struct {Type TaskTypePayload stringEarliestAllowedTs int64+ BlockedBy []string}// ToTask creates an instance of Task based on the TaskRaw.@@ -196,6 +197,7 @@ func (raw *TaskRaw) ToTask() *Task {Type: raw.Type,Payload: raw.Payload,EarliestAllowedTs: raw.EarliestAllowedTs,+ BlockedBy: raw.BlockedBy,}for _, taskRunRaw := range raw.TaskRunRawList {task.TaskRunList = append(task.TaskRunList, taskRunRaw.ToTaskRun())@@ -236,6 +238,9 @@ type Task struct {Type TaskType `jsonapi:"attr,type"`Payload string `jsonapi:"attr,payload"`EarliestAllowedTs int64 `jsonapi:"attr,earliestAllowedTs"`+ // BlockedBy is an array of Task ID.+ // We use string here to workaround jsonapi limitations. https://github.com/google/jsonapi/issues/209+ BlockedBy []string `jsonapi:"attr,blockedBy"`}// ToRaw converts a Task to TaskRaw.@@ -262,6 +267,7 @@ func (task *Task) ToRaw() *TaskRaw {Type: task.Type,Payload: task.Payload,EarliestAllowedTs: task.EarliestAllowedTs,+ BlockedBy: task.BlockedBy,}}diff --git a/server/task.go b/server/task.goindex 693e63c7cb..c957ff580f 100644--- a/server/task.go+++ b/server/task.go@@ -458,6 +458,16 @@ func (s *Server) composeTaskRelationship(ctx context.Context, raw *api.TaskRaw)taskCheckRun.Updater = updater}+ blockedBy := []string{}+ taskDAGList, err := s.store.FindTaskDAGList(ctx, &api.TaskDAGFind{FromTaskID: raw.ID})+ if err != nil {+ return nil, err+ }+ for _, taskDAG := range taskDAGList {+ blockedBy = append(blockedBy, strconv.Itoa(taskDAG.ToTaskID))+ }+ task.BlockedBy = blockedBy+instance, err := s.store.GetInstanceByID(ctx, task.InstanceID)if err != nil {return nil, err