MCPcopy Create free account
hub / github.com/devspace-sh/devspace / runPipeline

Function runPipeline

cmd/run_pipeline.go:413–498  ·  view source on GitHub ↗
(ctx devspacecontext.Context, args []string, options *CommandOptions)

Source from the content-addressed store, hash-verified

411}
412
413func runPipeline(ctx devspacecontext.Context, args []string, options *CommandOptions) error {
414 var configPipeline *latest.Pipeline
415 if ctx.Config().Config().Pipelines != nil && ctx.Config().Config().Pipelines[options.Pipeline] != nil {
416 configPipeline = ctx.Config().Config().Pipelines[options.Pipeline]
417 if configPipeline.Run == "" {
418 defaultPipeline, _ := types.GetDefaultPipeline(options.Pipeline)
419 if defaultPipeline != nil {
420 configPipeline.Run = defaultPipeline.Run
421 }
422 }
423 } else {
424 var err error
425 configPipeline, err = types.GetDefaultPipeline(options.Pipeline)
426 if err != nil {
427 return err
428 }
429 }
430
431 // marshal pipeline
432 configPipelineBytes, err := yaml.Marshal(configPipeline)
433 if err == nil {
434 ctx.Log().Debugf("Run pipeline:\n%s\n", string(configPipelineBytes))
435 }
436
437 // create dev context
438 devCtxCancel, cancelDevCtx := context.WithCancel(ctx.Context())
439 ctx = ctx.WithContext(values.WithDevContext(ctx.Context(), devCtxCancel))
440
441 // create a new base dev pod manager
442 devPodManager := devpod.NewManager(cancelDevCtx)
443 defer devPodManager.Close()
444
445 // create dependency registry
446 dependencyRegistry := registry.NewDependencyRegistry(ctx.Config().Config().Name, options.DeployOptions.Render)
447
448 // get deploy pipeline
449 pipe := pipelinepkg.NewPipeline(ctx.Config().Config().Name, devPodManager, dependencyRegistry, configPipeline, options.Options)
450 kill.SetStopFunction(func(message string) {
451 if message != "" {
452 ctx.Log().WriteString(logrus.FatalLevel, "\n"+ansi.Color("fatal", "red+b")+" "+message+"\n")
453 }
454
455 err = pipe.Close()
456 if err != nil {
457 ctx.Log().Debugf("Error closing pipeline: %v", err)
458 }
459 })
460
461 // start ui & open
462 serv, err := dev.UI(ctx, options.UIPort, options.ShowUI, pipe)
463 if err != nil {
464 return err
465 }
466 dependencyRegistry.SetServer("http://" + serv.Server.Addr)
467
468 // get a stdout writer
469 stdoutWriter := ctx.Log().Writer(ctx.Log().GetLevel(), true)
470 defer stdoutWriter.Close()

Callers 1

RunMethod · 0.85

Calls 15

CloseMethod · 0.95
CloseMethod · 0.95
SetServerMethod · 0.95
RunMethod · 0.95
WaitDevMethod · 0.95
GetDefaultPipelineFunction · 0.92
WithDevContextFunction · 0.92
NewManagerFunction · 0.92
NewDependencyRegistryFunction · 0.92
SetStopFunctionFunction · 0.92
UIFunction · 0.92

Tested by

no test coverage detected