Commit b6ae6019 authored by Tero Pihlaja's avatar Tero Pihlaja
parents a8e9dc39 7b4ff6f3
Pipeline #53900623 passed with stages
in 35 minutes and 57 seconds
......@@ -507,11 +507,8 @@ func fakeContainer(id string, names ...string) *types.Container {
func (e *executor) createBuildVolume() error {
// Cache Git sources:
// take path of the projects directory,
// because we use `rm -rf` which could remove the mounted volume
parentDir := path.Dir(e.Build.FullProjectDir())
if !filepath.IsAbs(parentDir) && parentDir != "/" {
// use a `BuildsDir`
if !filepath.IsAbs(e.Build.RootDir) || e.Build.RootDir == "/" {
return errors.New("build directory needs to be absolute and non-root path")
}
......@@ -521,11 +518,11 @@ func (e *executor) createBuildVolume() error {
if e.Build.GetGitStrategy() == common.GitFetch && !e.Config.Docker.DisableCache {
// create persistent cache container
return e.addVolume(parentDir)
return e.addVolume(e.Build.RootDir)
}
// create temporary cache container
id, err := e.createCacheVolume("", parentDir)
id, err := e.createCacheVolume("", e.Build.RootDir)
if err != nil {
return err
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment