Merge pull request #1317 from 24sama/master

Fix: remove kubekey/artifact dir after exporting an artifact
This commit is contained in:
KubeSphere CI Bot 2022-06-07 14:55:38 +08:00 committed by GitHub
commit 68c2f94cf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}