Skip to content

Commit 84d14f7

Browse files
committed
Make AdoBuildRunner work on job retries
1 parent d7aeee4 commit 84d14f7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Public/Src/Tools/AdoBuildRunner/Program.cs

+8
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ public static async Task<int> Main(string[] args)
119119
$"and to communicate the build information to the worker pipeline");
120120
}
121121

122+
var attemptNumber = Environment.GetEnvironmentVariable(Constants.JobAttemptVariableName) ?? "1";
123+
if (int.TryParse(attemptNumber, out var jobAttempt) && jobAttempt > 1)
124+
{
125+
// The job was rerun. Let's change the invocation key to reflect that
126+
// so we don't conflict with the first run.
127+
invocationKey += $"__jobretry_{jobAttempt}";
128+
}
129+
122130
var buildContext = await api.GetBuildContextAsync(invocationKey);
123131
var buildManager = new WorkerPipelineBuildManager(api, executor, buildContext, args, logger);
124132
return await buildManager.BuildAsync(isOrchestrator);

0 commit comments

Comments
 (0)