diff --git a/build/Version.props b/build/Version.props index b2f8d5265bd..99cef97f0d3 100644 --- a/build/Version.props +++ b/build/Version.props @@ -9,8 +9,8 @@ 7.0.0 11.1.2 13.0.0 - 6.5.3 - 5.6.1 + 6.5.4 + 5.6.2 1.4.0 1.2.1 1.0.2 diff --git a/src/DMAPI/tgs.dm b/src/DMAPI/tgs.dm index 6187a67825a..d0466b806ff 100644 --- a/src/DMAPI/tgs.dm +++ b/src/DMAPI/tgs.dm @@ -1,6 +1,6 @@ // tgstation-server DMAPI -#define TGS_DMAPI_VERSION "6.5.3" +#define TGS_DMAPI_VERSION "6.5.4" // All functions and datums outside this document are subject to change with any version and should not be relied on. diff --git a/src/DMAPI/tgs/core/core.dm b/src/DMAPI/tgs/core/core.dm index 41a04733945..aa4084904b7 100644 --- a/src/DMAPI/tgs/core/core.dm +++ b/src/DMAPI/tgs/core/core.dm @@ -153,4 +153,4 @@ /world/TgsSecurityLevel() var/datum/tgs_api/api = TGS_READ_GLOBAL(tgs) if(api) - api.SecurityLevel() + return api.SecurityLevel() diff --git a/src/DMAPI/tgs/v5/__interop_version.dm b/src/DMAPI/tgs/v5/__interop_version.dm index 5d3d491a736..1b52b31d6a7 100644 --- a/src/DMAPI/tgs/v5/__interop_version.dm +++ b/src/DMAPI/tgs/v5/__interop_version.dm @@ -1 +1 @@ -"5.6.1" +"5.6.2" diff --git a/src/Tgstation.Server.Host/Components/Interop/Bridge/RuntimeInformation.cs b/src/Tgstation.Server.Host/Components/Interop/Bridge/RuntimeInformation.cs index 5d0d13b7fa1..b7d05b67d79 100644 --- a/src/Tgstation.Server.Host/Components/Interop/Bridge/RuntimeInformation.cs +++ b/src/Tgstation.Server.Host/Components/Interop/Bridge/RuntimeInformation.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Linq; +using Newtonsoft.Json; + using Tgstation.Server.Api.Models; using Tgstation.Server.Host.Components.Chat; using Tgstation.Server.Host.Components.Deployment; @@ -42,12 +44,14 @@ public sealed class RuntimeInformation : ChatUpdate /// /// The level of the launch. /// - public DreamDaemonSecurity? SecurityLevel { get; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)] + public DreamDaemonSecurity SecurityLevel { get; } /// /// The level of the launch. /// - public DreamDaemonVisibility? Visibility { get; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)] + public DreamDaemonVisibility Visibility { get; } /// /// The s in the launch. @@ -70,8 +74,8 @@ public RuntimeInformation( IDmbProvider dmbProvider, Version serverVersion, string instanceName, - DreamDaemonSecurity? securityLevel, - DreamDaemonVisibility? visibility, + DreamDaemonSecurity securityLevel, + DreamDaemonVisibility visibility, ushort serverPort, bool apiValidateOnly) : base(chatTrackingContext?.Channels ?? throw new ArgumentNullException(nameof(chatTrackingContext))) diff --git a/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs b/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs index 2c9007f4f35..6c429d2d0a6 100644 --- a/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs +++ b/src/Tgstation.Server.Host/Components/Session/ReattachInformation.cs @@ -76,13 +76,11 @@ internal ReattachInformation( Dmb = dmb ?? throw new ArgumentNullException(nameof(dmb)); ProcessId = process?.Id ?? throw new ArgumentNullException(nameof(process)); RuntimeInformation = runtimeInformation ?? throw new ArgumentNullException(nameof(runtimeInformation)); - if (!runtimeInformation.SecurityLevel.HasValue) - throw new ArgumentException("runtimeInformation must have a valid SecurityLevel!", nameof(runtimeInformation)); AccessIdentifier = accessIdentifier ?? throw new ArgumentNullException(nameof(accessIdentifier)); - LaunchSecurityLevel = runtimeInformation.SecurityLevel.Value; - LaunchVisibility = runtimeInformation.Visibility.Value; + LaunchSecurityLevel = runtimeInformation.SecurityLevel; + LaunchVisibility = runtimeInformation.Visibility; Port = port; runtimeInformationLock = new object(); diff --git a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs index 3bc79939c7d..6d48b990fe9 100644 --- a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs +++ b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs @@ -337,7 +337,8 @@ public async ValueTask LaunchNew( var runtimeInformation = CreateRuntimeInformation( dmbProvider, chatTrackingContext, - launchParameters, + launchParameters.SecurityLevel.Value, + launchParameters.Visibility.Value, apiValidate); var reattachInformation = new ReattachInformation( @@ -432,7 +433,8 @@ public async ValueTask Reattach( var runtimeInformation = CreateRuntimeInformation( reattachInformation.Dmb, chatTrackingContext, - null, + reattachInformation.LaunchSecurityLevel, + reattachInformation.LaunchVisibility, false); reattachInformation.SetRuntimeInformation(runtimeInformation); @@ -628,21 +630,23 @@ async ValueTask LogDDOutput(IProcess process, string outputFilePath, bool cliSup /// /// The . /// The . - /// The if any. + /// The the server was launched with. + /// The the server was launched with. /// The value of . /// A new class. RuntimeInformation CreateRuntimeInformation( IDmbProvider dmbProvider, IChatTrackingContext chatTrackingContext, - DreamDaemonLaunchParameters launchParameters, + DreamDaemonSecurity securityLevel, + DreamDaemonVisibility visibility, bool apiValidateOnly) => new ( chatTrackingContext, dmbProvider, assemblyInformationProvider.Version, instance.Name, - launchParameters?.SecurityLevel, - launchParameters?.Visibility, + securityLevel, + visibility, serverPortProvider.HttpApiPort, apiValidateOnly); diff --git a/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs b/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs index 76dfbfda36c..241fae5141a 100644 --- a/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs +++ b/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs @@ -1,5 +1,4 @@ using System; -using System.ComponentModel.DataAnnotations; using System.Globalization; using Tgstation.Server.Api.Models; @@ -31,14 +30,12 @@ public abstract class ReattachInformationBase : DMApiParameters /// /// The level DreamDaemon was launched with. /// - [Required] - public DreamDaemonSecurity? LaunchSecurityLevel { get; set; } + public DreamDaemonSecurity LaunchSecurityLevel { get; set; } /// /// The DreamDaemon was launched with. /// - [Required] - public DreamDaemonVisibility? LaunchVisibility { get; set; } + public DreamDaemonVisibility LaunchVisibility { get; set; } /// /// Initializes a new instance of the class. diff --git a/src/Tgstation.Server.Host/Utils/GitHub/GitHubClientFactory.cs b/src/Tgstation.Server.Host/Utils/GitHub/GitHubClientFactory.cs index 47a67728aba..7595a70a431 100644 --- a/src/Tgstation.Server.Host/Utils/GitHub/GitHubClientFactory.cs +++ b/src/Tgstation.Server.Host/Utils/GitHub/GitHubClientFactory.cs @@ -153,7 +153,7 @@ GitHubClient GetOrCreateClient(string accessToken) rateLimitInfo.Reset.ToString("o")); else logger.LogDebug( - "Requested GitHub client has {remainingRequests} requests remaining after the usage {lastUse}. Limit resets at {resetTime}", + "Requested GitHub client has {remainingRequests} requests remaining after the usage at {lastUse}. Limit resets at {resetTime}", rateLimitInfo.Remaining, lastUsed, rateLimitInfo.Reset.ToString("o")); diff --git a/tests/DMAPI/LongRunning/Test.dm b/tests/DMAPI/LongRunning/Test.dm index bed428eceb2..a77c3377b5d 100644 --- a/tests/DMAPI/LongRunning/Test.dm +++ b/tests/DMAPI/LongRunning/Test.dm @@ -11,6 +11,12 @@ dab() TgsNew(new /datum/tgs_event_handler/impl, TGS_SECURITY_SAFE) + var/sec = TgsSecurityLevel() + if(isnull(sec)) + FailTest("TGS Security level was null!") + + log << "Running in security level: [sec]" + if(params["expect_chat_channels"]) var/list/channels = TgsChatChannelInfo() if(!length(channels)) diff --git a/tests/DMAPI/LongRunning/long_running_test_rooted.dme b/tests/DMAPI/LongRunning/long_running_test_rooted.dme new file mode 100644 index 00000000000..d8e9d61c967 --- /dev/null +++ b/tests/DMAPI/LongRunning/long_running_test_rooted.dme @@ -0,0 +1,17 @@ +// Hand crafted DME, will not work if saved with DreamMaker + +// BEGIN_INTERNALS +// END_INTERNALS + +// BEGIN_FILE_DIR +#define FILE_DIR . +// END_FILE_DIR + +// BEGIN_PREFERENCES +// END_PREFERENCES + +// BEGIN_INCLUDE +#include "tests/DMAPI/LongRunning/Config.dm" +#include "tests/DMAPI/test_prelude.dm" +#include "tests/DMAPI/LongRunning/Test.dm" +// END_INCLUDE diff --git a/tests/Tgstation.Server.Tests/Live/Instance/ConfigurationTest.cs b/tests/Tgstation.Server.Tests/Live/Instance/ConfigurationTest.cs index 56a879c98d0..53064c9b7c0 100644 --- a/tests/Tgstation.Server.Tests/Live/Instance/ConfigurationTest.cs +++ b/tests/Tgstation.Server.Tests/Live/Instance/ConfigurationTest.cs @@ -93,7 +93,7 @@ await configurationClient.Write(new ConfigurationFileRequest await configurationClient.CreateDirectory(staticDir, cancellationToken); } - public ValueTask SetupDMApiTests(CancellationToken cancellationToken) + public Task SetupDMApiTests(bool includingRoot, CancellationToken cancellationToken) { // just use an I/O manager here var ioManager = new DefaultIOManager(); @@ -105,6 +105,12 @@ public ValueTask SetupDMApiTests(CancellationToken cancellationToken) ioManager.ConcatPath(instance.Path, "Repository", "tests", "DMAPI"), null, cancellationToken), + includingRoot + ? ioManager.CopyFile( + "../../../../DMAPI/LongRunning/long_running_test_rooted.dme", + ioManager.ConcatPath(instance.Path, "Repository", "long_running_test_rooted.dme"), + cancellationToken) + : Task.CompletedTask, ioManager.CopyDirectory( Enumerable.Empty(), null, @@ -176,8 +182,9 @@ async Task SequencedApiTests(CancellationToken cancellationToken) } public Task RunPreWatchdog(CancellationToken cancellationToken) => Task.WhenAll( + SetupDMApiTests(false, cancellationToken), SequencedApiTests(cancellationToken), - SetupDMApiTests(cancellationToken).AsTask(), + SetupDMApiTests(cancellationToken), TestPregeneratedFilesExist(cancellationToken)); } } diff --git a/tests/Tgstation.Server.Tests/Live/Instance/InstanceTest.cs b/tests/Tgstation.Server.Tests/Live/Instance/InstanceTest.cs index ed0edee01e3..0b883f77851 100644 --- a/tests/Tgstation.Server.Tests/Live/Instance/InstanceTest.cs +++ b/tests/Tgstation.Server.Tests/Live/Instance/InstanceTest.cs @@ -63,6 +63,7 @@ public async Task RunTests( await chatTask; await dmTask; + await configTest.SetupDMApiTests(true, cancellationToken); await byondTask; await new WatchdogTest( @@ -172,7 +173,7 @@ await Task.WhenAll( dmUpdateRequest.AsTask(), cloneRequest.AsTask()); - var configSetupTask = new ConfigurationTest(instanceClient.Configuration, instanceClient.Metadata).SetupDMApiTests(cancellationToken); + var configSetupTask = new ConfigurationTest(instanceClient.Configuration, instanceClient.Metadata).SetupDMApiTests(true, cancellationToken); if (TestingUtils.RunningInGitHubActions || String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("TGS_TEST_GITHUB_TOKEN")) diff --git a/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs b/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs index f0c89002e84..90e901b1f92 100644 --- a/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs +++ b/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs @@ -1100,7 +1100,7 @@ async Task DeployTestDme(string dmeName, DreamDaemonSecurit var refreshed = await instanceClient.DreamMaker.Update(new DreamMakerRequest { ApiValidationSecurityLevel = deploymentSecurity, - ProjectName = $"tests/DMAPI/{dmeName}", + ProjectName = dmeName.Contains("rooted") ? dmeName : $"tests/DMAPI/{dmeName}", RequireDMApiValidation = requireApi, Timeout = TimeSpan.FromMilliseconds(1), }, cancellationToken); diff --git a/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs b/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs index 260a9c457d2..3984c6e0a82 100644 --- a/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs +++ b/tests/Tgstation.Server.Tests/Live/TestLiveServer.cs @@ -1469,7 +1469,7 @@ await FailFast( await WatchdogTest.TellWorldToReboot2(instanceClient, WatchdogTest.StaticTopicClient, mainDDPort, cancellationToken); dd = await instanceClient.DreamDaemon.Read(cancellationToken); - Assert.AreEqual(WatchdogStatus.Online, dd.Status.Value); + Assert.AreEqual(WatchdogStatus.Online, dd.Status.Value); // if this assert fails, you likely have to crack open the debugger and read test_fail_reason.txt manually Assert.IsNull(dd.StagedCompileJob); Assert.AreEqual(initialStaged, dd.ActiveCompileJob.Id); diff --git a/tgstation-server.sln b/tgstation-server.sln index 6d183435b87..20eef245e10 100644 --- a/tgstation-server.sln +++ b/tgstation-server.sln @@ -157,6 +157,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LongRunning", "LongRunning" tests\DMAPI\LongRunning\Config.dm = tests\DMAPI\LongRunning\Config.dm tests\DMAPI\LongRunning\long_running_test.dme = tests\DMAPI\LongRunning\long_running_test.dme tests\DMAPI\LongRunning\long_running_test_copy.dme = tests\DMAPI\LongRunning\long_running_test_copy.dme + tests\DMAPI\LongRunning\long_running_test_rooted.dme = tests\DMAPI\LongRunning\long_running_test_rooted.dme tests\DMAPI\LongRunning\Test.dm = tests\DMAPI\LongRunning\Test.dm EndProjectSection EndProject