Fix shell executor not working with variables that use file variables
What does this MR do?
When using the shell executor, file variables that reference other file variables (e.g., MY_FILE_VAR: $FILE_TEST) were incorrectly getting a $PWD/ prefix, resulting in paths like:
$PWD/$FILE_TEST
This caused "No such file or directory" errors because the shell would not expand the nested variable reference correctly.
The root cause was that the shell executor was using relative paths for BuildDir (e.g., "builds/...") instead of absolute paths. This caused the following chain of issues:
-
TmpProjectDir()returns a relative path - When creating file variables,
TmpFile()->Absolute()prepends$PWD/to relative paths - File variables get paths like
$PWD/builds/.../FILE_TEST - When
MY_FILE_VAR: $FILE_TESTis processed, the literal string$FILE_TESTdoesn't match the temp file check - It also goes through Absolute() and becomes
$PWD/$FILE_TEST
The fix ensures DefaultBuildsDir and DefaultCacheDir are converted
to absolute paths during the Prepare() phase by joining them with
the current working directory if they are relative.
This makes the shell executor behavior consistent with the Docker executor, which already uses absolute paths.
This was a regression introduced by !5912 (merged).
Relates to #39124 (closed)
Changelog: fixed