From 8080cc8af97504e0d7ff514f64e9aac1756f7b8c Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 8 Sep 2021 14:55:14 -0400 Subject: [PATCH 1/9] Update Remora.Discord to 3.0.58 --- .../Components/Chat/Providers/DiscordProvider.cs | 3 +-- src/Tgstation.Server.Host/Tgstation.Server.Host.csproj | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs index 160bdebd9c..e22aa9f605 100644 --- a/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs +++ b/src/Tgstation.Server.Host/Components/Chat/Providers/DiscordProvider.cs @@ -374,9 +374,8 @@ namespace Tgstation.Server.Host.Components.Chat.Providers var fields = BuildUpdateEmbedFields(revisionInformation, byondVersion, gitHubOwner, gitHubRepo, localCommitPushed); var embed = new Embed { - Author = new EmbedAuthor + Author = new EmbedAuthor(assemblyInformationProvider.VersionPrefix) { - Name = assemblyInformationProvider.VersionPrefix, Url = "https://github.com/tgstation/tgstation-server", IconUrl = "https://avatars0.githubusercontent.com/u/1363778?s=280&v=4", }, diff --git a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj index 579b98fa6c..3424ea6dbc 100644 --- a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj +++ b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj @@ -1,4 +1,4 @@ - + @@ -87,7 +87,7 @@ - + From fec4eeaabbf1c8187cf459cfc07f667e19722de0 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 8 Sep 2021 15:05:06 -0400 Subject: [PATCH 2/9] Re-enable disabled test Fixes #1309 --- .../Components/Chat/Providers/TestDiscordProvider.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/Tgstation.Server.Host.Tests/Components/Chat/Providers/TestDiscordProvider.cs b/tests/Tgstation.Server.Host.Tests/Components/Chat/Providers/TestDiscordProvider.cs index e2d527c43c..1ce1802e40 100644 --- a/tests/Tgstation.Server.Host.Tests/Components/Chat/Providers/TestDiscordProvider.cs +++ b/tests/Tgstation.Server.Host.Tests/Components/Chat/Providers/TestDiscordProvider.cs @@ -61,8 +61,6 @@ namespace Tgstation.Server.Host.Components.Chat.Providers.Tests [TestMethod] public async Task TestConnectWithFakeTokenFails() { - Assert.Inconclusive("Doesn't happen, see https://github.com/Nihlus/Remora.Discord/issues/99 for resolution"); - var mockLogger = new Mock>(); await using var provider = new DiscordProvider(mockJobManager, Mock.Of(), mockLogger.Object, new ChatBot { From 0a2532483f6c8c0730946b45f40bb595b617260e Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 8 Sep 2021 15:07:54 -0400 Subject: [PATCH 3/9] Version bump to 4.14.3 --- build/Version.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Version.props b/build/Version.props index 82a4caba04..7725a47a60 100644 --- a/build/Version.props +++ b/build/Version.props @@ -3,7 +3,7 @@ - 4.14.2 + 4.14.3 4.0.0 9.2.0 9.2.0 From 61c616c9749af65533a21bc46e80cf4f559b491d Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 8 Sep 2021 15:13:28 -0400 Subject: [PATCH 4/9] Add action to post to server release thread Closes #1323 --- .github/workflows/ci-suite.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-suite.yml b/.github/workflows/ci-suite.yml index 7d4dcaaf04..57e8aa4e81 100644 --- a/.github/workflows/ci-suite.yml +++ b/.github/workflows/ci-suite.yml @@ -789,7 +789,19 @@ jobs: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./ServerUpdatePackage.zip asset_name: ServerUpdatePackage.zip - asset_content_type: application/zip + asset_content_type: application/zip- name: Create comment + + deploy-docker: + name: Post Comment To Server Update Thread + needs: [deploy-tgs] + runs-on: ubuntu-latest + steps: + - name: Post Comment + uses: peter-evans/create-or-update-comment@v1 + with: + token: ${{ secrets.DEV_PUSH_TOKEN }} + issue-number: 1322 + body: \[tgstation-server-v${{ env.TGS_VERSION }}](${{ steps.create_release.outputs.html_url }}) released. deploy-docker: name: Deploy TGS (Docker) From 0eac38c1fc46d8043b158648d250d163fe73a5b7 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 8 Sep 2021 19:44:20 -0400 Subject: [PATCH 5/9] Event scripts and DMAPI events run in parallel --- src/Tgstation.Server.Host/Components/Events/EventConsumer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs b/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs index f5129d7a06..07fc17b243 100644 --- a/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs +++ b/src/Tgstation.Server.Host/Components/Events/EventConsumer.cs @@ -39,8 +39,9 @@ namespace Tgstation.Server.Host.Components.Events if (watchdog == null) throw new InvalidOperationException("EventConsumer used without watchdog set!"); - await configuration.HandleEvent(eventType, parameters, cancellationToken).ConfigureAwait(false); + var scriptTask = configuration.HandleEvent(eventType, parameters, cancellationToken); await watchdog.HandleEvent(eventType, parameters, cancellationToken).ConfigureAwait(false); + await scriptTask.ConfigureAwait(false); } /// From 67ca9d92f138d4a9d440d48538999b22fd8c8002 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 8 Sep 2021 19:57:34 -0400 Subject: [PATCH 6/9] Fixed failing scripts crashing the monitor --- .../Components/StaticFiles/Configuration.cs | 6 +++- .../Components/Watchdog/BasicWatchdog.cs | 6 ++-- .../Components/Watchdog/WatchdogBase.cs | 35 ++++++++++++++----- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs b/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs index 9fcb712f26..ca75e5d396 100644 --- a/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs +++ b/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs @@ -631,7 +631,11 @@ namespace Tgstation.Server.Host.Components.StaticFiles await ioManager.WriteAllBytes(staticIgnorePath, Array.Empty(), cancellationToken).ConfigureAwait(false); } - await Task.WhenAll(ioManager.CreateDirectory(CodeModificationsSubdirectory, cancellationToken), ioManager.CreateDirectory(EventScriptsSubdirectory, cancellationToken), ValidateStaticFolder()).ConfigureAwait(false); + await Task.WhenAll( + ioManager.CreateDirectory(CodeModificationsSubdirectory, cancellationToken), + ioManager.CreateDirectory(EventScriptsSubdirectory, cancellationToken), + ValidateStaticFolder()) + .ConfigureAwait(false); } /// diff --git a/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs index ec41aa29f4..f62bc2d2c8 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs @@ -111,7 +111,7 @@ namespace Tgstation.Server.Host.Components.Watchdog var eventType = Server.TerminationWasRequested ? EventType.WorldEndProcess : EventType.WatchdogCrash; - await EventConsumer.HandleEvent(eventType, Enumerable.Empty(), cancellationToken).ConfigureAwait(false); + await HandleNonRelayedEvent(eventType, Enumerable.Empty(), cancellationToken).ConfigureAwait(false); var exitWord = Server.TerminationWasRequested ? "exited" : "crashed"; if (Server.RebootState == Session.RebootState.Shutdown) @@ -146,7 +146,7 @@ namespace Tgstation.Server.Host.Components.Watchdog gracefulRebootRequired = false; Server.ResetRebootState(); - await EventConsumer.HandleEvent(EventType.WorldReboot, Enumerable.Empty(), cancellationToken).ConfigureAwait(false); + await HandleNonRelayedEvent(EventType.WorldReboot, Enumerable.Empty(), cancellationToken).ConfigureAwait(false); switch (rebootState) { @@ -173,7 +173,7 @@ namespace Tgstation.Server.Host.Components.Watchdog await HandleNewDmbAvailable(cancellationToken).ConfigureAwait(false); break; case MonitorActivationReason.ActiveServerPrimed: - await EventConsumer.HandleEvent(EventType.WorldPrime, Enumerable.Empty(), cancellationToken).ConfigureAwait(false); + await HandleNonRelayedEvent(EventType.WorldPrime, Enumerable.Empty(), cancellationToken).ConfigureAwait(false); break; case MonitorActivationReason.Heartbeat: default: diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs index e053af0bcc..ebf67b6087 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs @@ -90,11 +90,6 @@ namespace Tgstation.Server.Host.Components.Watchdog /// protected IAsyncDelayer AsyncDelayer { get; } - /// - /// The that is not the . - /// - protected IEventConsumer EventConsumer { get; } - /// /// The for the . /// @@ -110,6 +105,11 @@ namespace Tgstation.Server.Host.Components.Watchdog /// readonly SemaphoreSlim controllerDisposeSemaphore; + /// + /// The that is not the . + /// + readonly IEventConsumer eventConsumer; + /// /// The for the . /// @@ -205,7 +205,7 @@ namespace Tgstation.Server.Host.Components.Watchdog this.jobManager = jobManager ?? throw new ArgumentNullException(nameof(jobManager)); AsyncDelayer = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer)); this.diagnosticsIOManager = diagnosticsIOManager ?? throw new ArgumentNullException(nameof(diagnosticsIOManager)); - EventConsumer = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer)); + this.eventConsumer = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer)); this.remoteDeploymentManagerFactory = remoteDeploymentManagerFactory ?? throw new ArgumentNullException(nameof(remoteDeploymentManagerFactory)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); ActiveLaunchParameters = initialLaunchParameters ?? throw new ArgumentNullException(nameof(initialLaunchParameters)); @@ -505,7 +505,7 @@ namespace Tgstation.Server.Host.Components.Watchdog cancellationToken); // simple announce if (reattachInfo == null) announceTask = Task.WhenAll( - EventConsumer.HandleEvent(EventType.WatchdogLaunch, Enumerable.Empty(), cancellationToken), + HandleNonRelayedEvent(EventType.WatchdogLaunch, Enumerable.Empty(), cancellationToken), announceTask); } else @@ -676,6 +676,25 @@ namespace Tgstation.Server.Host.Components.Watchdog return remoteDeploymentManager.ApplyDeployment(newCompileJob, ActiveCompileJob, cancellationToken); } + /// + /// Handle a given without re-throwing errors. + /// + /// The . + /// An of parameters for . + /// The for the operation. + /// A representing the running operation. + protected async Task HandleNonRelayedEvent(EventType eventType, IEnumerable parameters, CancellationToken cancellationToken) + { + try + { + await eventConsumer.HandleEvent(eventType, parameters, cancellationToken); + } + catch (JobException ex) + { + Logger.LogError(ex, "Suppressing exception triggered by event!"); + } + } + /// /// Attempt to restart the monitor from scratch. /// @@ -954,7 +973,7 @@ namespace Tgstation.Server.Host.Components.Watchdog return; if (!graceful) { - var eventTask = EventConsumer.HandleEvent( + var eventTask = HandleNonRelayedEvent( releaseServers ? EventType.WatchdogDetach : EventType.WatchdogShutdown, From 1546a9dd57e76a634beefbada3a5c003d92d50a8 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Thu, 9 Sep 2021 14:34:28 -0400 Subject: [PATCH 7/9] Fix bad .yml --- .github/workflows/ci-suite.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-suite.yml b/.github/workflows/ci-suite.yml index 57e8aa4e81..8aacd04615 100644 --- a/.github/workflows/ci-suite.yml +++ b/.github/workflows/ci-suite.yml @@ -789,9 +789,9 @@ jobs: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./ServerUpdatePackage.zip asset_name: ServerUpdatePackage.zip - asset_content_type: application/zip- name: Create comment + asset_content_type: application/zip - deploy-docker: + post-deploy-comment: name: Post Comment To Server Update Thread needs: [deploy-tgs] runs-on: ubuntu-latest From ce079cafe7447c72822483d84586f6239405aa9c Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Thu, 9 Sep 2021 15:48:09 -0400 Subject: [PATCH 8/9] Fix my Discord ID in security reporting --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index 7bf70fce52..c821acd452 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -13,6 +13,6 @@ Vulnerabilities should ideally be reported by directly messaging one of the main Here is a list of their discord IDs. -- Cyberboss#8246 +- Cyberboss#0016 Once reported, they will handle the processing of the security advisory. From 2482bccd56796e2e30ff2274b16b09a8c0bcea19 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Thu, 9 Sep 2021 19:39:09 -0400 Subject: [PATCH 9/9] This needs to be in the same job --- .github/workflows/ci-suite.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci-suite.yml b/.github/workflows/ci-suite.yml index 8aacd04615..9524a6cc00 100644 --- a/.github/workflows/ci-suite.yml +++ b/.github/workflows/ci-suite.yml @@ -791,12 +791,7 @@ jobs: asset_name: ServerUpdatePackage.zip asset_content_type: application/zip - post-deploy-comment: - name: Post Comment To Server Update Thread - needs: [deploy-tgs] - runs-on: ubuntu-latest - steps: - - name: Post Comment + - name: Post Comment to Server Update Thread uses: peter-evans/create-or-update-comment@v1 with: token: ${{ secrets.DEV_PUSH_TOKEN }}