Skip to content

Commit

Permalink
fix(build): allow usage of non-final images for specific commands
Browse files Browse the repository at this point in the history
Enabled non-final images for `build`, `run`, `kube-run`, and `compose` commands

Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
  • Loading branch information
alexey-igrychev committed Oct 1, 2024
1 parent 074b39e commit 20641a8
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/werf/build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func run(ctx context.Context, containerBackend container_backend.ContainerBacken
return fmt.Errorf("unable to load werf config: %w", err)
}

imagesToProcess, err := config.NewImagesToProcess(werfConfig, imageNameListFromArgs, true, false)
imagesToProcess, err := config.NewImagesToProcess(werfConfig, imageNameListFromArgs, false, false)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/werf/compose/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ func run(ctx context.Context, containerBackend container_backend.ContainerBacken
imageNameList = imageNameListFromComposeConfig
}

imagesToProcess, err := config.NewImagesToProcess(werfConfig, imageNameList, true, *commonCmdData.WithoutImages)
imagesToProcess, err := config.NewImagesToProcess(werfConfig, imageNameList, false, *commonCmdData.WithoutImages)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/werf/config/graph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func NewCmd(ctx context.Context) *cobra.Command {
return err
}

imagesToProcess, err := config.NewImagesToProcess(werfConfig, args, true, false)
imagesToProcess, err := config.NewImagesToProcess(werfConfig, args, false, false)
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/werf/kube_run/kube_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,11 @@ func run(ctx context.Context, pod, secret, namespace string, werfConfig *config.

imageName := cmdData.ImageName
if imageName == "" && len(werfConfig.Images(true)) == 1 {
// The only final image by default.
imageName = werfConfig.Images(true)[0].GetName()
}

imagesToProcess, err := config.NewImagesToProcess(werfConfig, []string{imageName}, true, false)
imagesToProcess, err := config.NewImagesToProcess(werfConfig, []string{imageName}, false, false)
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/werf/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,11 @@ func run(ctx context.Context, containerBackend container_backend.ContainerBacken

imageName := cmdData.ImageName
if imageName == "" && len(werfConfig.Images(true)) == 1 {
// The only final image by default.
imageName = werfConfig.Images(true)[0].GetName()
}

imagesToProcess, err := config.NewImagesToProcess(werfConfig, []string{imageName}, true, false)
imagesToProcess, err := config.NewImagesToProcess(werfConfig, []string{imageName}, false, false)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/werf/stage/image/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func run(ctx context.Context, imageName string) error {
imageName = werfConfig.Images(true)[0].GetName()
}

imagesToProcess, err := config.NewImagesToProcess(werfConfig, []string{imageName}, true, false)
imagesToProcess, err := config.NewImagesToProcess(werfConfig, []string{imageName}, false, false)
if err != nil {
return err
}
Expand Down

0 comments on commit 20641a8

Please sign in to comment.