start calling run service for job completion (#2412)

* start calling run service for job completion

* cleanup

* nit: lines

Co-authored-by: Tingluo Huang <[email protected]>

* clean up

* give sanity back to thboop

Co-authored-by: Thomas Boop <[email protected]>

* add clean up back

* clean up

* clean up more

* oops

* copied from existing, but :thumb:

Co-authored-by: Thomas Boop <[email protected]>

---------

Co-authored-by: Tingluo Huang <[email protected]>
Co-authored-by: Thomas Boop <[email protected]>
This commit is contained in:
Yashwanth Anantharaju
2023-02-01 21:18:31 +00:00
committed by GitHub
co-authored by Tingluo Huang Thomas Boop
parent 24a27efd4f
commit e6e5f36dd0
11 changed files with 220 additions and 78 deletions
+8 -1
View File
@@ -5,7 +5,6 @@ using GitHub.DistributedTask.Pipelines;
using GitHub.DistributedTask.WebApi;
using GitHub.Runner.Sdk;
using GitHub.Services.Common;
using GitHub.Services.WebApi;
using Sdk.WebApi.WebApi.RawClient;
namespace GitHub.Runner.Common
@@ -16,6 +15,8 @@ namespace GitHub.Runner.Common
Task ConnectAsync(Uri serverUrl, VssCredentials credentials);
Task<AgentJobRequestMessage> GetJobMessageAsync(string id, CancellationToken token);
Task CompleteJobAsync(Guid planId, Guid jobId, CancellationToken token);
}
public sealed class RunServer : RunnerService, IRunServer
@@ -55,5 +56,11 @@ namespace GitHub.Runner.Common
return jobMessage;
}
public Task CompleteJobAsync(Guid planId, Guid jobId, CancellationToken cancellationToken)
{
CheckConnection();
return RetryRequest(
async () => await _runServiceHttpClient.CompleteJobAsync(requestUri, planId, jobId, cancellationToken), cancellationToken);
}
}
}