Skip to content

Commit

Permalink
fix: panic when auto host cleanup runs in some werf commands
Browse files Browse the repository at this point in the history
Disable auto host cleanup when buildah build runtime is used.

Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
  • Loading branch information
distorhead committed Feb 21, 2022
1 parent 5202e5d commit a7064ff
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmd/werf/bundle/export/export.go
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/werf/werf/cmd/werf/common"
"github.com/werf/werf/pkg/build"
"github.com/werf/werf/pkg/config"
"github.com/werf/werf/pkg/container_runtime"
"github.com/werf/werf/pkg/deploy/helm/chart_extender"
"github.com/werf/werf/pkg/deploy/helm/chart_extender/helpers"
"github.com/werf/werf/pkg/git_repo"
Expand Down Expand Up @@ -162,6 +163,9 @@ func runExport(ctx context.Context) error {
}

defer func() {
if _, match := containerRuntime.(*container_runtime.DockerServerRuntime); !match {
return
}
if err := common.RunAutoHostCleanup(ctx, &commonCmdData); err != nil {
logboek.Context(ctx).Error().LogF("Auto host cleanup failed: %s\n", err)
}
Expand Down
4 changes: 4 additions & 0 deletions cmd/werf/bundle/publish/publish.go
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/werf/werf/cmd/werf/common"
"github.com/werf/werf/pkg/build"
"github.com/werf/werf/pkg/config"
"github.com/werf/werf/pkg/container_runtime"
"github.com/werf/werf/pkg/deploy/bundles"
"github.com/werf/werf/pkg/deploy/helm/chart_extender"
"github.com/werf/werf/pkg/deploy/helm/chart_extender/helpers"
Expand Down Expand Up @@ -178,6 +179,9 @@ func runPublish(ctx context.Context) error {
}

defer func() {
if _, match := containerRuntime.(*container_runtime.DockerServerRuntime); !match {
return
}
if err := common.RunAutoHostCleanup(ctx, &commonCmdData); err != nil {
logboek.Context(ctx).Error().LogF("Auto host cleanup failed: %s\n", err)
}
Expand Down
4 changes: 4 additions & 0 deletions cmd/werf/cleanup/cleanup.go
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/werf/logboek"
"github.com/werf/werf/cmd/werf/common"
"github.com/werf/werf/pkg/cleaning"
"github.com/werf/werf/pkg/container_runtime"
"github.com/werf/werf/pkg/git_repo"
"github.com/werf/werf/pkg/git_repo/gitdata"
"github.com/werf/werf/pkg/image"
Expand Down Expand Up @@ -133,6 +134,9 @@ func runCleanup(ctx context.Context) error {
}

defer func() {
if _, match := containerRuntime.(*container_runtime.DockerServerRuntime); !match {
return
}
if err := common.RunAutoHostCleanup(ctx, &commonCmdData); err != nil {
logboek.Context(ctx).Error().LogF("Auto host cleanup failed: %s\n", err)
}
Expand Down
3 changes: 3 additions & 0 deletions cmd/werf/compose/main.go
Expand Up @@ -323,6 +323,9 @@ func runMain(ctx context.Context, dockerComposeCmdName string, cmdData composeCm
}

defer func() {
if _, match := containerRuntime.(*container_runtime.DockerServerRuntime); !match {
return
}
if err := common.RunAutoHostCleanup(ctx, &commonCmdData); err != nil {
logboek.Context(ctx).Error().LogF("Auto host cleanup failed: %s\n", err)
}
Expand Down
3 changes: 3 additions & 0 deletions cmd/werf/converge/converge.go
Expand Up @@ -203,6 +203,9 @@ func runMain(ctx context.Context) error {
}

defer func() {
if _, match := containerRuntime.(*container_runtime.DockerServerRuntime); !match {
return
}
if err := common.RunAutoHostCleanup(ctx, &commonCmdData); err != nil {
logboek.Context(ctx).Error().LogF("Auto host cleanup failed: %s\n", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/werf/dismiss/dismiss.go
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/spf13/cobra"
helm_v3 "helm.sh/helm/v3/cmd/helm"
"helm.sh/helm/v3/cmd/helm"
"helm.sh/helm/v3/pkg/action"

"github.com/werf/kubedog/pkg/kube"
Expand Down

0 comments on commit a7064ff

Please sign in to comment.