Skip to content

Commit a7064ff

Browse files
committed
fix: panic when auto host cleanup runs in some werf commands
Disable auto host cleanup when buildah build runtime is used. Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
1 parent 5202e5d commit a7064ff

File tree

6 files changed

+19
-1
lines changed

6 files changed

+19
-1
lines changed

cmd/werf/bundle/export/export.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/werf/werf/cmd/werf/common"
1818
"github.com/werf/werf/pkg/build"
1919
"github.com/werf/werf/pkg/config"
20+
"github.com/werf/werf/pkg/container_runtime"
2021
"github.com/werf/werf/pkg/deploy/helm/chart_extender"
2122
"github.com/werf/werf/pkg/deploy/helm/chart_extender/helpers"
2223
"github.com/werf/werf/pkg/git_repo"
@@ -162,6 +163,9 @@ func runExport(ctx context.Context) error {
162163
}
163164

164165
defer func() {
166+
if _, match := containerRuntime.(*container_runtime.DockerServerRuntime); !match {
167+
return
168+
}
165169
if err := common.RunAutoHostCleanup(ctx, &commonCmdData); err != nil {
166170
logboek.Context(ctx).Error().LogF("Auto host cleanup failed: %s\n", err)
167171
}

cmd/werf/bundle/publish/publish.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/werf/werf/cmd/werf/common"
2121
"github.com/werf/werf/pkg/build"
2222
"github.com/werf/werf/pkg/config"
23+
"github.com/werf/werf/pkg/container_runtime"
2324
"github.com/werf/werf/pkg/deploy/bundles"
2425
"github.com/werf/werf/pkg/deploy/helm/chart_extender"
2526
"github.com/werf/werf/pkg/deploy/helm/chart_extender/helpers"
@@ -178,6 +179,9 @@ func runPublish(ctx context.Context) error {
178179
}
179180

180181
defer func() {
182+
if _, match := containerRuntime.(*container_runtime.DockerServerRuntime); !match {
183+
return
184+
}
181185
if err := common.RunAutoHostCleanup(ctx, &commonCmdData); err != nil {
182186
logboek.Context(ctx).Error().LogF("Auto host cleanup failed: %s\n", err)
183187
}

cmd/werf/cleanup/cleanup.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/werf/logboek"
1010
"github.com/werf/werf/cmd/werf/common"
1111
"github.com/werf/werf/pkg/cleaning"
12+
"github.com/werf/werf/pkg/container_runtime"
1213
"github.com/werf/werf/pkg/git_repo"
1314
"github.com/werf/werf/pkg/git_repo/gitdata"
1415
"github.com/werf/werf/pkg/image"
@@ -133,6 +134,9 @@ func runCleanup(ctx context.Context) error {
133134
}
134135

135136
defer func() {
137+
if _, match := containerRuntime.(*container_runtime.DockerServerRuntime); !match {
138+
return
139+
}
136140
if err := common.RunAutoHostCleanup(ctx, &commonCmdData); err != nil {
137141
logboek.Context(ctx).Error().LogF("Auto host cleanup failed: %s\n", err)
138142
}

cmd/werf/compose/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ func runMain(ctx context.Context, dockerComposeCmdName string, cmdData composeCm
323323
}
324324

325325
defer func() {
326+
if _, match := containerRuntime.(*container_runtime.DockerServerRuntime); !match {
327+
return
328+
}
326329
if err := common.RunAutoHostCleanup(ctx, &commonCmdData); err != nil {
327330
logboek.Context(ctx).Error().LogF("Auto host cleanup failed: %s\n", err)
328331
}

cmd/werf/converge/converge.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ func runMain(ctx context.Context) error {
203203
}
204204

205205
defer func() {
206+
if _, match := containerRuntime.(*container_runtime.DockerServerRuntime); !match {
207+
return
208+
}
206209
if err := common.RunAutoHostCleanup(ctx, &commonCmdData); err != nil {
207210
logboek.Context(ctx).Error().LogF("Auto host cleanup failed: %s\n", err)
208211
}

cmd/werf/dismiss/dismiss.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"time"
77

88
"github.com/spf13/cobra"
9-
helm_v3 "helm.sh/helm/v3/cmd/helm"
9+
"helm.sh/helm/v3/cmd/helm"
1010
"helm.sh/helm/v3/pkg/action"
1111

1212
"github.com/werf/kubedog/pkg/kube"

0 commit comments

Comments
 (0)