···
"github.com/docker/docker/pkg/stdcopy"
"golang.org/x/sync/errgroup"
"tangled.sh/tangled.sh/core/api/tangled"
"tangled.sh/tangled.sh/core/log"
"tangled.sh/tangled.sh/core/spindle/db"
···
-
func New(ctx context.Context, db *db.DB) (*Engine, error) {
dcli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
···
l := log.FromContext(ctx).With("component", "spindle")
-
return &Engine{docker: dcli, l: l, db: db}, nil
// SetupPipeline sets up a new network for the pipeline, and possibly volumes etc.
···
-
err = e.db.CreatePipeline(id)
func (e *Engine) StartWorkflows(ctx context.Context, pipeline *tangled.Pipeline, id string) error {
e.l.Info("starting all workflows in parallel", "pipeline", id)
-
err := e.db.MarkPipelineRunning(id)
···
reader, err := e.docker.ImagePull(ctx, cimg, image.PullOptions{})
e.l.Error("pipeline failed!", "id", id, "error", err.Error())
-
err := e.db.MarkPipelineFailed(id, -1, err.Error())
···
err = e.StartSteps(ctx, w.Steps, id, cimg)
e.l.Error("pipeline failed!", "id", id, "error", err.Error())
-
return e.db.MarkPipelineFailed(id, -1, err.Error())
···
e.l.Error("pipeline failed!", "id", id, "error", err.Error())
-
return e.db.MarkPipelineFailed(id, -1, err.Error())
e.l.Info("pipeline success!", "id", id)
-
return e.db.MarkPipelineSuccess(id)
// StartSteps starts all steps sequentially with the same base image.
···
e.l.Error("pipeline failed!", "id", id, "error", state.Error, "exit_code", state.ExitCode)
-
return e.db.MarkPipelineFailed(id, state.ExitCode, state.Error)
···
"github.com/docker/docker/pkg/stdcopy"
"golang.org/x/sync/errgroup"
"tangled.sh/tangled.sh/core/api/tangled"
+
"tangled.sh/tangled.sh/core/knotserver/notifier"
"tangled.sh/tangled.sh/core/log"
"tangled.sh/tangled.sh/core/spindle/db"
···
+
func New(ctx context.Context, db *db.DB, n *notifier.Notifier) (*Engine, error) {
dcli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
···
l := log.FromContext(ctx).With("component", "spindle")
+
return &Engine{docker: dcli, l: l, db: db, n: n}, nil
// SetupPipeline sets up a new network for the pipeline, and possibly volumes etc.
···
+
err = e.db.CreatePipeline(id, e.n)
func (e *Engine) StartWorkflows(ctx context.Context, pipeline *tangled.Pipeline, id string) error {
e.l.Info("starting all workflows in parallel", "pipeline", id)
+
err := e.db.MarkPipelineRunning(id, e.n)
···
reader, err := e.docker.ImagePull(ctx, cimg, image.PullOptions{})
e.l.Error("pipeline failed!", "id", id, "error", err.Error())
+
err := e.db.MarkPipelineFailed(id, -1, err.Error(), e.n)
···
err = e.StartSteps(ctx, w.Steps, id, cimg)
e.l.Error("pipeline failed!", "id", id, "error", err.Error())
+
return e.db.MarkPipelineFailed(id, -1, err.Error(), e.n)
···
e.l.Error("pipeline failed!", "id", id, "error", err.Error())
+
return e.db.MarkPipelineFailed(id, -1, err.Error(), e.n)
e.l.Info("pipeline success!", "id", id)
+
return e.db.MarkPipelineSuccess(id, e.n)
// StartSteps starts all steps sequentially with the same base image.
···
e.l.Error("pipeline failed!", "id", id, "error", state.Error, "exit_code", state.ExitCode)
+
return e.db.MarkPipelineFailed(id, state.ExitCode, state.Error, e.n)