Merged PR 784931: Use the ADO invocation key as part of the fingerprint store key for cache miss analysis

In a pipeline with two "kinds" of builds (say, "debug" and "ship"), it is better to split the FP store namespace between these two builds: this makes for a better comparison, always against the latest FP store of a build of that same "kind"
This commit is contained in:
Marcelo Lynch 🧉 2024-05-17 21:21:07 +00:00
Родитель f84859241a
Коммит 6300c786a8
1 изменённых файлов: 22 добавлений и 12 удалений

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

@ -103,12 +103,14 @@ namespace BuildXL.AdoBuildRunner.Build
Logger.Info($@"Launching distributed build as orchestrator");
return ExecuteBuild(
buildContext,
buildArguments.Concat(new[]
{
GetDefaultArguments().
Concat(buildArguments)
.Concat(
[
$"/distributedBuildRole:orchestrator",
$"/distributedBuildServicePort:{Constants.MachineGrpcPort}",
$"/relatedActivityId:{relatedSessionId}"
}),
]),
buildContext.SourcesDirectory
);
}
@ -117,27 +119,35 @@ namespace BuildXL.AdoBuildRunner.Build
public int ExecuteDistributedBuildAsWorker(BuildContext buildContext, BuildInfo buildInfo, string[] buildArguments)
{
Logger.Info($@"Launching distributed build as worker");
return ExecuteBuild(
buildContext,
// By default, set the timeout to 20min in the workers to avoid unnecessary waiting upon connection failures
// (defaults are placed in front of user-provided arguments).
new[]
{
"/p:BuildXLWorkerAttachTimeoutMin=20"
}
GetDefaultArguments()
.Concat(buildArguments)
.Concat(new[]
{
.Concat(
[
$"/distributedBuildRole:worker",
$"/distributedBuildServicePort:{Constants.MachineGrpcPort}",
$"/distributedBuildOrchestratorLocation:{buildInfo.OrchestratorLocation}:{Constants.MachineGrpcPort}",
$"/relatedActivityId:{buildInfo.RelatedSessionId}"
}),
]),
buildContext.SourcesDirectory
);
}
private string[] GetDefaultArguments()
{
var invocationKey = Environment.GetEnvironmentVariable(Constants.AdoBuildRunnerInvocationKey);
var cacheMissOption = string.IsNullOrEmpty(invocationKey) ? "/cacheMiss+" : $"/cacheMiss:{invocationKey}";
return [
// By default, set the timeout to 20min in the workers to avoid unnecessary waiting upon connection failures
"/p:BuildXLWorkerAttachTimeoutMin=20",
// By default, enable cache miss analysis and pass the invocation key as a prefix
cacheMissOption
];
}
/// <inheritdoc />
public void InitializeAsWorker(BuildContext buildContext, string[] buildArguments)
{