Skip to content

Commit

Permalink
Merge pull request #1928 from tgstation/dev [TGSDeploy]
Browse files Browse the repository at this point in the history
v6.10.0
  • Loading branch information
Cyberboss authored Sep 11, 2024
2 parents e40c08a + 614a815 commit 1b0a319
Show file tree
Hide file tree
Showing 149 changed files with 7,054 additions and 496 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-approve-dominions-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: GitHub API Call
run: |
curl --request POST \
--url https://api.github.com/repos/${{github.repository}}/pulls/${{github.event.number}}/reviews \
--url https://api.github.com/repos/${{ github.repository }}/pulls/${{github.event.number}}/reviews \
--header 'authorization: Bearer ${{ steps.app-token-generation.outputs.token }}' \
--header 'content-type: application/json' \
-d '{"event":"APPROVE"}' \
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ env:
TGS_WEBPANEL_NODE_VERSION: 20.x
TGS_TEST_GITHUB_TOKEN: ${{ secrets.LIVE_TESTS_TOKEN }}
PACKAGING_PRIVATE_KEY_PASSPHRASE: ${{ secrets.PACKAGING_PRIVATE_KEY_PASSPHRASE }}
Internal__EnableGraphQL: true

concurrency:
group: "ci-${{ (github.event_name != 'push' && github.event_name != 'schedule' && github.event.inputs.pull_request_number) || github.run_id }}-${{ github.event_name }}"
Expand Down Expand Up @@ -432,8 +433,6 @@ jobs:
matrix:
configuration: ["Debug", "Release"]
env:
TGS_TEST_DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
TGS_TEST_IRC_CONNECTION_STRING: ${{ secrets.IRC_CONNECTION_STRING }}
TGS_TELEMETRY_KEY_FILE: /tmp/tgs_telemetry_key.txt
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -486,6 +485,12 @@ jobs:

- name: Run Unit Tests
run: sudo dotnet test --no-build --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" --filter TestCategory!=RequiresDatabase -c ${{ matrix.configuration }}NoWindows --collect:"XPlat Code Coverage" --settings build/ci.runsettings --results-directory ./TestResults tgstation-server.sln
env:
TGS_TEST_DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
TGS_TEST_IRC_CONNECTION_STRING: ${{ secrets.IRC_CONNECTION_STRING }}
TGS_TEST_APP_ID: ${{ secrets.APP_ID }}
TGS_TEST_APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
TGS_TEST_REPO_SLUG: ${{ github.repository }}

- name: Store Code Coverage
uses: actions/upload-artifact@v4
Expand All @@ -500,8 +505,6 @@ jobs:
matrix:
configuration: ["Debug", "Release"]
env:
TGS_TEST_DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
TGS_TEST_IRC_CONNECTION_STRING: ${{ secrets.IRC_CONNECTION_STRING }}
TGS_TELEMETRY_KEY_FILE: C:/tgs_telemetry_key.txt
runs-on: windows-latest
steps:
Expand Down Expand Up @@ -550,6 +553,12 @@ jobs:

- name: Run Unit Tests
run: dotnet test --no-build --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" --filter TestCategory!=RequiresDatabase -c ${{ matrix.configuration }}NoWix --collect:"XPlat Code Coverage" --settings build/ci.runsettings --results-directory ./TestResults tgstation-server.sln
env:
TGS_TEST_DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
TGS_TEST_IRC_CONNECTION_STRING: ${{ secrets.IRC_CONNECTION_STRING }}
TGS_TEST_APP_ID: ${{ secrets.APP_ID }}
TGS_TEST_APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
TGS_TEST_REPO_SLUG: ${{ github.repository }}

- name: Store Code Coverage
uses: actions/upload-artifact@v4
Expand All @@ -569,6 +578,7 @@ jobs:
configuration: ["Debug", "Release"]
env:
TGS_TELEMETRY_KEY_FILE: C:/tgs_telemetry_key.txt
TGS_TEST_GRAPHQL: true
runs-on: windows-latest
steps:
- name: Setup dotnet
Expand Down
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ artifacts/
*.dmb
*.int
*.lk
/src/Tgstation.Server.Client.GraphQL/schema.graphql
/src/Tgstation.Server.Host/appsettings.*.json
/src/Tgstation.Server.Host/appsettings.*.yml
/src/Tgstation.Server.Host/wwwroot
Expand All @@ -27,8 +28,4 @@ changelog.yml
*nupkg
*.sqlite3
packaging/
/src/Tgstation.Server.Common/node_modules
/src/Tgstation.Server.Common/package.json
/src/Tgstation.Server.Common/yarn.lock
/src/Tgstation.Server.Common/logo_bg_white.svg
yarn-error.log*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ All users with access to an instance have an InstanceUser object associated with

