mirror of
https://github.com/actions/runner-container-hooks.git
synced 2025-12-14 00:26:44 +00:00
user volume mount fix based on workspacePath
This commit is contained in:
@@ -43,15 +43,22 @@ export function containerVolumes(
|
||||
return mounts
|
||||
}
|
||||
|
||||
const workspacePath = process.env.GITHUB_WORKSPACE as string
|
||||
for (const userVolume of userMountVolumes) {
|
||||
const sourceVolumePath = `${
|
||||
path.isAbsolute(userVolume.sourceVolumePath)
|
||||
? userVolume.sourceVolumePath
|
||||
: path.join(
|
||||
process.env.GITHUB_WORKSPACE as string,
|
||||
userVolume.sourceVolumePath
|
||||
)
|
||||
}`
|
||||
let sourceVolumePath = ''
|
||||
if (path.isAbsolute(userVolume.sourceVolumePath)) {
|
||||
if (!userVolume.sourceVolumePath.startsWith(workspacePath)) {
|
||||
throw new Error(
|
||||
'absolute path volume mounts outside of the work folder are not supported'
|
||||
)
|
||||
}
|
||||
sourceVolumePath = userVolume.sourceVolumePath
|
||||
} else {
|
||||
sourceVolumePath = path.join(
|
||||
process.env.GITHUB_WORKSPACE as string,
|
||||
userVolume.sourceVolumePath
|
||||
)
|
||||
}
|
||||
|
||||
mounts.push({
|
||||
name: POD_VOLUME_NAME,
|
||||
|
||||
Reference in New Issue
Block a user