Change suffix to .tar.zst
All checks were successful
Unittests / unittests (push) Successful in 17s
Unittests / deploy-dev (push) Successful in 1m7s

This commit is contained in:
Adam Štrauch 2023-12-13 17:32:20 +01:00
parent 9564118f40
commit 6d62b200a4
Signed by: cx
GPG Key ID: 7262DAFE292BCE20

View File

@ -206,9 +206,9 @@ func (p *Processor) Get(noUpdate bool) (apps.App, error) {
// Takes URL with an tar archive and prepares container's volume from it. // Takes URL with an tar archive and prepares container's volume from it.
func (p *Processor) volumeFromURL(url string, container *docker.Container) error { func (p *Processor) volumeFromURL(url string, container *docker.Container) error {
// Validation, check if url ends with tar.zstd // Validation, check if url ends with tar.zst
if !strings.HasSuffix(url, ".tar.zstd") { if !strings.HasSuffix(url, ".tar.zst") {
return fmt.Errorf("archive has to end with .tar.zstd") return fmt.Errorf("archive has to end with .tar.zst")
} }
volumePath := container.VolumeHostPath() volumePath := container.VolumeHostPath()
@ -221,7 +221,7 @@ func (p *Processor) volumeFromURL(url string, container *docker.Container) error
// Download the archive // Download the archive
log.Printf("%s: downloading archive from %s\n", container.App.Name, url) log.Printf("%s: downloading archive from %s\n", container.App.Name, url)
f, err := os.Create(volumePath + "/archive.tar.zstd") f, err := os.Create(volumePath + "/archive.tar.zst")
if err != nil { if err != nil {
return fmt.Errorf("failed to create archive file: %v", err) return fmt.Errorf("failed to create archive file: %v", err)
} }
@ -242,8 +242,8 @@ func (p *Processor) volumeFromURL(url string, container *docker.Container) error
// Extract the archive // Extract the archive
log.Printf("%s: extracting archive\n", container.App.Name) log.Printf("%s: extracting archive\n", container.App.Name)
// Call tar xf archive.tar.zstd -C /volume // Call tar xf archive.tar.zst -C /volume
cmd := exec.Command("tar", "-I", "zstd", "-xf", "archive.tar.zstd", "-C", volumePath) cmd := exec.Command("tar", "-I", "zstd", "-xf", "archive.tar.zst", "-C", volumePath)
err = cmd.Run() err = cmd.Run()
if err != nil { if err != nil {
log.Printf("%s: failed to extract archive: %v", container.App.Name, err) log.Printf("%s: failed to extract archive: %v", container.App.Name, err)
@ -252,7 +252,7 @@ func (p *Processor) volumeFromURL(url string, container *docker.Container) error
// Remove archive // Remove archive
log.Printf("%s: removing archive\n", container.App.Name) log.Printf("%s: removing archive\n", container.App.Name)
err = os.Remove(volumePath + "/archive.tar.zstd") err = os.Remove(volumePath + "/archive.tar.zst")
if err != nil { if err != nil {
return fmt.Errorf("failed to remove archive: %v", err) return fmt.Errorf("failed to remove archive: %v", err)
} }