The `Repository` folder is a git repository containing the code of the game you wish to host. It can be cloned from any public or private remote repository and has capabilities to affect changes back to it. All the standard benefits of git are utilized (i.e. check out any revision or reference).

Additional features become available if the remote repository is hosted on https://github.com/. Namely the Test Merge feature, which allows you to take a pull request opened on the repository and compile it into a game deployment for testing. Information about test merges is available in game via the DMAPI and via the main API as well.
Additional features become available if the remote repository is hosted on https://github.com/. Namely the Test Merge feature, which allows you to take a pull request opened on the repository and compile it into a game deployment for testing. Information about test merges is available in game via the DMAPI and via the main API as well. These require a valid personal access token with `repo` scope or an installed GitHub App with the following permissions: `contents: write`, `pull_requests: write`, and `deployments: write`.

Manual operations on the repository while an instance is running may lead to git data corruption. Thankfully, it's simple enough to delete and reclone the repository via the API.

Expand Down
1 change: 1 addition & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ EXPOSE 5000

ENV General__ValidInstancePaths__0 /tgs_instances
ENV FileLogging__Directory /tgs_logs
ENV Internal__UsingDocker true

WORKDIR /app

Expand Down
8 changes: 4 additions & 4 deletions build/TestCommon.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<!-- Usage: Hard to say what exactly this is for, but not including it removes the test icon and breaks vstest.console.exe for some reason -->
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" Condition="'$(TgsTestNoSdk)' != 'true'" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" Condition="'$(TgsTestNoSdk)' != 'true'" />
<!-- Usage: Dependency mocking for tests -->
<!-- Pinned: Be VERY careful about updating https://github.com/moq/moq/issues/1372 -->
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Moq" Version="4.20.72" />
<!-- Usage: MSTest execution -->
<PackageReference Include="MSTest.TestAdapter" Version="3.5.2" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.0" />
<!-- Usage: MSTest asserts etc... -->
<PackageReference Include="MSTest.TestFramework" Version="3.5.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.0" />
</ItemGroup>

</Project>
14 changes: 7 additions & 7 deletions build/Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<!-- Integration tests will ensure they match across the board -->
<Import Project="WebpanelVersion.props" />
<PropertyGroup>
<TgsCoreVersion>6.9.2</TgsCoreVersion>
<TgsCoreVersion>6.10.0</TgsCoreVersion>
<TgsConfigVersion>5.2.0</TgsConfigVersion>
<TgsApiVersion>10.7.0</TgsApiVersion>
<TgsApiVersion>10.9.0</TgsApiVersion>
<TgsCommonLibraryVersion>7.0.0</TgsCommonLibraryVersion>
<TgsApiLibraryVersion>13.7.0</TgsApiLibraryVersion>
<TgsClientVersion>16.0.0</TgsClientVersion>
<TgsDmapiVersion>7.2.1</TgsDmapiVersion>
<TgsInteropVersion>5.9.0</TgsInteropVersion>
<TgsHostWatchdogVersion>1.4.1</TgsHostWatchdogVersion>
<TgsApiLibraryVersion>15.0.0</TgsApiLibraryVersion>
<TgsClientVersion>18.0.0</TgsClientVersion>
<TgsDmapiVersion>7.3.0</TgsDmapiVersion>
<TgsInteropVersion>5.10.0</TgsInteropVersion>
<TgsHostWatchdogVersion>1.5.0</TgsHostWatchdogVersion>
<TgsContainerScriptVersion>1.2.1</TgsContainerScriptVersion>
<TgsMigratorVersion>2.0.0</TgsMigratorVersion>
<TgsNugetNetFramework>netstandard2.0</TgsNugetNetFramework>
Expand Down
2 changes: 1 addition & 1 deletion build/WebpanelVersion.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- This is in it's own file to help incremental building, changing it causes a complete rebuild of the web panel -->
<TgsWebpanelVersion>6.1.0</TgsWebpanelVersion>
<TgsWebpanelVersion>6.2.0</TgsWebpanelVersion>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion build/tgstation-server.service
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ User=tgstation-server
Type=notify-reload
NotifyAccess=all
WorkingDirectory=/opt/tgstation-server
ExecStart=/usr/bin/dotnet Tgstation.Server.Host.Console.dll --appsettings-base-path=/etc/tgstation-server --General:SetupWizardMode=Never --Internal:UsingSystemD=true
ExecStart=/usr/bin/dotnet Tgstation.Server.Host.Console.dll --appsettings-base-path=/etc/tgstation-server --General:SetupWizardMode=Never
TimeoutStartSec=600
Restart=always
KillMode=process
Expand Down
2 changes: 1 addition & 1 deletion src/DMAPI/tgs.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// tgstation-server DMAPI
// The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in IETF RFC 2119.

