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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -34,16 +35,7 @@ func ConfigTmpDir() (string, error) {
|
||||||
configdir = fp
|
configdir = fp
|
||||||
}
|
}
|
||||||
|
|
||||||
td := filepath.Join(configdir, "tmp")
|
td, err := ioutil.TempDir(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
|
|
||||||
}
|
|
||||||
log.Printf("Set Packer temp dir to %s", td)
|
log.Printf("Set Packer temp dir to %s", td)
|
||||||
return td, nil
|
return td, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue