Skip to content

Commit

Permalink
Infer stack image names only if image is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
pchico83 committed Mar 29, 2021
1 parent ecf15c4 commit 11026f9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/cmd/stack/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
okLabels "github.com/okteto/okteto/pkg/k8s/labels"
"github.com/okteto/okteto/pkg/log"
"github.com/okteto/okteto/pkg/model"
"github.com/okteto/okteto/pkg/okteto"
"github.com/okteto/okteto/pkg/registry"
"github.com/subosito/gotenv"
yaml "gopkg.in/yaml.v2"
Expand Down Expand Up @@ -125,7 +124,10 @@ func translateBuildImages(ctx context.Context, s *model.Stack, forceBuild, noCac
if svc.Build == nil {
continue
}
if isOktetoCluster && !strings.HasPrefix(svc.Image, okteto.DevRegistry) {
if svc.Image == "" {
if !isOktetoCluster {
return fmt.Errorf("'build' and 'image' fields of service '%s' cannot be empty", name)
}
svc.Image = fmt.Sprintf("okteto.dev/%s-%s:okteto", s.Name, name)
}
if !forceBuild {
Expand Down

0 comments on commit 11026f9

Please sign in to comment.