#define TGS_DMAPI_VERSION "7.2.1"
#define TGS_DMAPI_VERSION "7.3.0"

// All functions and datums outside this document are subject to change with any version and should not be relied on.

Expand Down
2 changes: 1 addition & 1 deletion src/DMAPI/tgs/v5/__interop_version.dm
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"5.9.0"
"5.10.0"
1 change: 1 addition & 0 deletions src/DMAPI/tgs/v5/_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
#define DMAPI5_TOPIC_PARAMETER_NEW_SERVER_VERSION "newServerVersion"
#define DMAPI5_TOPIC_PARAMETER_BROADCAST_MESSAGE "broadcastMessage"

#define DMAPI5_TOPIC_RESPONSE_CLIENT_COUNT "clientCount"
#define DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE "commandResponse"
#define DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE_MESSAGE "commandResponseMessage"
#define DMAPI5_TOPIC_RESPONSE_CHAT_RESPONSES "chatResponses"
Expand Down
4 changes: 3 additions & 1 deletion src/DMAPI/tgs/v5/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@
if(DMAPI5_TOPIC_COMMAND_HEALTHCHECK)
if(event_handler && event_handler.receive_health_checks)
event_handler.HandleEvent(TGS_EVENT_HEALTH_CHECK)
return TopicResponse()
var/list/health_check_response = TopicResponse()
health_check_response[DMAPI5_TOPIC_RESPONSE_CLIENT_COUNT] = TGS_CLIENT_COUNT
return health_check_response;

if(DMAPI5_TOPIC_COMMAND_WATCHDOG_REATTACH)
detached = FALSE
Expand Down
1 change: 1 addition & 0 deletions src/DMAPI/tgs/v5/undefs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
#undef DMAPI5_TOPIC_PARAMETER_NEW_SERVER_VERSION
#undef DMAPI5_TOPIC_PARAMETER_BROADCAST_MESSAGE

#undef DMAPI5_TOPIC_RESPONSE_CLIENT_COUNT
#undef DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE
#undef DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE_MESSAGE
#undef DMAPI5_TOPIC_RESPONSE_CHAT_RESPONSES
Expand Down
23 changes: 23 additions & 0 deletions src/Tgstation.Server.Api/Models/DMApiValidationMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// The DMAPI validation setting for deployments.
/// </summary>
public enum DMApiValidationMode
{
/// <summary>
/// DMAPI validation is performed but not required for the deployment to succeed.
/// </summary>
Optional,

/// <summary>
/// DMAPI validation must suceed for the deployment to succeed.
/// </summary>
Required,

/// <summary>
/// DMAPI validation will not be performed and no DMAPI features will be available in the deployment.
/// </summary>
Skipped,
}
}
18 changes: 12 additions & 6 deletions src/Tgstation.Server.Api/Models/ErrorCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public enum ErrorCode : uint
SwarmIntegrityCheckFailed,

/// <summary>
/// One of <see cref="Internal.RepositorySettings.AccessUser"/> and <see cref="Internal.RepositorySettings.AccessToken"/> is set while the other isn't.
/// One of <see cref="RepositorySettings.AccessUser"/> and <see cref="RepositorySettings.AccessToken"/> is set while the other isn't.
/// </summary>
[Description("Either both accessUser and accessToken must be set or neither!")]
RepoMismatchUserAndAccessToken,
Expand Down Expand Up @@ -239,13 +239,13 @@ public enum ErrorCode : uint
RepoDuplicateTestMerge,

/// <summary>
/// Attempted to set a whitespace <see cref="Internal.RepositorySettings.CommitterName"/>.
/// Attempted to set a whitespace <see cref="RepositorySettings.CommitterName"/>.
/// </summary>
[Description("committerName cannot be whitespace!")]
RepoWhitespaceCommitterName,

/// <summary>
/// Attempted to set a whitespace <see cref="Internal.RepositorySettings.CommitterEmail"/>.
/// Attempted to set a whitespace <see cref="RepositorySettings.CommitterEmail"/>.
/// </summary>
[Description("committerEmail cannot be whitespace!")]
RepoWhitespaceCommitterEmail,
Expand Down Expand Up @@ -377,19 +377,19 @@ public enum ErrorCode : uint
InstanceMissingDreamMakerSettings,

