Fix archive path
All checks were successful
Unittests / unittests (push) Successful in 14s
Unittests / deploy-dev (push) Successful in 1m0s

This commit is contained in:
Adam Štrauch 2023-12-13 17:45:17 +01:00
parent 036587a77a
commit 02cdf5f815
Signed by: cx
GPG Key ID: 7262DAFE292BCE20

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"os" "os"
"os/exec" "os/exec"
"path"
"strings" "strings"
"time" "time"
@ -220,8 +221,10 @@ func (p *Processor) volumeFromURL(url string, container *docker.Container) error
} }
// Download the archive // Download the archive
archivePath := path.Join(volumePath, "archive.tar.zst")
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.zst") f, err := os.Create(archivePath)
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)
} }
@ -243,7 +246,7 @@ func (p *Processor) volumeFromURL(url string, container *docker.Container) error
log.Printf("%s: extracting archive\n", container.App.Name) log.Printf("%s: extracting archive\n", container.App.Name)
// Call tar xf archive.tar.zst -C /volume // Call tar xf archive.tar.zst -C /volume
cmd := exec.Command("tar", "-xf", "archive.tar.zst", "-C", volumePath) cmd := exec.Command("tar", "-xf", archivePath, "-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)