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