/// <summary>
/// Missing <see cref="Internal.RepositorySettings"/> in database.
/// Missing <see cref="RepositorySettings"/> in database.
/// </summary>
[Description("Could not retrieve Repository settings from the database!")]
InstanceMissingRepositorySettings,

/// <summary>
/// Performing an automatic update with the <see cref="Internal.RepositorySettings.AutoUpdatesKeepTestMerges"/> flag resulted in merge conflicts.
/// Performing an automatic update with the <see cref="RepositorySettings.AutoUpdatesKeepTestMerges"/> flag resulted in merge conflicts.
/// </summary>
[Description("Performing this automatic update as a merge would result in conficts. Aborting!")]
InstanceUpdateTestMergeConflict,

/// <summary>
/// <see cref="Internal.RepositorySettings.AccessUser"/> and <see cref="Internal.RepositorySettings.AccessToken"/> are required for this operation.
/// <see cref="RepositorySettings.AccessUser"/> and <see cref="RepositorySettings.AccessToken"/> are required for this operation.
/// </summary>
[Description("Git credentials are required for this operation!")]
RepoCredentialsRequired,
Expand Down Expand Up @@ -657,5 +657,11 @@ public enum ErrorCode : uint
/// </summary>
[Description("Could not load configured .dme due to it being outside the deployment directory! This should be a relative path.")]
DeploymentWrongDme,

/// <summary>
/// Entered wrong <see cref="RepositorySettings.AccessUser"/> for a <see cref="RepositorySettings.AccessToken"/>.
/// </summary>
[Description("Provided repository username doesn't match the user of the corresponding access token!")]
RepoTokenUsernameMismatch,
}
}
16 changes: 15 additions & 1 deletion src/Tgstation.Server.Api/Models/Internal/DreamDaemonApiBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Tgstation.Server.Api.Models.Internal
using System;

namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Base class for DreamDaemon API models.
Expand All @@ -11,6 +13,18 @@ public abstract class DreamDaemonApiBase : DreamDaemonSettings
[ResponseOptions]
public long? SessionId { get; set; }

/// <summary>
/// When the current server execution was started.
/// </summary>
[ResponseOptions]
public DateTimeOffset? LaunchTime { get; set; }

/// <summary>
/// The last known count of connected players. Requires <see cref="DreamDaemonLaunchParameters.HealthCheckSeconds"/> to not be 0 and a game server interop version >= 5.10.0 to populate.
/// </summary>
[ResponseOptions]
public uint? ClientCount { get; set; }

/// <summary>
/// If the server is undergoing a soft reset. This may be automatically set by changes to other fields.
/// </summary>
Expand Down
11 changes: 10 additions & 1 deletion src/Tgstation.Server.Api/Models/Internal/DreamMakerSettings.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Tgstation.Server.Api.Models.Internal
{
Expand Down Expand Up @@ -29,11 +30,19 @@ public abstract class DreamMakerSettings
public DreamDaemonSecurity? ApiValidationSecurityLevel { get; set; }

/// <summary>
/// If API validation should be required for a deployment to succeed.
/// If API validation should be required for a deployment to succeed. Must not be set on mutation if <see cref="DMApiValidationMode"/> is set.
/// </summary>
[Required]
[NotMapped]
[Obsolete($"Use {nameof(DMApiValidationMode)} instead.")]
public bool? RequireDMApiValidation { get; set; }

/// <summary>
/// The current <see cref="Models.DMApiValidationMode"/>. Must not be set on mutation if <see cref="RequireDMApiValidation"/> is set.
/// </summary>
[Required]
public DMApiValidationMode? DMApiValidationMode { get; set; }

/// <summary>
/// Amount of time before an in-progress deployment is cancelled.
/// </summary>
Expand Down
20 changes: 20 additions & 0 deletions src/Tgstation.Server.Api/Models/Internal/LocalServerInformation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Collections.Generic;

namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Information about the local tgstation-server.
/// </summary>
public class LocalServerInformation : ServerInformationBase
{
/// <summary>
/// If the server is running on a windows operating system.
/// </summary>
public bool WindowsHost { get; set; }

/// <summary>
/// Map of <see cref="OAuthProvider"/> to the <see cref="OAuthProviderInfo"/> for them.
/// </summary>
public Dictionary<OAuthProvider, OAuthProviderInfo>? OAuthProviderInfos { get; set; }
}
}
Loading

0 comments on commit 1b0a319

Please sign in to comment.