Merge pull request #1404 from tgstation/1403-FixRepoCancellationTokens [TGSDeploy]

Fix repository update job cancellation tokens (5.1.4)
This commit is contained in:
Jordan Dominion
2022-10-04 20:37:43 -04:00
committed by GitHub
2 changed files with 7 additions and 8 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<!-- Integration tests will ensure they match across the board -->
<Import Project="ControlPanelVersion.props" />
<PropertyGroup>
<TgsCoreVersion>5.1.3</TgsCoreVersion>
<TgsCoreVersion>5.1.4</TgsCoreVersion>
<TgsConfigVersion>4.4.0</TgsConfigVersion>
<TgsApiVersion>9.6.0</TgsApiVersion>
<TgsApiLibraryVersion>10.0.0</TgsApiLibraryVersion>
@@ -551,7 +551,7 @@ namespace Tgstation.Server.Host.Controllers
}
if (needsUpdate)
await databaseContext.Save(cancellationToken);
await databaseContext.Save(ct);
});
await CallLoadRevInfo();
@@ -573,7 +573,7 @@ namespace Tgstation.Server.Host.Controllers
var fastForward = await repo.MergeOrigin(committerName, currentModel.CommitterEmail, NextProgressReporter("Merge Origin"), ct);
if (!fastForward.HasValue)
throw new JobException(ErrorCode.RepoMergeConflict);
lastRevisionInfo.OriginCommitSha = await repo.GetOriginSha(cancellationToken);
lastRevisionInfo.OriginCommitSha = await repo.GetOriginSha(ct);
await UpdateRevInfo();
if (fastForward.Value)
{
@@ -608,7 +608,7 @@ namespace Tgstation.Server.Host.Controllers
if (validCheckoutSha || validCheckoutReference)
{
var committish = model.CheckoutSha ?? model.Reference;
var isSha = await repo.IsSha(committish, cancellationToken);
var isSha = await repo.IsSha(committish, ct);
if ((isSha && model.Reference != null) || (!isSha && model.CheckoutSha != null))
throw new JobException(ErrorCode.RepoSwappedShaOrReference);
@@ -713,7 +713,7 @@ namespace Tgstation.Server.Host.Controllers
&& x.ActiveTestMerges.Count > 0)
.Include(x => x.ActiveTestMerges)
.ThenInclude(x => x.TestMerge)
.ToListAsync(cancellationToken));
.ToListAsync(ct));
// split here cause this bit has to be done locally
revInfoWereLookingFor = dbPull
@@ -796,7 +796,7 @@ namespace Tgstation.Server.Host.Controllers
{
// goteem
Logger.LogDebug("Reusing existing SHA {0}...", revInfoWereLookingFor.CommitSha);
await repo.ResetToSha(revInfoWereLookingFor.CommitSha, NextProgressReporter($"Reset to {revInfoWereLookingFor.CommitSha[..7]}"), cancellationToken);
await repo.ResetToSha(revInfoWereLookingFor.CommitSha, NextProgressReporter($"Reset to {revInfoWereLookingFor.CommitSha[..7]}"), ct);
lastRevisionInfo = revInfoWereLookingFor;
}
@@ -913,8 +913,7 @@ namespace Tgstation.Server.Host.Controllers
databaseContextFactory,
progressReporter,
ct),
cancellationToken)
;
cancellationToken);
api.ActiveJob = job.ToApi();
return Accepted(api);