Merge pull request #1320 from tgstation/AutoUpdateRepoCommitTrackingBS [TGSDeploy]

v4.14.2 fix batch
This commit is contained in:
Jordan Brown
2021-09-06 11:11:07 -04:00
committed by GitHub
3 changed files with 23 additions and 10 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<!-- Integration tests will ensure they match across the board -->
<Import Project="ControlPanelVersion.props" />
<PropertyGroup>
<TgsCoreVersion>4.14.1</TgsCoreVersion>
<TgsCoreVersion>4.14.2</TgsCoreVersion>
<TgsConfigVersion>4.0.0</TgsConfigVersion>
<TgsApiVersion>9.2.0</TgsApiVersion>
<TgsApiLibraryVersion>9.2.0</TgsApiLibraryVersion>
@@ -501,7 +501,10 @@ namespace Tgstation.Server.Host.Components.Chat
: $"TGS: Updating to version {updateVersion}...";
List<ulong> wdChannels;
lock (mappedChannels) // so it doesn't change while we're using it
wdChannels = mappedChannels.Select(x => x.Key).ToList();
wdChannels = mappedChannels
.Where(x => !x.Value.Channel.IsPrivateChannel)
.Select(x => x.Key)
.ToList();
return SendMessage(message, wdChannels, cancellationToken);
}
@@ -308,19 +308,22 @@ namespace Tgstation.Server.Host.Components
cancellationToken)
.ConfigureAwait(false);
Task<RevisionInformation> LoadRevInfo() => databaseContext.RevisionInformations
.AsQueryable()
.Where(x => x.CommitSha == startSha && x.Instance.Id == metadata.Id)
.Include(x => x.ActiveTestMerges).ThenInclude(x => x.TestMerge)
.FirstOrDefaultAsync(cancellationToken);
RevisionInformation currentRevInfo = null;
var hasDbChanges = false;
RevisionInformation currentRevInfo = null;
Models.Instance attachedInstance = null;
async Task UpdateRevInfo(string currentHead, bool onOrigin, IEnumerable<RevInfoTestMerge> updatedTestMerges)
{
if (currentRevInfo == null)
currentRevInfo = await LoadRevInfo().ConfigureAwait(false);
{
logger.LogTrace("Loading revision info for commit {0}...", startSha.Substring(0, 7));
currentRevInfo = await databaseContext
.RevisionInformations
.AsQueryable()
.Where(x => x.CommitSha == startSha && x.Instance.Id == metadata.Id)
.Include(x => x.ActiveTestMerges)
.ThenInclude(x => x.TestMerge)
.FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false);
}
if (currentRevInfo == default)
{
@@ -328,6 +331,12 @@ namespace Tgstation.Server.Host.Components
onOrigin = true;
}
if (currentRevInfo.CommitSha == currentHead)
{
logger.LogTrace("Not updating rev-info, already in DB.");
return;
}
if (attachedInstance == null)
{
attachedInstance = new Models.Instance
@@ -347,6 +356,7 @@ namespace Tgstation.Server.Host.Components
: await repo.GetOriginSha(cancellationToken).ConfigureAwait(false),
Instance = attachedInstance,
};
if (!onOrigin)
currentRevInfo.ActiveTestMerges = new List<RevInfoTestMerge>(
updatedTestMerges ?? oldRevInfo.ActiveTestMerges);