Skip to content

Commit 4cd69ee

Browse files
committed
tests: fix config e2e tests
1 parent 8ebc87c commit 4cd69ee

File tree

15 files changed

+2095
-2015
lines changed

15 files changed

+2095
-2015
lines changed

cmd/build.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ type BuildCmd struct {
2323
SkipDependency []string
2424
Dependency []string
2525

26+
Pipeline string
27+
2628
ForceBuild bool
2729
BuildSequential bool
2830
MaxConcurrentBuilds int
@@ -54,6 +56,7 @@ Builds all defined images and pushes them
5456
buildCmd.Flags().StringSliceVarP(&cmd.Tags, "tag", "t", []string{}, "Use the given tag for all built images")
5557
buildCmd.Flags().StringSliceVar(&cmd.SkipDependency, "skip-dependency", []string{}, "Skips building the following dependencies")
5658
buildCmd.Flags().StringSliceVar(&cmd.Dependency, "dependency", []string{}, "Builds only the specific named dependencies")
59+
buildCmd.Flags().StringVar(&cmd.Pipeline, "pipeline", "", "The pipeline to execute")
5760

5861
buildCmd.Flags().BoolVar(&cmd.SkipPush, "skip-push", false, "Skips image pushing, useful for minikube deployment")
5962
buildCmd.Flags().BoolVar(&cmd.SkipPushLocalKubernetes, "skip-push-local-kube", false, "Skips image pushing, if a local kubernetes environment is detected")
@@ -75,6 +78,10 @@ func (cmd *BuildCmd) Run(f factory.Factory) error {
7578
}
7679

7780
func (cmd *BuildCmd) runCommand(ctx *devspacecontext.Context, f factory.Factory, configOptions *loader.ConfigOptions) error {
81+
if cmd.Pipeline == "" {
82+
cmd.Pipeline = "build"
83+
}
84+
7885
return runPipeline(ctx, f, true, &PipelineOptions{
7986
Options: pipelinetypes.Options{
8087
BuildOptions: build.Options{
@@ -91,6 +98,6 @@ func (cmd *BuildCmd) runCommand(ctx *devspacecontext.Context, f factory.Factory,
9198
},
9299
ConfigOptions: configOptions,
93100
Only: cmd.Dependency,
94-
Pipeline: "build",
101+
Pipeline: cmd.Pipeline,
95102
})
96103
}

cmd/deploy.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ devspace deploy --kube-context=deploy-context
101101
deployCmd.Flags().BoolVarP(&cmd.ForceDeploy, "force-deploy", "d", false, "Forces to (re-)deploy every deployment")
102102
deployCmd.Flags().BoolVar(&cmd.SkipDeploy, "skip-deploy", false, "Skips deploying and only builds images")
103103
deployCmd.Flags().BoolVar(&cmd.Render, "render", false, "If true will render manifests and print them instead of actually deploying them")
104-
deployCmd.Flags().StringVar(&cmd.Pipeline, "pipeline", "deploy", "The pipeline to execute")
104+
deployCmd.Flags().StringVar(&cmd.Pipeline, "pipeline", "", "The pipeline to execute")
105105

106106
deployCmd.Flags().StringSliceVar(&cmd.SkipDependency, "skip-dependency", []string{}, "Skips deploying the following dependencies")
107107
deployCmd.Flags().StringSliceVar(&cmd.Dependency, "dependency", []string{}, "Deploys only the specific named dependencies")
@@ -126,6 +126,10 @@ func (cmd *DeployCmd) Run(f factory.Factory) error {
126126
}
127127

128128
func (cmd *DeployCmd) runCommand(ctx *devspacecontext.Context, f factory.Factory, configOptions *loader.ConfigOptions) error {
129+
if cmd.Pipeline == "" {
130+
cmd.Pipeline = "deploy"
131+
}
132+
129133
return runPipeline(ctx, f, true, &PipelineOptions{
130134
Options: types.Options{
131135
BuildOptions: build.Options{
@@ -234,7 +238,13 @@ func runPipeline(ctx *devspacecontext.Context, f factory.Factory, forceLeader bo
234238
}
235239
}
236240

237-
// deploy dependencies
241+
// print config
242+
if ctx.Log.GetLevel() == logrus.DebugLevel {
243+
out, _ := yaml.Marshal(ctx.Config.Config())
244+
ctx.Log.Debugf("Use config:\n%s\n", string(out))
245+
}
246+
247+
// resolve dependencies
238248
dependencies, err := f.NewDependencyManager(ctx, options.ConfigOptions).ResolveAll(ctx, dependency.ResolveOptions{
239249
SkipDependencies: options.DependencyOptions.Exclude,
240250
Dependencies: options.Only,

cmd/dev.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Open terminal instead of logs:
122122
devCmd.Flags().BoolVar(&cmd.UI, "ui", true, "Start the ui server")
123123
devCmd.Flags().IntVar(&cmd.UIPort, "ui-port", 0, "The port to use when opening the ui server")
124124
devCmd.Flags().BoolVar(&cmd.Open, "open", true, "Open defined URLs in the browser, if defined")
125-
devCmd.Flags().StringVar(&cmd.Pipeline, "pipeline", "dev", "The pipeline to execute")
125+
devCmd.Flags().StringVar(&cmd.Pipeline, "pipeline", "", "The pipeline to execute")
126126

127127
devCmd.Flags().BoolVarP(&cmd.Terminal, "terminal", "t", false, "Open a terminal instead of showing logs")
128128
devCmd.Flags().StringVar(&cmd.WorkingDirectory, "workdir", "", "The working directory where to open the terminal or execute the command")
@@ -169,6 +169,10 @@ func (cmd *DevCmd) Run(f factory.Factory, args []string) error {
169169
}
170170

171171
func (cmd *DevCmd) runCommand(ctx *devspacecontext.Context, f factory.Factory, configOptions *loader.ConfigOptions) error {
172+
if cmd.Pipeline == "" {
173+
cmd.Pipeline = "dev"
174+
}
175+
172176
return runPipeline(ctx, f, true, &PipelineOptions{
173177
Options: types.Options{
174178
BuildOptions: build.Options{

cmd/purge.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type PurgeCmd struct {
1919
*flags.GlobalFlags
2020

2121
Deployments string
22+
Pipeline string
2223
All bool
2324

2425
SkipDependency []string
@@ -56,6 +57,7 @@ devspace purge -d my-deployment
5657

5758
purgeCmd.Flags().StringVarP(&cmd.Deployments, "deployments", "d", "", "The deployment to delete (You can specify multiple deployments comma-separated, e.g. devspace-default,devspace-database etc.)")
5859
purgeCmd.Flags().BoolVarP(&cmd.All, "all", "a", true, "When enabled purges the dependencies as well")
60+
purgeCmd.Flags().StringVar(&cmd.Pipeline, "pipeline", "", "The pipeline to execute")
5961

6062
purgeCmd.Flags().StringSliceVar(&cmd.SkipDependency, "skip-dependency", []string{}, "Skips the following dependencies from purging")
6163
purgeCmd.Flags().StringSliceVar(&cmd.Dependency, "dependency", []string{}, "Purges only the specific named dependencies")
@@ -76,6 +78,10 @@ func (cmd *PurgeCmd) Run(f factory.Factory) error {
7678
}
7779

7880
func (cmd *PurgeCmd) runCommand(ctx *devspacecontext.Context, f factory.Factory, configOptions *loader.ConfigOptions) error {
81+
if cmd.Pipeline == "" {
82+
cmd.Pipeline = "purge"
83+
}
84+
7985
return runPipeline(ctx, f, false, &PipelineOptions{
8086
Options: types.Options{
8187
DependencyOptions: types.DependencyOptions{
@@ -84,6 +90,6 @@ func (cmd *PurgeCmd) runCommand(ctx *devspacecontext.Context, f factory.Factory,
8490
},
8591
ConfigOptions: configOptions,
8692
Only: cmd.Dependency,
87-
Pipeline: "purge",
93+
Pipeline: cmd.Pipeline,
8894
})
8995
}

0 commit comments

Comments
 (0)