diff --git a/pkg/artifact/tasks.go b/pkg/artifact/tasks.go index 8109ecf7..38d86d73 100644 --- a/pkg/artifact/tasks.go +++ b/pkg/artifact/tasks.go @@ -18,17 +18,19 @@ package artifact import ( "fmt" - "github.com/kubesphere/kubekey/pkg/common" - "github.com/kubesphere/kubekey/pkg/core/connector" - "github.com/kubesphere/kubekey/pkg/core/logger" - coreutil "github.com/kubesphere/kubekey/pkg/core/util" - "github.com/pkg/errors" "io" "io/ioutil" "os" "os/exec" "path/filepath" "strings" + + "github.com/pkg/errors" + + "github.com/kubesphere/kubekey/pkg/common" + "github.com/kubesphere/kubekey/pkg/core/connector" + "github.com/kubesphere/kubekey/pkg/core/logger" + coreutil "github.com/kubesphere/kubekey/pkg/core/util" ) type DownloadISOFile struct { @@ -107,6 +109,11 @@ func (a *ArchiveDependencies) Execute(runtime connector.Runtime) error { if err := coreutil.Tar(src, a.Manifest.Arg.Output, src); err != nil { return errors.Wrapf(errors.WithStack(err), "archive %s failed", src) } + + // remove the src directory + if err := os.RemoveAll(src); err != nil { + return errors.Wrapf(errors.WithStack(err), "remove %s failed", src) + } return nil }