Merged PR 709934: Revert "Merged PR 708176: Simplify command line config for redirecting user p...

Revert "Merged PR 708176: Simplify command line config for redirecting user profiles"

This reverts commit 1cdac5db2d.
This commit is contained in:
Pasindu Gunasekara 🍣 2023-03-29 20:33:39 +00:00
Родитель 76b53ae11d
Коммит c0c7ab7190
4 изменённых файлов: 37 добавлений и 10 удалений

Просмотреть файл

@ -49,6 +49,8 @@ namespace BuildXL
/// </summary>
public const string LastBuiltCachedGraphName = "lastbuild";
private const string RedirectedUserProfileLocationInCloudBuild = @"d:\dbs";
private readonly IConsole m_console;
private readonly bool m_shouldDisposeConsole;
@ -201,6 +203,7 @@ namespace BuildXL
bool unsafeUnexpectedFileAccessesAreErrorsSet = false;
bool failPipOnFileAccessErrorSet = false;
bool? enableProfileRedirect = null;
ContentHashingUtilities.SetDefaultHashType();
// Notes
@ -925,6 +928,9 @@ namespace BuildXL
"qualifier",
"q",
opt => ParseStringOption(opt, startupConfiguration.QualifierIdentifiers)),
OptionHandlerFactory.CreateBoolOption(
"redirectUserProfile",
opt => enableProfileRedirect = opt),
OptionHandlerFactory.CreateOption(
"redirectedUserProfileJunctionRoot",
opt => layoutConfiguration.RedirectedUserProfileJunctionRoot = CommandLineUtilities.ParsePathOption(opt, pathTable)),
@ -1560,12 +1566,39 @@ namespace BuildXL
// Forcefully disable incremental scheduling in CB.
schedulingConfiguration.IncrementalScheduling = false;
// if not explicitly disabled, enable user profile redirect and force the location
if (!enableProfileRedirect.HasValue || enableProfileRedirect.Value)
{
layoutConfiguration.RedirectedUserProfileJunctionRoot = AbsolutePath.Create(pathTable, RedirectedUserProfileLocationInCloudBuild);
enableProfileRedirect = true;
}
if (!frontEndConfiguration.EnableCredScan.HasValue)
{
frontEndConfiguration.EnableCredScan = true;
}
}
if (!OperatingSystemHelper.IsUnixOS)
{
// if /enableProfileRedirect was set, RedirectedUserProfileJunctionRoot must have been set as well
// (either explicitly via /redirectedUserProfilePath argument or implicitly via /inCloudBuild flag)
if (enableProfileRedirect.HasValue && enableProfileRedirect.Value && !layoutConfiguration.RedirectedUserProfileJunctionRoot.IsValid)
{
throw CommandLineUtilities.Error(Strings.Args_ProfileRedirectEnabled_NoPathProvided);
}
if (!enableProfileRedirect.HasValue || enableProfileRedirect.HasValue && !enableProfileRedirect.Value)
{
layoutConfiguration.RedirectedUserProfileJunctionRoot = AbsolutePath.Invalid;
}
}
else
{
// profile redirection only happens on Windows
layoutConfiguration.RedirectedUserProfileJunctionRoot = AbsolutePath.Invalid;
}
if (OperatingSystemHelper.IsUnixOS)
{
// Non Windows OS doesn't support admin-required process external execution mode.

Просмотреть файл

@ -897,12 +897,6 @@ namespace BuildXL
HelpLevel.Verbose
);
hw.WriteOption(
"/redirectedUserProfileJunctionRoot:<path>",
Strings.HelpText_DisplayHelp_RedirectedUserProfileJunctionRoot,
HelpLevel.Verbose
);
#endregion
hw.WriteBanner(

Просмотреть файл

@ -994,6 +994,9 @@ Example: ad2d42d2ec5d2ca0c0b7ad65402d07c7ef40b91e</value>
<data name="HelpText_DisplayHelp_PosixDeleteMode" xml:space="preserve">
<value>Controls the applicability of file/directory deletion using POSIX delete. Allowed values are NoRun, RunFirst, and RunLast. Defaults for Windows is RunLast, and for Unix is RunFirst</value>
</data>
<data name="Args_ProfileRedirectEnabled_NoPathProvided" xml:space="preserve">
<value>User profile redirect was enabled (/enableProfileRedirect+) but the path to the redirected user profile was not set. Please use /RedirectedUserProfileJunctionRoot:&lt;path&gt; to set the path under which a junction to the real user profile will be created.</value>
</data>
<data name="HelpText_DisplayHelp_RunInContainerAndAllowDoubleWrites" xml:space="preserve">
<value>Configures the default for all scheduled pips to run in a container with output isolation, allowing double writes to occur. Individual pips can override this setting. This is an unsafe option.</value>
</data>
@ -1141,7 +1144,4 @@ Example: ad2d42d2ec5d2ca0c0b7ad65402d07c7ef40b91e</value>
<data name="HelpText_DisplayHelp_AlwaysRemoteInjectDetoursFrom32BitProcess" xml:space="preserve">
<value>Always use remote detours injection when launching processes from a 32-bit process. Defaults to true.</value>
</data>
<data name="HelpText_DisplayHelp_RedirectedUserProfileJunctionRoot" xml:space="preserve">
<value>When a path is set, the build engine will create a junction from a subdirectory of this path to the actual Windows user profile directory. Processes in the build will be routed to use this redirected user profile instead of the real one to help keep paths stable.</value>
</data>
</root>

Просмотреть файл

@ -75,7 +75,7 @@ set SMDB.CACHE_TEMPLATE_PATH=%TEST_SOLUTION_ROOT%\Out\SharedCache
set BuildXLExportFileDetails=1
set BUILDXL_MASTER_ARGS=/maxProc:2 /replicateOutputsToWorkers %BUILDXL_MASTER_ARGS%
set BUILDXL_WORKER_ARGS=/maxProc:6 %BUILDXL_WORKER_ARGS%
set BUILDXL_COMMON_ARGS=/server- /inCloudBuild /remoteTelemetry- /enableAsyncLogging /historicMetadataCache "/storageRoot:{objectRoot}:\ " "/config:{sourceRoot}:\Config.dsc" "/cacheConfigFilePath:%SMDB.CACHE_CONFIG_OUTPUT_PATH%" "/rootMap:{sourceRoot}=%TEST_SOLUTION_ROOT%\TestSolution" "/rootMap:{objectRoot}=%TEST_SOLUTION_ROOT%\Out\M{machineNumber}" "/cacheDirectory:{objectRoot}:\Cache" "/p:TestCscToolPath=%ProgramFiles(x86)%\MSBuild\14.0\Bin" /p:BuildXLGrpcVerbosityEnabled=1 /parameter:BuildXLGrpcVerbosityLevel=1 /verifyCacheLookupPin /disableProcessRetryOnResourceExhaustion+
set BUILDXL_COMMON_ARGS=/server- /inCloudBuild /remoteTelemetry- /redirectUserProfile- /enableAsyncLogging /historicMetadataCache "/storageRoot:{objectRoot}:\ " "/config:{sourceRoot}:\Config.dsc" "/cacheConfigFilePath:%SMDB.CACHE_CONFIG_OUTPUT_PATH%" "/rootMap:{sourceRoot}=%TEST_SOLUTION_ROOT%\TestSolution" "/rootMap:{objectRoot}=%TEST_SOLUTION_ROOT%\Out\M{machineNumber}" "/cacheDirectory:{objectRoot}:\Cache" "/p:TestCscToolPath=%ProgramFiles(x86)%\MSBuild\14.0\Bin" /p:BuildXLGrpcVerbosityEnabled=1 /parameter:BuildXLGrpcVerbosityLevel=1 /verifyCacheLookupPin /disableProcessRetryOnResourceExhaustion+
REM Add subst source/target to ensure real path to logs are printed on console
set BUILDXL_COMMON_ARGS=%BUILDXL_COMMON_ARGS% /substTarget:{objectRoot}:\ /substSource:"%TEST_SOLUTION_ROOT%\Out\M{machineNumber}"