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

Method AddPipelineFlags

cmd/run_pipeline.go:70–134  ·  view source on GitHub ↗
(f factory.Factory, command *cobra.Command, pipeline *latest.Pipeline)

Source from the content-addressed store, hash-verified

68}
69
70func (cmd *RunPipelineCmd) AddPipelineFlags(f factory.Factory, command *cobra.Command, pipeline *latest.Pipeline) {
71 command.Flags().StringSliceVar(&cmd.SkipDependency, "skip-dependency", cmd.SkipDependency, "Skips the following dependencies for deployment")
72 command.Flags().StringSliceVar(&cmd.Dependency, "dependency", cmd.Dependency, "Deploys only the specified named dependencies")
73 command.Flags().BoolVar(&cmd.SequentialDependencies, "sequential-dependencies", false, "If set set true dependencies will run sequentially")
74
75 command.Flags().BoolVarP(&cmd.ForceBuild, "force-build", "b", cmd.ForceBuild, "Forces to build every image")
76 command.Flags().BoolVar(&cmd.SkipBuild, "skip-build", cmd.SkipBuild, "Skips building of images")
77 command.Flags().BoolVar(&cmd.BuildSequential, "build-sequential", cmd.BuildSequential, "Builds the images one after another instead of in parallel")
78 command.Flags().IntVar(&cmd.MaxConcurrentBuilds, "max-concurrent-builds", cmd.MaxConcurrentBuilds, "The maximum number of image builds built in parallel (0 for infinite)")
79 command.Flags().BoolVar(&cmd.Render, "render", cmd.Render, "If true will render manifests and print them instead of actually deploying them")
80
81 command.Flags().BoolVar(&cmd.ForcePurge, "force-purge", cmd.ForcePurge, "Forces to purge every deployment even though it might be in use by another DevSpace project")
82 command.Flags().BoolVarP(&cmd.ForceDeploy, "force-deploy", "d", cmd.ForceDeploy, "Forces to deploy every deployment")
83 command.Flags().BoolVar(&cmd.SkipDeploy, "skip-deploy", cmd.SkipDeploy, "If enabled will skip deploying")
84 command.Flags().StringVar(&cmd.Pipeline, "pipeline", cmd.Pipeline, "The pipeline to execute")
85
86 command.Flags().StringSliceVarP(&cmd.Tags, "tag", "t", cmd.Tags, "Use the given tag for all built images")
87 command.Flags().BoolVar(&cmd.SkipPush, "skip-push", cmd.SkipPush, "Skips image pushing, useful for minikube deployment")
88 command.Flags().BoolVar(&cmd.SkipPushLocalKubernetes, "skip-push-local-kube", cmd.SkipPushLocalKubernetes, "Skips image pushing, if a local kubernetes environment is detected")
89
90 command.Flags().BoolVar(&cmd.ShowUI, "show-ui", cmd.ShowUI, "Shows the ui server")
91
92 if pipeline != nil {
93 for _, pipelineFlag := range pipeline.Flags {
94 if pipelineFlag.Name == "" {
95 continue
96 }
97
98 usage := pipelineFlag.Description
99 if usage == "" {
100 usage = "Flag " + pipelineFlag.Name
101 }
102
103 if pipelineFlag.Type == "" || pipelineFlag.Type == latest.PipelineFlagTypeBoolean {
104 val, err := pipelinepkg.GetDefaultValue(pipelineFlag)
105 if err != nil {
106 f.GetLog().Errorf("Error parsing default value for flag %s: %#v is not a boolean", pipelineFlag.Name, pipelineFlag.Default)
107 }
108
109 command.Flags().BoolP(pipelineFlag.Name, pipelineFlag.Short, val.(bool), usage)
110 } else if pipelineFlag.Type == latest.PipelineFlagTypeString {
111 val, err := pipelinepkg.GetDefaultValue(pipelineFlag)
112 if err != nil {
113 f.GetLog().Errorf("Error parsing default value for flag %s: %#v is not a string", pipelineFlag.Name, pipelineFlag.Default)
114 }
115
116 command.Flags().StringP(pipelineFlag.Name, pipelineFlag.Short, val.(string), usage)
117 } else if pipelineFlag.Type == latest.PipelineFlagTypeInteger {
118 val, err := pipelinepkg.GetDefaultValue(pipelineFlag)
119 if err != nil {
120 f.GetLog().Errorf("Error parsing default value for flag %s: %#v is not an integer", pipelineFlag.Name, pipelineFlag.Default)
121 }
122
123 command.Flags().IntP(pipelineFlag.Name, pipelineFlag.Short, val.(int), usage)
124 } else if pipelineFlag.Type == latest.PipelineFlagTypeStringArray {
125 val, err := pipelinepkg.GetDefaultValue(pipelineFlag)
126 if err != nil {
127 f.GetLog().Errorf("Error parsing default value for flag %s: %#v is not a string array", pipelineFlag.Name, pipelineFlag.Default)

Callers 7

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

Calls 2

GetLogMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected