Skip to content

Commit c49d90c

Browse files
committed
Use kaniko as default if docker is not installed
1 parent aae00f7 commit c49d90c

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

cmd/init.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@ func (cmd *InitCmd) Run(cobraCmd *cobra.Command, args []string) {
172172

173173
if cmd.flags.reconfigure || !configExists {
174174
cmd.configureKubernetes()
175-
176-
cmd.defaultImage.Name = config.DevSpace.Release.Name
177175
cmd.configureRegistry()
178176

179177
err := configutil.SaveConfig()
@@ -407,7 +405,7 @@ func (cmd *InitCmd) configureRegistry() {
407405
createInternalRegistryDefaultAnswer := "yes"
408406

409407
imageBuilder, err := docker.NewBuilder("", "", "", false)
410-
if err == nil {
408+
if err != nil {
411409
log.StartWait("Checking Docker credentials")
412410
dockerAuthConfig, err := imageBuilder.Authenticate("", "", true)
413411
log.StopWait()
@@ -418,6 +416,15 @@ func (cmd *InitCmd) configureRegistry() {
418416
createInternalRegistryDefaultAnswer = "no"
419417
}
420418
}
419+
} else {
420+
// Set default build engine to kaniko, if no docker is installed
421+
cmd.defaultImage.Build = &v1.BuildConfig{
422+
Engine: &v1.BuildEngine{
423+
Kaniko: &v1.KanikoBuildEngine{
424+
Enabled: configutil.Bool(true),
425+
},
426+
},
427+
}
421428
}
422429

423430
createInternalRegistry := stdinutil.GetFromStdin(&stdinutil.GetFromStdinParams{

pkg/devspace/configure/building.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package configure
2+
3+
// Building configures image building
4+
func Building() error {
5+
return nil
6+
}

pkg/devspace/configure/registry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func ImageName(dockerUsername string) error {
3434
log.StopWait()
3535

3636
if err != nil {
37-
return fmt.Errorf("Couldn't find credentials in credentials store. Make sure you login to the registry with: docker login %s", err, *registryURL)
37+
return fmt.Errorf("Couldn't find credentials in credentials store. Make sure you login to the registry with: docker login %s", *registryURL)
3838
}
3939

4040
dockerUsername = dockerAuthConfig.Username

0 commit comments

Comments
 (0)