Use tar to restore instead of archiver
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Adam Štrauch 2022-07-22 19:49:37 +02:00
parent 37d884e665
commit 96071cdfcb
Signed by: cx
GPG Key ID: 018304FFA8988F8D

View File

@ -11,7 +11,6 @@ import (
"strings" "strings"
"time" "time"
"github.com/mholt/archiver/v3"
"github.com/rosti-cz/node-api/apps/drivers" "github.com/rosti-cz/node-api/apps/drivers"
uuid "github.com/satori/go.uuid" uuid "github.com/satori/go.uuid"
) )
@ -138,7 +137,7 @@ func (s *SnapshotProcessor) CreateSnapshot(appName string, labels []string) (str
return snapshot.KeyName(s.IndexLabel), fmt.Errorf("change working directory error: %v", err) return snapshot.KeyName(s.IndexLabel), fmt.Errorf("change working directory error: %v", err)
} }
err = exec.Command("/usr/bin/tar", "-acvf", tmpSnapshotArchivePath, "./").Run() err = exec.Command("/usr/bin/tar", "-acf", tmpSnapshotArchivePath, "./").Run()
if err != nil { if err != nil {
return snapshot.KeyName(s.IndexLabel), fmt.Errorf("compression error: %v", err) return snapshot.KeyName(s.IndexLabel), fmt.Errorf("compression error: %v", err)
} }
@ -192,18 +191,7 @@ func (s *SnapshotProcessor) RestoreSnapshot(key string, newAppName string) error
return fmt.Errorf("getting the archive from S3 error: %v", err) return fmt.Errorf("getting the archive from S3 error: %v", err)
} }
archive := archiver.TarZstd{ err = exec.Command("/usr/bin/tar", "-axf", tmpSnapshotArchivePath).Run()
Tar: &archiver.Tar{
MkdirAll: true,
ContinueOnError: true,
OverwriteExisting: false,
ImplicitTopLevelFolder: false,
},
// CompressionLevel: 6,
// SelectiveCompression: true,
}
err = archive.Unarchive(tmpSnapshotArchivePath, "./")
if err != nil { if err != nil {
return fmt.Errorf("unarchiving error: %v", err) return fmt.Errorf("unarchiving error: %v", err)
} }