runtime/local: fix unknown dir path (#1964)
Co-authored-by: Asim Aslam <asim@aslam.me> Co-authored-by: Janos Dobronszki <dobronszki@gmail.com>
This commit is contained in:
parent
21004341bf
commit
0adb469a85
@ -75,8 +75,9 @@ func (r *localRuntime) checkoutSourceIfNeeded(s *runtime.Service, secrets map[st
|
|||||||
sourceParts := strings.Split(s.Source, "/")
|
sourceParts := strings.Split(s.Source, "/")
|
||||||
compressedFilepath := filepath.Join(SourceDir, sourceParts[0])
|
compressedFilepath := filepath.Join(SourceDir, sourceParts[0])
|
||||||
uncompressPath := strings.ReplaceAll(compressedFilepath, ".tar.gz", "")
|
uncompressPath := strings.ReplaceAll(compressedFilepath, ".tar.gz", "")
|
||||||
|
tarName := strings.ReplaceAll(sourceParts[0], ".tar.gz", "")
|
||||||
if len(sourceParts) > 1 {
|
if len(sourceParts) > 1 {
|
||||||
uncompressPath = filepath.Join(SourceDir, strings.ReplaceAll(sourceParts[0], ".tar.gz", ""))
|
uncompressPath = filepath.Join(SourceDir, tarName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the directory already exists
|
// check if the directory already exists
|
||||||
@ -98,7 +99,7 @@ func (r *localRuntime) checkoutSourceIfNeeded(s *runtime.Service, secrets map[st
|
|||||||
fullp := append([]string{uncompressPath}, sourceParts[1:]...)
|
fullp := append([]string{uncompressPath}, sourceParts[1:]...)
|
||||||
s.Source = filepath.Join(append(fullp, lastFolderPart)...)
|
s.Source = filepath.Join(append(fullp, lastFolderPart)...)
|
||||||
} else {
|
} else {
|
||||||
s.Source = uncompressPath
|
s.Source = filepath.Join(uncompressPath, tarName)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user