From ccdb151909f0a30c208a8587f586d748563b6701 Mon Sep 17 00:00:00 2001 From: Michael Yuan <160265179+yuanmich2@users.noreply.github.com> Date: Wed, 5 Aug 2026 16:28:00 -0700 Subject: [PATCH] feat: added queue environment example that can be used to create junctions Signed-off-by: Michael Yuan <160265179+yuanmich2@users.noreply.github.com> --- .../windows_path_limit_junction_fix.yaml | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 queue_environments/windows_path_limit_junction_fix.yaml diff --git a/queue_environments/windows_path_limit_junction_fix.yaml b/queue_environments/windows_path_limit_junction_fix.yaml new file mode 100644 index 00000000..7e0db977 --- /dev/null +++ b/queue_environments/windows_path_limit_junction_fix.yaml @@ -0,0 +1,85 @@ +specificationVersion: 'environment-2023-09' +parameterDefinitions: +- name: JunctionPath + type: STRING + default: 'C:\tmp\dc-root' + description: > + The short path where the junction will be created. This path will point to + the session's assetroot folder, allowing applications with MAX_PATH limitations + (such as After Effects) to access files through a shorter path. +environment: + name: Assetroot Junction Creation + description: | + Creates a Windows directory junction from a short configurable path to the + session's assetroot folder, and sets the DEADLINE_ASSETROOT_ALIAS environment + variable so that compatible job scripts can rewrite file paths through the + junction. + + This works around the Windows MAX_PATH (260 character) limitation for + applications that use legacy Win32 APIs (e.g. Adobe After Effects, Cinema4D). + + The junction is removed when the session ends. + + This queue environment is only effective on Windows workers. On non-Windows + workers the onEnter script exits successfully without creating a junction. + script: + actions: + onEnter: + command: powershell + args: + - "{{Env.File.Enter}}" + onExit: + command: powershell + args: + - "{{Env.File.Exit}}" + embeddedFiles: + - name: Enter + filename: junction-enter.ps1 + type: TEXT + data: | + $ErrorActionPreference = 'Stop' + $junctionPath = '{{Param.JunctionPath}}' + + # Ensure parent directory exists + $parentDir = Split-Path $junctionPath -Parent + if (!(Test-Path $parentDir)) { + New-Item -ItemType Directory -Path $parentDir | Out-Null + } + + # Remove stale junction if it exists + if (Test-Path $junctionPath) { + cmd /c "rmdir $junctionPath" + if (Test-Path $junctionPath) { + Write-Error "Failed to remove stale junction at $junctionPath" + exit 1 + } + } + + # Find the assetroot folder in the session working directory + $sessionDir = $PWD.Path + $assetroot = Get-ChildItem $sessionDir -Directory | Where-Object { $_.Name -like 'assetroot-*' } | Select-Object -First 1 + if (!$assetroot) { + Write-Error "No assetroot folder found in session directory: $sessionDir" + exit 1 + } + + # Create junction + $result = cmd /c "mklink /J $junctionPath $($assetroot.FullName)" 2>&1 + if (!(Test-Path $junctionPath)) { + Write-Error "Failed to create junction: $result" + exit 1 + } + + Write-Host "Junction created: $junctionPath -> $($assetroot.FullName)" + + # Set the environment variable for downstream job scripts + Write-Host "openjd_env: DEADLINE_ASSETROOT_ALIAS=$junctionPath" + - name: Exit + filename: junction-exit.ps1 + type: TEXT + data: | + $junctionPath = '{{Param.JunctionPath}}' + if (Test-Path $junctionPath) { + cmd /c "rmdir $junctionPath" + Write-Host "Junction removed: $junctionPath" + }