Add Workflow tab and run-progress API for workflow runs
This commit is contained in:
@@ -111,6 +111,18 @@ func (s *Store) RunTasks(ctx context.Context, run string) ([]api.Task, error) {
|
||||
return s.queryTasks(ctx, `SELECT `+taskColumns+` FROM tasks WHERE workflow_run = ? ORDER BY created_at`, run)
|
||||
}
|
||||
|
||||
func (s *Store) RunEvents(ctx context.Context, run string) ([]api.Event, error) {
|
||||
rows, err := s.db.QueryContext(ctx, `
|
||||
SELECT `+eventColumns+` FROM events
|
||||
WHERE task_id IN (SELECT id FROM tasks WHERE workflow_run = ?) AND kind IN ('task.workflow_stage', 'task.discarded', 'task.workflow_finished')
|
||||
ORDER BY seq
|
||||
`, run)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return scanEvents(rows)
|
||||
}
|
||||
|
||||
func (s *Store) RecordStage(ctx context.Context, taskID, output, commit string) error {
|
||||
return s.write(ctx, func(tx *sql.Tx, emit emitFunc) error {
|
||||
_, err := tx.ExecContext(ctx, `UPDATE tasks SET stage_output = ?, stage_commit = ? WHERE id = ?`, output, commit, taskID)
|
||||
|
||||
Reference in New Issue
Block a user