Skip to content

Commit

Permalink
Fix share mount path
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Aug 16, 2022
1 parent 8c77473 commit 42c9a51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions src/main/groovy/io/seqera/wave/service/k8s/K8sServiceImpl.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -168,21 +168,17 @@ class K8sServiceImpl implements K8sService {
protected V1VolumeMount mountBuildStorage(Path workDir, @Nullable String storageMountPath) {
assert workDir, "K8s mount build storage is mandatory"

final vol = new V1VolumeMount()
.name('build-data')
.mountPath(workDir.toString())

if( storageMountPath ) {
final vol = new V1VolumeMount()
.name('build-data')
.mountPath(storageMountPath)
// check sub-path
final rel = Path.of(storageMountPath).relativize(workDir).toString()
if( rel )
if (rel)
vol.subPath(rel)
return vol
}
else {
return new V1VolumeMount()
.name('build-data')
.mountPath(workDir.toString())
}
return vol
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class K8sServiceImplTest extends Specification {
result = k8sService.mountBuildStorage(Path.of('/foo/work/x1'), '/foo')
then:
result.name == 'build-data'
result.mountPath == '/foo'
result.mountPath == '/foo/work/x1'
result.subPath == 'work/x1'

when:
Expand Down

0 comments on commit 42c9a51

Please sign in to comment.