Skip to content

Commit 0663c79

Browse files
authored
Merge pull request #300 from covexo/examples
Add skip build flag to devspace up
2 parents 2e1cc06 + 20b5e80 commit 0663c79

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

cmd/up.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ type UpCmdFlags struct {
4242
build bool
4343
sync bool
4444
deploy bool
45+
skipBuild bool
4546
switchContext bool
4647
portforwarding bool
4748
verboseSync bool
@@ -58,6 +59,7 @@ var UpFlagsDefault = &UpCmdFlags{
5859
build: false,
5960
sync: true,
6061
switchContext: false,
62+
skipBuild: false,
6163
deploy: false,
6264
portforwarding: true,
6365
verboseSync: false,
@@ -100,6 +102,7 @@ Starts and connects your DevSpace:
100102
cobraCmd.Flags().BoolVar(&cmd.flags.portforwarding, "portforwarding", cmd.flags.portforwarding, "Enable port forwarding")
101103
cobraCmd.Flags().BoolVarP(&cmd.flags.deploy, "deploy", "d", cmd.flags.deploy, "Force chart deployment")
102104
cobraCmd.Flags().BoolVar(&cmd.flags.switchContext, "switch-context", cmd.flags.switchContext, "Switch kubectl context to the devspace context")
105+
cobraCmd.Flags().BoolVar(&cmd.flags.skipBuild, "skip-build", cmd.flags.skipBuild, "Forces devspace to skip the building step")
103106
cobraCmd.Flags().StringVarP(&cmd.flags.namespace, "namespace", "n", "", "Namespace where to select pods")
104107
cobraCmd.Flags().StringVarP(&cmd.flags.labelSelector, "label-selector", "l", "", "Comma separated key=value selector list (e.g. release=test)")
105108
}
@@ -389,16 +392,19 @@ func (cmd *UpCmd) buildAndDeploy() {
389392
// returns true when one of the images had to be rebuild
390393
func (cmd *UpCmd) buildImages(generatedConfig *generated.Config) bool {
391394
re := false
392-
config := configutil.GetConfig()
393395

394-
for imageName, imageConf := range *config.Images {
395-
shouldRebuild, err := image.Build(cmd.kubectl, generatedConfig, imageName, imageConf, cmd.flags.build)
396-
if err != nil {
397-
log.Fatal(err)
398-
}
396+
if cmd.flags.skipBuild == false {
397+
config := configutil.GetConfig()
399398

400-
if shouldRebuild {
401-
re = true
399+
for imageName, imageConf := range *config.Images {
400+
shouldRebuild, err := image.Build(cmd.kubectl, generatedConfig, imageName, imageConf, cmd.flags.build)
401+
if err != nil {
402+
log.Fatal(err)
403+
}
404+
405+
if shouldRebuild {
406+
re = true
407+
}
402408
}
403409
}
404410

0 commit comments

Comments
 (0)