use a unique temp dir for each build to prevent concurrent builds from stomping on each other
This commit is contained in:
parent
c138edcbe1
commit
7c41244e15
|
@ -3,6 +3,7 @@ package docker
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -34,16 +35,7 @@ func ConfigTmpDir() (string, error) {
|
|||
configdir = fp
|
||||
}
|
||||
|
||||
td := filepath.Join(configdir, "tmp")
|
||||
_, err = os.Stat(td)
|
||||
if os.IsNotExist(err) {
|
||||
log.Printf("Creating tempdir in %s", td)
|
||||
if err = os.MkdirAll(td, 0755); err != nil {
|
||||
return "", err
|
||||
}
|
||||
} else if err != nil {
|
||||
return "", err
|
||||
}
|
||||
td, err := ioutil.TempDir(configdir, "tmp")
|
||||
log.Printf("Set Packer temp dir to %s", td)
|
||||
return td, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue