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

Method Run

cmd/run_pipeline.go:199–244  ·  view source on GitHub ↗

Run executes the command logic

(cobraCmd *cobra.Command, args []string, f factory.Factory, hookName string)

Source from the content-addressed store, hash-verified

197
198// Run executes the command logic
199func (cmd *RunPipelineCmd) Run(cobraCmd *cobra.Command, args []string, f factory.Factory, hookName string) error {
200 if len(args) == 0 && cmd.Pipeline == "" {
201 return fmt.Errorf("please specify a pipeline through --pipeline or argument")
202 } else if len(args) > 0 && cmd.Pipeline == "" {
203 cmd.Pipeline = args[0]
204 args = args[1:]
205 }
206
207 if cmd.Log == nil {
208 cmd.Log = f.GetLog()
209 }
210 if cmd.Silent {
211 cmd.Log.SetLevel(logrus.FatalLevel)
212 }
213
214 // Print upgrade message if new version available
215 if !cmd.Render {
216 upgrade.PrintUpgradeMessage(cmd.Log)
217 } else if cmd.RenderWriter == nil {
218 cmd.RenderWriter = os.Stdout
219 }
220
221 if cobraCmd != nil {
222 plugin.SetPluginCommand(cobraCmd, args)
223 }
224
225 if cmd.Ctx == nil {
226 var cancelFn context.CancelFunc
227 cmd.Ctx, cancelFn = context.WithCancel(context.Background())
228 defer cancelFn()
229 }
230
231 // set command in context
232 if cobraCmd != nil {
233 cmd.Ctx = values.WithCommandFlags(cmd.Ctx, cobraCmd.Flags())
234 }
235 options := cmd.BuildOptions(cmd.ToConfigOptions())
236 ctx, err := initialize(cmd.Ctx, f, options, cmd.Log)
237 if err != nil {
238 return err
239 }
240
241 return runWithHooks(ctx, hookName, func() error {
242 return runPipeline(ctx, args, options)
243 })
244}
245
246type CommandOptions struct {
247 flags.GlobalFlags

Callers 8

NewDevCmdFunction · 0.95
NewRunPipelineCmdFunction · 0.95
NewSpecificPipelineCmdFunction · 0.95
RunDefaultMethod · 0.95
NewPurgeCmdFunction · 0.95
NewBuildCmdFunction · 0.95
NewRenderCmdFunction · 0.95
NewDeployCmdFunction · 0.95

Calls 11

BuildOptionsMethod · 0.95
PrintUpgradeMessageFunction · 0.92
SetPluginCommandFunction · 0.92
WithCommandFlagsFunction · 0.92
initializeFunction · 0.85
runWithHooksFunction · 0.85
runPipelineFunction · 0.85
ToConfigOptionsMethod · 0.80
GetLogMethod · 0.65
ErrorfMethod · 0.45
SetLevelMethod · 0.45

Tested by

no test coverage detected