Merge pull request #1829 from tgstation/v670 [DMDeploy][TGSDeploy]

v6.7.0
This commit is contained in:
Jordan Dominion
2024-07-21 21:45:20 -04:00
committed by GitHub
53 changed files with 4864 additions and 100 deletions
+2 -1
View File
@@ -73,7 +73,8 @@ For the full CI gambit, the following repository configuration must be set:
If you don't plan on deploying TGS, the following secrets can be omitted:
- Secret `DEV_PUSH_TOKEN`: A GitHub token with read/write access to the repository. Enables doxygen pushes to `gh-pages` branch, and releases creation.
- Secret `DEV_PUSH_TOKEN`: A repo scoped GitHub PAT with read/write access on the repository and the ability to trigger workflows on https://github.com/tgstation/tgstation-ppa. Used to trigger debian repo rebuilds, bypass rate limits, update milestones, and create winget package acceptance PRs.
- Secret `TGS_CI_GITHUB_APP_TOKEN_BASE64` is a base 64 encoded private key for a GitHub App. This app must be installed on the repo and have read/write access to checks and contents. Used to generate CI checks, push changelogs, and create releases.
- Secret `DOCKER_USERNAME`: Login username for Docker image push.
- Secret `DOCKER_PASSWORD`: Login password for Docker image push.
- Secret `NUGET_API_KEY`: Nuget.org API Key for client libraries push.
+58 -23
View File
@@ -42,7 +42,6 @@ env:
TGS_DOTNET_QUALITY: ga
TGS_TEST_GITHUB_TOKEN: ${{ secrets.LIVE_TESTS_TOKEN }}
TGS_RELEASE_NOTES_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
WINGET_PUSH_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
PACKAGING_PRIVATE_KEY_PASSPHRASE: ${{ secrets.PACKAGING_PRIVATE_KEY_PASSPHRASE }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -315,6 +314,12 @@ jobs:
mv $HOME/tgsdox/changelog.yml ./ 2>/dev/null
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --generate-full-notes
- name: Generate App Token
run: |
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --token-output-file ${{ runner.temp }}/installation_secret.txt ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
echo "INSTALLATION_TOKEN=$(cat ${{ runner.temp }}/installation_secret.txt)" >> $GITHUB_ENV
rm ${{ runner.temp }}/installation_secret.txt
- name: Patch Doxyfile
run: |
VERSION=$(cat "build/Version.props" | grep -oPm1 "(?<=<TgsCoreVersion>)[^<]+")
@@ -335,8 +340,8 @@ jobs:
echo ./doxout/* | xargs -n 10 sudo mv -t $HOME/tgsdox
cd $HOME/tgsdox
git config --global push.default simple
git config user.name "tgstation-server"
git config user.email "tgstation-server@tgstation13.org"
git config user.name "tgstation-server-ci[bot]"
git config user.email "161980869+tgstation-server-ci[bot]@users.noreply.github.com"
echo '# THIS BRANCH IS AUTO GENERATED BY GITHUB ACTIONS' > README.md
# Need to create a .nojekyll file to allow filenames starting with an underscore
@@ -347,7 +352,7 @@ jobs:
echo "Committing..."
git diff-index --quiet HEAD || git commit -m "Deploy code docs to GitHub Pages for workflow run ${{ github.run_number }}" -m "Commit: ${{ github.event.head_commit.id }}"
echo "Pushing..."
git push -f "https://${{ secrets.DEV_PUSH_TOKEN }}@github.com/tgstation/tgstation-server" 2>&1
git push -f "https://tgstation-server-ci:${{ env.INSTALLATION_TOKEN }}@github.com/tgstation/tgstation-server" 2>&1
docker-build:
name: Build Docker Image
@@ -1233,7 +1238,7 @@ jobs:
- name: Install winget
uses: Cyberboss/install-winget@v1
with:
GITHUB_TOKEN: ${{ env.WINGET_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
- name: Setup dotnet
uses: actions/setup-dotnet@v4
@@ -1480,11 +1485,19 @@ jobs:
- name: Generate Release Notes
run: dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes ${{ env.TGS_API_VERSION }} --httpapi
- name: Generate App Token
shell: powershell
run: |
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --token-output-file ${{ runner.temp }}/installation_secret.txt ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
$installSecret = Get-Content ${{ runner.temp }}/installation_secret.txt
echo "INSTALLATION_TOKEN=$installSecret" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
rm ${{ runner.temp }}/installation_secret.txt
- name: Create GitHub Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
tag_name: api-v${{ env.TGS_API_VERSION }}
release_name: tgstation-server API v${{ env.TGS_API_VERSION }}
@@ -1494,7 +1507,7 @@ jobs:
- name: Upload OpenApi Spec
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./swagger/tgs_api.json
@@ -1543,11 +1556,19 @@ jobs:
- name: Generate Release Notes
run: dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes ${{ env.TGS_DM_VERSION }} --dmapi
- name: Generate App Token
shell: powershell
run: |
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --token-output-file ${{ runner.temp }}/installation_secret.txt ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
$installSecret = Get-Content ${{ runner.temp }}/installation_secret.txt
echo "INSTALLATION_TOKEN=$installSecret" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
rm ${{ runner.temp }}/installation_secret.txt
- name: Create GitHub Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
tag_name: dmapi-v${{ env.TGS_DM_VERSION }}
release_name: tgstation-server DMAPI v${{ env.TGS_DM_VERSION }}
@@ -1557,7 +1578,7 @@ jobs:
- name: Upload DMAPI Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./DMAPI.zip
@@ -1637,7 +1658,7 @@ jobs:
run: dotnet build -c Release -p:TGS_HOST_NO_WEBPANEL=true tools/Tgstation.Server.ReleaseNotes/Tgstation.Server.ReleaseNotes.csproj
- name: Run ReleaseNotes with --ensure-release
run: dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --ensure-release
run: dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --ensure-release ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
deploy-tgs:
name: Deploy TGS
@@ -1760,11 +1781,19 @@ jobs:
- name: Generate Release Notes
run: dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes ${{ env.TGS_VERSION }}
- name: Generate App Token
shell: powershell
run: |
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --token-output-file ${{ runner.temp }}/installation_secret.txt ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
$installSecret = Get-Content ${{ runner.temp }}/installation_secret.txt
echo "INSTALLATION_TOKEN=$installSecret" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
rm ${{ runner.temp }}/installation_secret.txt
- name: Create GitHub Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
tag_name: tgstation-server-v${{ env.TGS_VERSION }}
release_name: tgstation-server-v${{ env.TGS_VERSION }}
@@ -1774,7 +1803,7 @@ jobs:
- name: Upload Server Console Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ServerConsole.zip
@@ -1784,7 +1813,7 @@ jobs:
- name: Upload Server Service Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ServerService.zip
@@ -1794,7 +1823,7 @@ jobs:
- name: Upload DMAPI Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./DMAPI.zip
@@ -1804,7 +1833,7 @@ jobs:
- name: Upload OpenApi Spec Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./swagger/tgs_api.json
@@ -1814,7 +1843,7 @@ jobs:
- name: Upload Server Update Package Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ServerUpdatePackage.zip
@@ -1824,7 +1853,7 @@ jobs:
- name: Upload Debian Pacakaging Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./packaging-debian/tgstation-server-v${{ env.TGS_VERSION }}.debian.packaging.tar.xz
@@ -1834,7 +1863,7 @@ jobs:
- name: Upload MariaDB .msi
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/package/winget/Tgstation.Server.Host.Service.Wix.Bundle/bin/Release/mariadb.msi
@@ -1844,7 +1873,7 @@ jobs:
- name: Upload Installer .exe
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/package/winget/tgstation-server-installer.exe
@@ -1880,6 +1909,12 @@ jobs:
mv $HOME/tgsdox/changelog.yml ./ 2>/dev/null
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --generate-full-notes
- name: Generate App Token
run: |
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --token-output-file ${{ runner.temp }}/installation_secret.txt ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
echo "INSTALLATION_TOKEN=$(cat ${{ runner.temp }}/installation_secret.txt)" >> $GITHUB_ENV
rm ${{ runner.temp }}/installation_secret.txt
- name: gh-pages Push
run: |
pushd $HOME/tgsdox
@@ -1888,13 +1923,13 @@ jobs:
sudo mv changelog.yml $HOME/tgsdox/
cd $HOME/tgsdox
git config --global push.default simple
git config user.name "tgstation-server"
git config user.email "tgstation-server@tgstation13.org"
git config user.name "tgstation-server-ci[bot]"
git config user.email "161980869+tgstation-server-ci[bot]@users.noreply.github.com"
git add changelog.yml
echo "Committing..."
git diff-index --quiet HEAD || git commit -m "Regenerate changelog post deploy for workflow run ${{ github.run_number }}" -m "Commit: ${{ github.event.head_commit.id }}"
echo "Pushing..."
git push -f "https://${{ secrets.DEV_PUSH_TOKEN }}@github.com/tgstation/tgstation-server" 2>&1
git push -f "https://tgstation-server-ci:${{ env.INSTALLATION_TOKEN }}@github.com/tgstation/tgstation-server" 2>&1
deploy-docker:
name: Deploy TGS (Docker)
@@ -1954,7 +1989,7 @@ jobs:
- name: Install winget
uses: Cyberboss/install-winget@v1
with:
GITHUB_TOKEN: ${{ env.WINGET_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
- name: Install wingetcreate
run: winget install wingetcreate --version 1.2.8.0 --disable-interactivity --accept-source-agreements # Pinned due to breaking every other version
+32 -10
View File
@@ -1,20 +1,43 @@
name: 'Master Merge'
on:
workflow_run:
workflows: [CI Pipeline]
types:
- completed
push:
branches:
- master
workflow_dispatch:
jobs:
master-merge:
name: Master Merge
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
- name: Build Checkout
uses: actions/checkout@v4
with:
path: temp_workspace
- name: Restore
run: |
cd temp_workspace
dotnet restore
- name: Build ReleaseNotes
run: |
cd temp_workspace
dotnet build -c Release -p:TGS_HOST_NO_WEBPANEL=true tools/Tgstation.Server.ReleaseNotes/Tgstation.Server.ReleaseNotes.csproj
- name: Generate App Token
run: |
cd temp_workspace
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --token-output-file ${{ runner.temp }}/installation_secret.txt ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
echo "INSTALLATION_TOKEN=$(cat ${{ runner.temp }}/installation_secret.txt)" >> $GITHUB_ENV
rm ${{ runner.temp }}/installation_secret.txt
- name: Main Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ env.INSTALLATION_TOKEN }}
- name: Merge master into dev
uses: robotology/gh-action-nightly-merge@14b4a4cf358f7479aa708bee05cf8a794d6a2516 #v1.5.0
@@ -23,9 +46,8 @@ jobs:
development_branch: 'dev'
allow_ff: true
allow_forks: true
user_name: tgstation-server
user_email: tgstation-server@users.noreply.github.com
push_token: DEV_PUSH_TOKEN
user_name: tgstation-server-ci[bot]
user_email: 847638+tgstation-server-ci[bot]@users.noreply.github.com
push_token: INSTALLATION_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEV_PUSH_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
+6
View File
@@ -0,0 +1,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<!-- Usage: Primary JSON library -->
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
+2 -2
View File
@@ -18,9 +18,9 @@
<!-- Pinned: Be VERY careful about updating https://github.com/moq/moq/issues/1372 -->
<PackageReference Include="Moq" Version="4.20.70" />
<!-- Usage: MSTest execution -->
<PackageReference Include="MSTest.TestAdapter" Version="3.4.3" />
<PackageReference Include="MSTest.TestAdapter" Version="3.5.0" />
<!-- Usage: MSTest asserts etc... -->
<PackageReference Include="MSTest.TestFramework" Version="3.4.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.5.0" />
</ItemGroup>
</Project>
+5 -5
View File
@@ -3,13 +3,13 @@
<!-- Integration tests will ensure they match across the board -->
<Import Project="WebpanelVersion.props" />
<PropertyGroup>
<TgsCoreVersion>6.6.1</TgsCoreVersion>
<TgsCoreVersion>6.7.0</TgsCoreVersion>
<TgsConfigVersion>5.1.0</TgsConfigVersion>
<TgsApiVersion>10.4.0</TgsApiVersion>
<TgsApiVersion>10.5.0</TgsApiVersion>
<TgsCommonLibraryVersion>7.0.0</TgsCommonLibraryVersion>
<TgsApiLibraryVersion>13.4.0</TgsApiLibraryVersion>
<TgsClientVersion>15.4.0</TgsClientVersion>
<TgsDmapiVersion>7.1.2</TgsDmapiVersion>
<TgsApiLibraryVersion>13.5.0</TgsApiLibraryVersion>
<TgsClientVersion>15.5.0</TgsClientVersion>
<TgsDmapiVersion>7.1.3</TgsDmapiVersion>
<TgsInteropVersion>5.9.0</TgsInteropVersion>
<TgsHostWatchdogVersion>1.4.1</TgsHostWatchdogVersion>
<TgsContainerScriptVersion>1.2.1</TgsContainerScriptVersion>
+1 -1
View File
@@ -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>5.8.0</TgsWebpanelVersion>
<TgsWebpanelVersion>5.9.0</TgsWebpanelVersion>
</PropertyGroup>
</Project>
@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"wix": {
"version": "4.0.4",
"version": "5.0.1",
"commands": [
"wix"
]
@@ -1,4 +1,4 @@
<Project Sdk="WixToolset.Sdk/4.0.4" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Project Sdk="WixToolset.Sdk/5.0.1" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Import Project="../../../Common.props" />
<PropertyGroup>
<DefineConstants>ProductVersion=$(TgsCoreVersion);NetMajorVersion=$(TgsNetMajorVersion);DotnetRedistUrl=$(TgsDotnetRedistUrl);MariaDBRedistUrl=https://github.com/tgstation/tgstation-server/releases/download/tgstation-server-v$(TgsCoreVersion)/mariadb-$(TgsMariaDBRedistVersion)-winx64.msi</DefineConstants>
@@ -24,8 +24,8 @@
<Content Include="Theme.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.4" />
<PackageReference Include="WixToolset.Netfx.wixext" Version="4.0.4" />
<PackageReference Include="WixToolset.Bal.wixext" Version="5.0.1" />
<PackageReference Include="WixToolset.Netfx.wixext" Version="5.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tgstation.Server.Host.Service.Wix\Tgstation.Server.Host.Service.Wix.wixproj" />
@@ -1,4 +1,4 @@
<Project Sdk="WixToolset.Sdk/4.0.4">
<Project Sdk="WixToolset.Sdk/5.0.1">
<Import Project="../../../Common.props" />
<PropertyGroup>
<DefineConstants>ProductVersion=$(TgsCoreVersion)</DefineConstants>
@@ -25,8 +25,8 @@
</HarvestDirectory>
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Heat" Version="4.0.4" />
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.4" />
<PackageReference Include="WixToolset.Heat" Version="5.0.1" />
<PackageReference Include="WixToolset.Util.wixext" Version="5.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tgstation.Server.Host.Service.Wix.Extensions\Tgstation.Server.Host.Service.Wix.Extensions.csproj" />
+1 -1
View File
@@ -1,6 +1,6 @@
// tgstation-server DMAPI
#define TGS_DMAPI_VERSION "7.1.2"
#define TGS_DMAPI_VERSION "7.1.3"
// All functions and datums outside this document are subject to change with any version and should not be relied on.
+1 -1
View File
@@ -1,6 +1,6 @@
# DMAPI Internals
This folder should be placed on it's own inside a codebase that wishes to use the TGS DMAPI. Warranty void if modified.
This folder should be placed on its own inside a codebase that wishes to use the TGS DMAPI. Warranty void if modified.
- [includes.dm](./includes.dm) is the file that should be included by DM code, it handles including the rest.
- The [core](./core) folder includes all code not directly part of any API version.
+2 -3
View File
@@ -1,5 +1,4 @@
using System;
using System.ComponentModel;
using System.ComponentModel;
using Tgstation.Server.Common;
@@ -8,7 +7,7 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// Types of <see cref="Response.ErrorMessageResponse"/>s that the API may return.
/// </summary>
/// <remarks>Entries marked with the <see cref="ObsoleteAttribute"/> are no longer in use but kept for placeholders until they can be recycled in the next major API version.</remarks>
/// <remarks>Entries marked Obsolete are no longer in use but kept for placeholders until they can be recycled in the next major API version.</remarks>
public enum ErrorCode : uint
{
/// <summary>
@@ -46,6 +46,13 @@ namespace Tgstation.Server.Api.Models.Internal
[Range(1, UInt16.MaxValue)]
public ushort? Port { get; set; }
/// <summary>
/// The port used by <see cref="EngineType.OpenDream"/> for its topic port.
/// </summary>
[Required]
[ResponseOptions]
public ushort? OpenDreamTopicPort { get; set; }
/// <summary>
/// The DreamDaemon startup timeout in seconds.
/// </summary>
@@ -109,8 +116,9 @@ namespace Tgstation.Server.Api.Models.Internal
/// Check if we match a given set of <paramref name="otherParameters"/>. <see cref="StartupTimeout"/> is excluded.
/// </summary>
/// <param name="otherParameters">The <see cref="DreamDaemonLaunchParameters"/> to compare against.</param>
/// <param name="engineType">The <see cref="EngineType"/> currently running.</param>
/// <returns><see langword="true"/> if they match, <see langword="false"/> otherwise.</returns>
public bool CanApplyWithoutReboot(DreamDaemonLaunchParameters otherParameters)
public bool CanApplyWithoutReboot(DreamDaemonLaunchParameters otherParameters, EngineType engineType)
{
if (otherParameters == null)
throw new ArgumentNullException(nameof(otherParameters));
@@ -119,6 +127,7 @@ namespace Tgstation.Server.Api.Models.Internal
&& SecurityLevel == otherParameters.SecurityLevel
&& Visibility == otherParameters.Visibility
&& Port == otherParameters.Port
&& (OpenDreamTopicPort == otherParameters.OpenDreamTopicPort || engineType != EngineType.OpenDream)
&& TopicRequestTimeout == otherParameters.TopicRequestTimeout
&& AdditionalParameters == otherParameters.AdditionalParameters
&& StartProfiler == otherParameters.StartProfiler
@@ -48,6 +48,12 @@ namespace Tgstation.Server.Api.Models.Response
[ResponseOptions]
public ushort? CurrentPort { get; set; }
/// <summary>
/// The <see cref="EngineType.OpenDream"/> topic port the running <see cref="DreamDaemonResponse"/> instance is set to.
/// </summary>
[ResponseOptions]
public ushort? CurrentTopicPort { get; set; }
/// <summary>
/// The webclient status the running <see cref="DreamDaemonResponse"/> instance is set to.
/// </summary>
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../build/NugetCommon.props" />
<Import Project="../../build/NewtonsoftJson.props" />
<PropertyGroup>
<TargetFramework>$(TgsNugetNetFramework)</TargetFramework>
@@ -27,9 +28,7 @@
<!-- Usage: HTTP constants reference -->
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.2.0" />
<!-- Usage: Decoding the 'nbf' property of JWTs -->
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.6.2" />
<!-- Usage: Primary JSON library -->
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.0.0" />
<!-- Usage: Data model annotating -->
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
</ItemGroup>
@@ -11,14 +11,15 @@
<ItemGroup>
<!-- Usage: Connecting to SignalR hubs in API -->
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.7" />
<!-- Usage: Using target JSON serializer for API -->
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="8.0.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tgstation.Server.Api\Tgstation.Server.Api.csproj" />
<ProjectReference Include="..\Tgstation.Server.Common\Tgstation.Server.Common.csproj" /> <!-- Needed for explicit nuget versioning -->
<!-- Already exists via TGS.Server.Api, but needed for explicit nuget versioning -->
<ProjectReference Include="..\Tgstation.Server.Common\Tgstation.Server.Common.csproj" />
</ItemGroup>
</Project>
@@ -21,6 +21,9 @@ namespace Tgstation.Server.Host.Common
public static IEnumerable<string> GetPotentialDotnetPaths(bool isWindows)
{
var enviromentPath = Environment.GetEnvironmentVariable("PATH");
if (enviromentPath == null)
return Enumerable.Empty<string>();
var paths = enviromentPath.Split(';');
var exeName = "dotnet";
@@ -4,6 +4,7 @@
<PropertyGroup>
<TargetFrameworks>$(TgsFrameworkVersion);net2.0</TargetFrameworks>
<Version>$(TgsCoreVersion)</Version>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "8.0.6",
"version": "8.0.7",
"commands": [
"dotnet-ef"
]
@@ -785,6 +785,7 @@ namespace Tgstation.Server.Host.Components.Deployment
{
AllowWebClient = false,
Port = portToUse,
OpenDreamTopicPort = 0,
SecurityLevel = securityLevel,
Visibility = DreamDaemonVisibility.Invisible,
StartupTimeout = timeout,
@@ -107,7 +107,7 @@ namespace Tgstation.Server.Host.Components.Engine
var parametersString = EncodeParameters(parameters, launchParameters);
var arguments = $"--cvar {(logFilePath != null ? $"log.path=\"{InstallationIOManager.GetDirectoryName(logFilePath)}\" --cvar log.format=\"{InstallationIOManager.GetFileName(logFilePath)}\"" : "log.enabled=false")} --cvar watchdog.token={accessIdentifier} --cvar log.runtimelog=false --cvar net.port={launchParameters.Port!.Value} --cvar opendream.topic_port=0 --cvar opendream.world_params=\"{parametersString}\" --cvar opendream.json_path=\"./{dmbProvider.DmbName}\"";
var arguments = $"--cvar {(logFilePath != null ? $"log.path=\"{InstallationIOManager.GetDirectoryName(logFilePath)}\" --cvar log.format=\"{InstallationIOManager.GetFileName(logFilePath)}\"" : "log.enabled=false")} --cvar watchdog.token={accessIdentifier} --cvar log.runtimelog=false --cvar net.port={launchParameters.Port!.Value} --cvar opendream.topic_port={launchParameters.OpenDreamTopicPort!.Value} --cvar opendream.world_params=\"{parametersString}\" --cvar opendream.json_path=\"./{dmbProvider.DmbName}\"";
return arguments;
}
@@ -5,6 +5,7 @@ using Newtonsoft.Json.Serialization;
using Tgstation.Server.Host.Extensions.Converters;
using Tgstation.Server.Host.Properties;
using Tgstation.Server.Shared;
namespace Tgstation.Server.Host.Components.Interop
{
@@ -272,8 +272,13 @@ namespace Tgstation.Server.Host.Components.Watchdog
{
using (await SemaphoreSlimContext.Lock(synchronizationSemaphore, cancellationToken))
{
bool match = launchParameters.CanApplyWithoutReboot(ActiveLaunchParameters);
var currentLaunchParameters = ActiveLaunchParameters;
ActiveLaunchParameters = launchParameters;
var currentEngine = GetActiveController()?.EngineVersion.Engine;
if (!currentEngine.HasValue)
return false;
bool match = launchParameters.CanApplyWithoutReboot(currentLaunchParameters, currentEngine.Value);
if (match || Status == WatchdogStatus.Offline || Status == WatchdogStatus.DelayedRestart)
return false;
@@ -211,6 +211,7 @@ namespace Tgstation.Server.Host.Controllers
if (CheckModified(x => x.AllowWebClient, DreamDaemonRights.SetWebClient)
|| CheckModified(x => x.AutoStart, DreamDaemonRights.SetAutoStart)
|| CheckModified(x => x.Port, DreamDaemonRights.SetPort)
|| CheckModified(x => x.OpenDreamTopicPort, DreamDaemonRights.SetPort)
|| CheckModified(x => x.SecurityLevel, DreamDaemonRights.SetSecurity)
|| CheckModified(x => x.Visibility, DreamDaemonRights.SetVisibility)
|| (model.SoftRestart.HasValue && !ddRights.HasFlag(DreamDaemonRights.SoftRestart))
@@ -344,10 +345,12 @@ namespace Tgstation.Server.Host.Controllers
var rstate = dd.RebootState;
result.AutoStart = settings.AutoStart!.Value;
result.CurrentPort = llp?.Port!.Value;
result.CurrentTopicPort = llp?.OpenDreamTopicPort;
result.CurrentSecurity = llp?.SecurityLevel!.Value;
result.CurrentVisibility = llp?.Visibility!.Value;
result.CurrentAllowWebclient = llp?.AllowWebClient!.Value;
result.Port = settings.Port!.Value;
result.OpenDreamTopicPort = settings.OpenDreamTopicPort;
result.AllowWebClient = settings.AllowWebClient!.Value;
var firstIteration = true;
@@ -742,6 +742,7 @@ namespace Tgstation.Server.Host.Controllers
AllowWebClient = false,
AutoStart = false,
Port = ddPort,
OpenDreamTopicPort = 0,
SecurityLevel = DreamDaemonSecurity.Safe,
Visibility = DreamDaemonVisibility.Public,
StartupTimeout = 60,
@@ -50,7 +50,6 @@ using Tgstation.Server.Host.Controllers;
using Tgstation.Server.Host.Controllers.Results;
using Tgstation.Server.Host.Database;
using Tgstation.Server.Host.Extensions;
using Tgstation.Server.Host.Extensions.Converters;
using Tgstation.Server.Host.IO;
using Tgstation.Server.Host.Jobs;
using Tgstation.Server.Host.Properties;
@@ -61,6 +60,7 @@ using Tgstation.Server.Host.Swarm;
using Tgstation.Server.Host.System;
using Tgstation.Server.Host.Transfer;
using Tgstation.Server.Host.Utils;
using Tgstation.Server.Shared;
namespace Tgstation.Server.Host.Core
{
@@ -375,22 +375,22 @@ namespace Tgstation.Server.Host.Database
/// <summary>
/// Used by unit tests to remind us to setup the correct MSSQL migration downgrades.
/// </summary>
internal static readonly Type MSLatestMigration = typeof(MSAddCronAutoUpdates);
internal static readonly Type MSLatestMigration = typeof(MSAddOpenDreamTopicPort);
/// <summary>
/// Used by unit tests to remind us to setup the correct MYSQL migration downgrades.
/// </summary>
internal static readonly Type MYLatestMigration = typeof(MYAddCronAutoUpdates);
internal static readonly Type MYLatestMigration = typeof(MYAddOpenDreamTopicPort);
/// <summary>
/// Used by unit tests to remind us to setup the correct PostgresSQL migration downgrades.
/// </summary>
internal static readonly Type PGLatestMigration = typeof(PGAddCronAutoUpdates);
internal static readonly Type PGLatestMigration = typeof(PGAddOpenDreamTopicPort);
/// <summary>
/// Used by unit tests to remind us to setup the correct SQLite migration downgrades.
/// </summary>
internal static readonly Type SLLatestMigration = typeof(SLAddCronAutoUpdates);
internal static readonly Type SLLatestMigration = typeof(SLAddOpenDreamTopicPort);
/// <inheritdoc />
#pragma warning disable CA1502 // Cyclomatic complexity
@@ -419,6 +419,16 @@ namespace Tgstation.Server.Host.Database
string BadDatabaseType() => throw new ArgumentException($"Invalid DatabaseType: {currentDatabaseType}", nameof(currentDatabaseType));
if (targetVersion < new Version(6, 7, 0))
targetMigration = currentDatabaseType switch
{
DatabaseType.MySql => nameof(MSAddCronAutoUpdates),
DatabaseType.PostgresSql => nameof(PGAddCronAutoUpdates),
DatabaseType.SqlServer => nameof(MSAddCronAutoUpdates),
DatabaseType.Sqlite => nameof(SLAddCronAutoUpdates),
_ => BadDatabaseType(),
};
if (targetVersion < new Version(6, 6, 0))
targetMigration = currentDatabaseType switch
{
@@ -0,0 +1,33 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Tgstation.Server.Host.Database.Migrations
{
/// <inheritdoc />
public partial class MSAddOpenDreamTopicPort : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
ArgumentNullException.ThrowIfNull(migrationBuilder);
migrationBuilder.AddColumn<int>(
name: "OpenDreamTopicPort",
table: "DreamDaemonSettings",
type: "int",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
ArgumentNullException.ThrowIfNull(migrationBuilder);
migrationBuilder.DropColumn(
name: "OpenDreamTopicPort",
table: "DreamDaemonSettings");
}
}
}
@@ -0,0 +1,33 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Tgstation.Server.Host.Database.Migrations
{
/// <inheritdoc />
public partial class MYAddOpenDreamTopicPort : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
ArgumentNullException.ThrowIfNull(migrationBuilder);
migrationBuilder.AddColumn<ushort>(
name: "OpenDreamTopicPort",
table: "DreamDaemonSettings",
type: "smallint unsigned",
nullable: false,
defaultValue: (ushort)0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
ArgumentNullException.ThrowIfNull(migrationBuilder);
migrationBuilder.DropColumn(
name: "OpenDreamTopicPort",
table: "DreamDaemonSettings");
}
}
}
@@ -0,0 +1,33 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Tgstation.Server.Host.Database.Migrations
{
/// <inheritdoc />
public partial class PGAddOpenDreamTopicPort : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
ArgumentNullException.ThrowIfNull(migrationBuilder);
migrationBuilder.AddColumn<int>(
name: "OpenDreamTopicPort",
table: "DreamDaemonSettings",
type: "integer",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
ArgumentNullException.ThrowIfNull(migrationBuilder);
migrationBuilder.DropColumn(
name: "OpenDreamTopicPort",
table: "DreamDaemonSettings");
}
}
}
@@ -0,0 +1,33 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Tgstation.Server.Host.Database.Migrations
{
/// <inheritdoc />
public partial class SLAddOpenDreamTopicPort : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
ArgumentNullException.ThrowIfNull(migrationBuilder);
migrationBuilder.AddColumn<ushort>(
name: "OpenDreamTopicPort",
table: "DreamDaemonSettings",
type: "INTEGER",
nullable: false,
defaultValue: (ushort)0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
ArgumentNullException.ThrowIfNull(migrationBuilder);
migrationBuilder.DropColumn(
name: "OpenDreamTopicPort",
table: "DreamDaemonSettings");
}
}
}
@@ -13,7 +13,7 @@ namespace Tgstation.Server.Host.Database.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("ProductVersion", "8.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
@@ -233,6 +233,10 @@ namespace Tgstation.Server.Host.Database.Migrations
.IsRequired()
.HasColumnType("tinyint(1)");
b.Property<ushort?>("OpenDreamTopicPort")
.IsRequired()
.HasColumnType("smallint unsigned");
b.Property<ushort?>("Port")
.IsRequired()
.HasColumnType("smallint unsigned");
@@ -13,7 +13,7 @@ namespace Tgstation.Server.Host.Database.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("ProductVersion", "8.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@@ -213,6 +213,9 @@ namespace Tgstation.Server.Host.Database.Migrations
.IsRequired()
.HasColumnType("boolean");
b.Property<int>("OpenDreamTopicPort")
.HasColumnType("integer");
b.Property<int>("Port")
.HasColumnType("integer");
@@ -13,7 +13,7 @@ namespace Tgstation.Server.Host.Database.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("ProductVersion", "8.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@@ -215,6 +215,9 @@ namespace Tgstation.Server.Host.Database.Migrations
.IsRequired()
.HasColumnType("bit");
b.Property<int>("OpenDreamTopicPort")
.HasColumnType("int");
b.Property<int>("Port")
.HasColumnType("int");
@@ -12,7 +12,7 @@ namespace Tgstation.Server.Host.Database.Migrations
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.6");
modelBuilder.HasAnnotation("ProductVersion", "8.0.7");
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatBot", b =>
{
@@ -205,6 +205,10 @@ namespace Tgstation.Server.Host.Database.Migrations
.IsRequired()
.HasColumnType("INTEGER");
b.Property<ushort?>("OpenDreamTopicPort")
.IsRequired()
.HasColumnType("INTEGER");
b.Property<ushort?>("Port")
.IsRequired()
.HasColumnType("INTEGER");
@@ -23,11 +23,11 @@ using Npgsql;
using Tgstation.Server.Common;
using Tgstation.Server.Host.Configuration;
using Tgstation.Server.Host.Database;
using Tgstation.Server.Host.Extensions.Converters;
using Tgstation.Server.Host.IO;
using Tgstation.Server.Host.Properties;
using Tgstation.Server.Host.System;
using Tgstation.Server.Host.Utils;
using Tgstation.Server.Shared;
using YamlDotNet.Serialization;
@@ -986,14 +986,15 @@ namespace Tgstation.Server.Host.Setup
{ SwarmConfiguration.Section, swarmConfiguration },
};
var versionConverter = new VersionConverter();
var builder = new SerializerBuilder()
.WithTypeConverter(new VersionConverter());
.WithTypeConverter(versionConverter);
if (userConfigFileName.EndsWith(".json", StringComparison.OrdinalIgnoreCase))
builder.JsonCompatible();
var serializer = new SerializerBuilder()
.WithTypeConverter(new VersionConverter())
.WithTypeConverter(versionConverter)
.Build();
var serializedYaml = serializer.Serialize(map);
@@ -3,6 +3,7 @@ using Newtonsoft.Json.Serialization;
using Tgstation.Server.Api;
using Tgstation.Server.Host.Extensions.Converters;
using Tgstation.Server.Shared;
namespace Tgstation.Server.Host.Swarm
{
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="../../build/SrcCommon.props" />
<PropertyGroup>
@@ -77,24 +77,22 @@
<PackageReference Include="GitLabApiClient" Version="1.8.0" />
<!-- Usage: git interop -->
<PackageReference Include="LibGit2Sharp" Version="0.30.0" />
<!-- Usage: JWT injection into HTTP pipeline -->
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.6" />
<!-- Usage: Support ""legacy"" Newotonsoft.Json in HTTP pipeline. The rest of our codebase uses Newtonsoft. -->
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.7" />
<!-- Usage: Using target JSON serializer for API -->
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="8.0.7" />
<!-- Usage: Generating dumps of dotnet engine processes -->
<PackageReference Include="Microsoft.Diagnostics.NETCore.Client" Version="0.2.532401" />
<!-- Usage: Database ORM -->
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.7" />
<!-- Usage: Automatic migration generation using command line -->
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.6">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<!-- Usage: Sqlite ORM plugin -->
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.7" />
<!-- Usage: MSSQL ORM plugin -->
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.7" />
<!-- Usage: POSIX support for syscalls, signals, and symlinks -->
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
<PackageReference Include="NCrontab.Signed" Version="3.3.3" />
@@ -102,8 +100,6 @@
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="3.1.0" />
<!-- Usage: PostgresSQL ORM plugin -->
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
<!-- Usage: GitHub.com interop -->
<PackageReference Include="Octokit" Version="13.0.0" />
<!-- Usage: MYSQL/MariaDB ORM plugin -->
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
<!-- Usage: Discord interop -->
@@ -135,6 +131,7 @@
<ItemGroup>
<ProjectReference Include="..\Tgstation.Server.Api\Tgstation.Server.Api.csproj" />
<ProjectReference Include="..\Tgstation.Server.Host.Common\Tgstation.Server.Host.Common.csproj" />
<ProjectReference Include="..\Tgstation.Server.Shared\Tgstation.Server.Shared.csproj" />
</ItemGroup>
<ItemGroup>
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../build/Common.props" />
<Import Project="../../build/NewtonsoftJson.props" />
<PropertyGroup>
<TargetFramework>$(TgsFrameworkVersion)</TargetFramework>
<Version>$(TgsCoreVersion)</Version>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<!-- Usage: JWT injection into HTTP pipeline -->
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.7" />
<!-- Usage: GitHub.com interop -->
<PackageReference Include="Octokit" Version="13.0.1" />
<!-- Usage: YAML conversion of Version objects -->
<PackageReference Include="YamlDotNet" Version="16.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tgstation.Server.Common\Tgstation.Server.Common.csproj" />
</ItemGroup>
</Project>
@@ -8,7 +8,7 @@ using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Serialization;
namespace Tgstation.Server.Host.Extensions.Converters
namespace Tgstation.Server.Shared
{
/// <summary>
/// <see cref="JsonConverter"/> and <see cref="IYamlTypeConverter"/> for serializing <see cref="global::System.Version"/>s in semver format.
@@ -85,10 +85,10 @@ namespace Tgstation.Server.Host.Extensions.Converters
public bool Accepts(Type type) => CheckSupportsType(type, false);
/// <inheritdoc />
public object ReadYaml(IParser parser, Type type) => throw new NotSupportedException("Deserialization not supported!"); // The default implementation is fine at handling this
public object ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer) => throw new NotSupportedException("Deserialization not supported!"); // The default implementation is fine at handling this
/// <inheritdoc />
public void WriteYaml(IEmitter? emitter, object? value, Type type)
public void WriteYaml(IEmitter? emitter, object? value, Type type, ObjectSerializer serializer)
{
ArgumentNullException.ThrowIfNull(emitter);
@@ -6,6 +6,7 @@
</PropertyGroup>
<ItemGroup>
<!-- Usage: Creating mock database implementations -->
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.6" />
</ItemGroup>
@@ -1,11 +1,12 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tgstation.Server.Common.Extensions;
using YamlDotNet.Serialization;
namespace Tgstation.Server.Host.Extensions.Converters.Tests
namespace Tgstation.Server.Shared.Tests
{
[TestClass]
public sealed class TestVersionConverter
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../build/TestCommon.props" />
<PropertyGroup>
<TargetFramework>$(TgsFrameworkVersion)</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Tgstation.Server.Shared\Tgstation.Server.Shared.csproj" />
</ItemGroup>
</Project>
@@ -40,6 +40,8 @@ using Tgstation.Server.Host.IO;
using Tgstation.Server.Host.System;
using Tgstation.Server.Host.Utils;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace Tgstation.Server.Tests.Live.Instance
{
sealed class WatchdogTest : JobsRequiredTest
@@ -136,15 +138,18 @@ namespace Tgstation.Server.Tests.Live.Instance
{
// Increase startup timeout, disable heartbeats, enable map threads because we've tested without for years
global::System.Console.WriteLine($"PORT REUSE BUG 4: Setting I-{instanceClient.Metadata.Id} DD to {ddPort}");
await instanceClient.DreamDaemon.Update(new DreamDaemonRequest
var updated = await instanceClient.DreamDaemon.Update(new DreamDaemonRequest
{
StartupTimeout = 60,
HealthCheckSeconds = 0,
Port = ddPort,
MapThreads = 2,
OpenDreamTopicPort = 47,
LogOutput = false,
AdditionalParameters = BaseAdditionalParameters
}, cancellationToken);
Assert.AreEqual<ushort?>(47, updated.OpenDreamTopicPort);
}
catch (ConflictException ex) when (ex.ErrorCode == ErrorCode.PortNotAvailable)
{
@@ -154,6 +159,13 @@ namespace Tgstation.Server.Tests.Live.Instance
// I have no idea why this happens sometimes
await Task.Delay(TimeSpan.FromSeconds(3), cancellationToken);
}
var updated2 = await instanceClient.DreamDaemon.Update(new DreamDaemonRequest
{
OpenDreamTopicPort = 0,
}, cancellationToken);
Assert.AreEqual<ushort?>(0, updated2.OpenDreamTopicPort);
}
global::System.Console.WriteLine($"PORT REUSE BUG 4: Expect error. Setting I-{instanceClient.Metadata.Id} DD to 0");
@@ -115,6 +115,7 @@ namespace Tgstation.Server.Tests
HealthCheckSeconds = 0,
DumpOnHealthCheckRestart = false,
Port = 1447,
OpenDreamTopicPort = 0,
SecurityLevel = DreamDaemonSecurity.Safe,
Visibility = DreamDaemonVisibility.Public,
StartupTimeout = 1000,
+31 -1
View File
@@ -29,6 +29,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{6FF654E6
build\Dockerfile = build\Dockerfile
build\GenerateMigrations.sh = build\GenerateMigrations.sh
build\logo.svg = build\logo.svg
build\NewtonsoftJson.props = build\NewtonsoftJson.props
build\NugetCommon.props = build\NugetCommon.props
build\OpenApiValidationSettings.json = build\OpenApiValidationSettings.json
build\SrcCommon.props = build\SrcCommon.props
@@ -261,7 +262,11 @@ Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "Tgstation.Server.Host.Servi
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tgstation.Server.ReleaseNotes", "tools\Tgstation.Server.ReleaseNotes\Tgstation.Server.ReleaseNotes.csproj", "{69944039-65C2-40E1-9D86-0608FA0C2D70}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tgstation.Server.LogoGenerator", "tools\Tgstation.Server.LogoGenerator\Tgstation.Server.LogoGenerator.csproj", "{7F7FCFDF-271D-45C2-830C-BCCB19C57077}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tgstation.Server.LogoGenerator", "tools\Tgstation.Server.LogoGenerator\Tgstation.Server.LogoGenerator.csproj", "{7F7FCFDF-271D-45C2-830C-BCCB19C57077}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tgstation.Server.Shared", "src\Tgstation.Server.Shared\Tgstation.Server.Shared.csproj", "{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tgstation.Server.Shared.Tests", "tests\Tgstation.Server.Shared.Tests\Tgstation.Server.Shared.Tests.csproj", "{EAB84FD0-5514-4254-B188-7D90ACB7284D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -533,6 +538,30 @@ Global
{7F7FCFDF-271D-45C2-830C-BCCB19C57077}.ReleaseNoWindows|Any CPU.Build.0 = Release|Any CPU
{7F7FCFDF-271D-45C2-830C-BCCB19C57077}.ReleaseNoWix|Any CPU.ActiveCfg = Release|Any CPU
{7F7FCFDF-271D-45C2-830C-BCCB19C57077}.ReleaseNoWix|Any CPU.Build.0 = Release|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.DebugNoWindows|Any CPU.ActiveCfg = Debug|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.DebugNoWindows|Any CPU.Build.0 = Debug|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.DebugNoWix|Any CPU.ActiveCfg = Debug|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.DebugNoWix|Any CPU.Build.0 = Debug|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.Release|Any CPU.Build.0 = Release|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.ReleaseNoWindows|Any CPU.ActiveCfg = Release|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.ReleaseNoWindows|Any CPU.Build.0 = Release|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.ReleaseNoWix|Any CPU.ActiveCfg = Release|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.ReleaseNoWix|Any CPU.Build.0 = Release|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.DebugNoWindows|Any CPU.ActiveCfg = Debug|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.DebugNoWindows|Any CPU.Build.0 = Debug|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.DebugNoWix|Any CPU.ActiveCfg = Debug|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.DebugNoWix|Any CPU.Build.0 = Debug|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.Release|Any CPU.Build.0 = Release|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.ReleaseNoWindows|Any CPU.ActiveCfg = Release|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.ReleaseNoWindows|Any CPU.Build.0 = Release|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.ReleaseNoWix|Any CPU.ActiveCfg = Release|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.ReleaseNoWix|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -571,6 +600,7 @@ Global
{9E66C6F1-E235-4979-83B5-C2B3FDAD6E01} = {506B9092-AF88-4DA2-84FD-C11646B695B0}
{69944039-65C2-40E1-9D86-0608FA0C2D70} = {A55C1117-5808-4AB2-BEA6-4D4A3E66A2F2}
{7F7FCFDF-271D-45C2-830C-BCCB19C57077} = {A55C1117-5808-4AB2-BEA6-4D4A3E66A2F2}
{EAB84FD0-5514-4254-B188-7D90ACB7284D} = {316141B0-CD21-4769-A013-D53DA9B9EC09}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DFD36C95-3E49-41C7-ACDB-86BAF5B18A79}
+39 -4
View File
@@ -25,7 +25,7 @@ using Newtonsoft.Json;
using Octokit;
using Octokit.GraphQL;
using Tgstation.Server.Host.Extensions.Converters;
using Tgstation.Server.Shared;
using YamlDotNet.Serialization;
@@ -61,6 +61,7 @@ namespace Tgstation.Server.ReleaseNotes
var fullNotes = versionString.Equals("--generate-full-notes", StringComparison.OrdinalIgnoreCase);
var nuget = versionString.Equals("--nuget", StringComparison.OrdinalIgnoreCase);
var ciCompletionCheck = versionString.Equals("--ci-completion-check", StringComparison.OrdinalIgnoreCase);
var genToken = versionString.Equals("--token-output-file", StringComparison.OrdinalIgnoreCase);
if ((!Version.TryParse(versionString, out var version) || version.Revision != -1)
&& !ensureRelease
@@ -68,7 +69,8 @@ namespace Tgstation.Server.ReleaseNotes
&& !shaCheck
&& !fullNotes
&& !nuget
&& !ciCompletionCheck)
&& !ciCompletionCheck
&& !genToken)
{
Console.WriteLine("Invalid version: " + versionString);
return 2;
@@ -126,7 +128,17 @@ namespace Tgstation.Server.ReleaseNotes
try
{
if (ensureRelease)
{
if (args.Length < 2)
{
Console.WriteLine("Missing PEM Base64 for updating release!");
return 454233;
}
await GenerateAppCredentials(client, args[1]);
return await EnsureRelease(client);
}
if (linkWinget)
{
@@ -150,6 +162,24 @@ namespace Tgstation.Server.ReleaseNotes
return await CICompletionCheck(client, args[1], args[2]);
}
if (genToken)
{
if (args.Length < 3)
{
Console.WriteLine("Missing output file path or PEM Base64 for app authentication!");
return 33847;
}
await GenerateAppCredentials(client, args[2]);
var token = client.Credentials.GetToken();
var destPath = args[1];
Directory.CreateDirectory(Path.GetDirectoryName(destPath));
await File.WriteAllTextAsync(destPath, token);
return 0;
}
if (shaCheck)
{
if(args.Length < 2)
@@ -1610,7 +1640,7 @@ package (version) distribution(s); urgency=urgency
return 0;
}
static async ValueTask<int> CICompletionCheck(GitHubClient gitHubClient, string currentSha, string pemBase64)
static async ValueTask GenerateAppCredentials(GitHubClient gitHubClient, string pemBase64)
{
var pemBytes = Convert.FromBase64String(pemBase64);
var pem = Encoding.UTF8.GetString(pemBytes);
@@ -1639,10 +1669,15 @@ package (version) distribution(s); urgency=urgency
var installToken = await gitHubClient.GitHubApps.CreateInstallationToken(installation.Id);
gitHubClient.Credentials = new Credentials(installToken.Token);
}
static async ValueTask<int> CICompletionCheck(GitHubClient gitHubClient, string currentSha, string pemBase64)
{
await GenerateAppCredentials(gitHubClient, pemBase64);
await gitHubClient.Check.Run.Create(RepoOwner, RepoName, new NewCheckRun("CI Completion", currentSha)
{
CompletedAt = now,
CompletedAt = DateTime.UtcNow,
Conclusion = CheckConclusion.Success,
Output = new NewCheckRunOutput("CI Completion", "The CI Pipeline completed successfully"),
Status = CheckStatus.Completed,
@@ -12,7 +12,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Tgstation.Server.Host\Tgstation.Server.Host.csproj" />
<ProjectReference Include="..\..\src\Tgstation.Server.Shared\Tgstation.Server.Shared.csproj" />
</ItemGroup>
</Project>