From b545fb1a1367d531eb05568dda07bc36d67ae936 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Fri, 15 Aug 2025 19:13:29 -0400 Subject: [PATCH] Remove telemetry --- .github/workflows/ci-pipeline.yml | 88 +----- README.md | 6 - build/Dockerfile | 6 +- build/Version.props | 2 +- .../Configuration/TelemetryConfiguration.cs | 33 --- src/Tgstation.Server.Host/Core/Application.cs | 2 - .../Core/VersionReportingService.cs | 271 ------------------ .../TelemetryAppSerializedKeyAttribute.cs | 33 --- .../Setup/SetupWizard.cs | 32 --- .../Tgstation.Server.Host.csproj | 20 -- src/Tgstation.Server.Host/appsettings.yml | 4 - .../Setup/TestSetupWizard.cs | 7 - .../Live/LiveTestingServer.cs | 1 - 13 files changed, 3 insertions(+), 502 deletions(-) delete mode 100644 src/Tgstation.Server.Host/Configuration/TelemetryConfiguration.cs delete mode 100644 src/Tgstation.Server.Host/Core/VersionReportingService.cs delete mode 100644 src/Tgstation.Server.Host/Properties/TelemetryAppSerializedKeyAttribute.cs diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index c8ca063711..17188ac6d3 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -133,8 +133,6 @@ jobs: timeout-minutes: 15 permissions: security-events: write - env: - TGS_TELEMETRY_KEY_FILE: /tmp/tgs_telemetry_key.txt steps: - name: Install Native Dependencies run: | @@ -176,9 +174,6 @@ jobs: with: languages: csharp - - name: Setup Telemetry Key File - run: echo "fake_telemetry_key" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build # Name checked in rerunFlakyTests.js run: dotnet build -c ReleaseNoWindows -p:TGS_HOST_NO_WEBPANEL=true @@ -507,8 +502,6 @@ jobs: runs-on: ubuntu-latest needs: start-gate timeout-minutes: 10 - env: - TGS_TELEMETRY_KEY_FILE: tgs_telemetry_key.txt steps: - name: Checkout (Branch) uses: actions/checkout@v4 @@ -520,16 +513,8 @@ jobs: with: ref: "refs/pull/${{ inputs.pull_request_number }}/merge" - - name: Setup Telemetry Key File - shell: bash - run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build Docker Image # Name checked in rerunFlakyTests.js - run: docker build . -f build/Dockerfile --build-arg TGS_TELEMETRY_KEY_FILE=${{ env.TGS_TELEMETRY_KEY_FILE }} - - - name: Delete Telemetry Key File - if: always() - run: rm -f ${{ env.TGS_TELEMETRY_KEY_FILE }} + run: docker build . -f build/Dockerfile linux-unit-tests: name: Linux Tests @@ -539,8 +524,6 @@ jobs: fail-fast: false matrix: configuration: ["Debug", "Release"] - env: - TGS_TELEMETRY_KEY_FILE: /tmp/tgs_telemetry_key.txt runs-on: ubuntu-latest steps: - name: Install Native x86 libc Dependencies # Name checked in rerunFlakyTests.js @@ -573,16 +556,9 @@ jobs: - name: Enable Corepack run: corepack enable - - name: Setup Telemetry Key File - run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build # Name checked in rerunFlakyTests.js run: dotnet build -c ${{ matrix.configuration }}NoWindows - - name: Delete Telemetry Key File - if: always() - run: rm -f ${{ env.TGS_TELEMETRY_KEY_FILE }} - - 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: @@ -606,8 +582,6 @@ jobs: fail-fast: false matrix: configuration: ["Debug", "Release"] - env: - TGS_TELEMETRY_KEY_FILE: C:/tgs_telemetry_key.txt runs-on: windows-2025 steps: - name: Setup dotnet @@ -634,18 +608,9 @@ jobs: - name: Enable Corepack run: corepack enable - - name: Setup Telemetry Key File - shell: bash - run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build # Name checked in rerunFlakyTests.js run: dotnet build -c ${{ matrix.configuration }}NoWix - - name: Delete Telemetry Key File - shell: bash - if: always() - run: rm -f ${{ env.TGS_TELEMETRY_KEY_FILE }} - - 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: @@ -712,8 +677,6 @@ jobs: ["SqlServer", "Sqlite", "PostgresSql", "MariaDB", "MySql"] watchdog-type: ["Basic", "Advanced"] configuration: ["Debug", "Release"] - env: - TGS_TELEMETRY_KEY_FILE: C:/tgs_telemetry_key.txt runs-on: windows-2025 steps: - name: Setup dotnet @@ -815,18 +778,9 @@ jobs: - name: Enable Corepack run: corepack enable - - name: Setup Telemetry Key File - shell: bash - run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build # Name checked in rerunFlakyTests.js run: dotnet build -c ${{ matrix.configuration }} tests/Tgstation.Server.Tests/Tgstation.Server.Tests.csproj - - name: Delete Telemetry Key File - shell: bash - if: always() - run: rm -f ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Run Live Tests # Logging here is weird because printing massive amounts of text on Windows runners is SLOW AS SHIT!!! id: live-tests shell: bash @@ -968,8 +922,6 @@ jobs: database-type: ["Sqlite", "PostgresSql", "MariaDB", "MySql"] watchdog-type: ["Basic", "Advanced"] configuration: ["Debug", "Release"] - env: - TGS_TELEMETRY_KEY_FILE: /tmp/tgs_telemetry_key.txt runs-on: ubuntu-latest steps: - name: Setup dotnet @@ -1045,16 +997,9 @@ jobs: - name: Enable Corepack run: corepack enable - - name: Setup Telemetry Key File - run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build # Name checked in rerunFlakyTests.js run: dotnet build -c ${{ matrix.configuration }}NoWindows tests/Tgstation.Server.Tests/Tgstation.Server.Tests.csproj - - name: Delete Telemetry Key File - if: always() - run: rm -f ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Run Live Tests run: | cd tests/Tgstation.Server.Tests @@ -1400,8 +1345,6 @@ jobs: needs: build-releasenotes runs-on: ubuntu-latest timeout-minutes: 30 - env: - TGS_TELEMETRY_KEY_FILE: /tmp/tgs_telemetry_key.txt steps: - name: Install Native Dependencies # Name checked in rerunFlakyTests.js run: | @@ -1448,9 +1391,6 @@ jobs: - name: Grab Most Recent Changelog run: curl -L https://raw.githubusercontent.com/tgstation/tgstation-server/gh-pages/changelog.yml -o changelog.yml - - name: Setup Telemetry Key File - run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Retrieve ReleaseNotes Binaries uses: actions/download-artifact@v4 with: @@ -1490,10 +1430,6 @@ jobs: gpg --verify tgstation-server_${{ env.TGS_VERSION }}-1_amd64.changes gpg --verify tgstation-server_${{ env.TGS_VERSION }}-1_amd64.buildinfo - - name: Delete Telemetry Key File - if: always() - run: rm -f ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Test Install run: | sudo mkdir /etc/tgstation-server @@ -1558,8 +1494,6 @@ jobs: runs-on: windows-2025 needs: start-gate timeout-minutes: 15 - env: - TGS_TELEMETRY_KEY_FILE: C:/tgs_telemetry_key.txt steps: - name: Setup dotnet uses: actions/setup-dotnet@v4 @@ -1593,18 +1527,9 @@ jobs: - name: Enable Corepack run: corepack enable - - name: Setup Telemetry Key File - shell: bash - run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build Host # Name checked in rerunFlakyTests.js run: dotnet build -c Release src/Tgstation.Server.Host/Tgstation.Server.Host.csproj - - name: Delete Telemetry Key File - shell: bash - if: always() - run: rm -f ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build Service # Name checked in rerunFlakyTests.js run: dotnet build -c Release src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj @@ -2128,8 +2053,6 @@ jobs: needs: [deploy-dm, deploy-rest, deploy-gql, deployment-gate] runs-on: windows-2025 if: (!(cancelled() || failure())) && github.event.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[TGSDeploy]') && needs.deployment-gate.result == 'success' - env: - TGS_TELEMETRY_KEY_FILE: C:/tgs_telemetry_key.txt permissions: id-token: write attestations: write @@ -2156,19 +2079,10 @@ jobs: - name: Enable Corepack run: corepack enable - - name: Setup Telemetry Key File - shell: bash - run: echo "${{ secrets.TGS_TELEMETRY_KEY }}" > ${{ env.TGS_TELEMETRY_KEY_FILE }} - # We need to rebuild the installer.exe so it can be properly signed - name: Build Host # Name checked in rerunFlakyTests.js run: dotnet build -c Release src/Tgstation.Server.Host/Tgstation.Server.Host.csproj - - name: Delete Telemetry Key File - shell: bash - if: always() - run: rm -f ${{ env.TGS_TELEMETRY_KEY_FILE }} - - name: Build Service # Name checked in rerunFlakyTests.js run: dotnet build -c Release src/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.csproj diff --git a/README.md b/README.md index 2036b027b9..8cd929bca6 100644 --- a/README.md +++ b/README.md @@ -322,12 +322,6 @@ Create an `appsettings.Production.yml` file next to `appsettings.yml`. This will - `Swarm:UpdateRequiredNodeCount`: Should be set to the total number of servers in your swarm minus 1. Prevents updates from occurring unless the non-controller server count in the swarm is greater than or equal to this value. -- `Telemetry:DisableVersionReporting`: Prevents you installation and the version you're using from being reported on the source repository's deployments list - -- `Telemetry:ServerFriendlyName`: Prevents anonymous TGS version usage statistics from being sent to be displayed on the repository. - -- `Telemetry:VersionReportingRepositoryId`: The repository telemetry is sent to. For security reasons, this is not the main TGS repo. See the [tgstation-server-deployments](https://github.com/tgstation/tgstation-server-deployments) repository for more information. - #### OAuth Configuration - `Security:OAuth:`: Sets the OAuth client ID and secret for a given ``. The currently supported providers are `GitHub`, `Discord`, and `InvisionCommunity`. Setting these fields to `null` disables logins AND gateway auth with the provider, but does not stop users from associating their accounts using the API. Sample Entry: diff --git a/build/Dockerfile b/build/Dockerfile index 8da7a414d2..cfdf9bcaed 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,8 +1,5 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build -# Set in CI -ARG TGS_TELEMETRY_KEY_FILE= - # install node and npm # replace shell with bash so we can source files RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.39.1/install.sh | sh @@ -50,8 +47,7 @@ RUN dotnet publish -c Release -o /app \ WORKDIR /repo/src/Tgstation.Server.Host -RUN export TGS_TELEMETRY_KEY_FILE="../../${TGS_TELEMETRY_KEY_FILE}" \ - && dotnet publish -c Release -o /app/lib/Default \ +RUN dotnet publish -c Release -o /app/lib/Default \ && cd ../.. \ && build/RemoveUnsupportedRuntimes.sh /app/lib/Default \ && mv /app/lib/Default/appsettings* /app diff --git a/build/Version.props b/build/Version.props index 71e9694613..9f9d8caa0f 100644 --- a/build/Version.props +++ b/build/Version.props @@ -4,7 +4,7 @@ 6.19.0 - 5.8.0 + 5.9.0 10.14.0 0.7.0 7.0.0 diff --git a/src/Tgstation.Server.Host/Configuration/TelemetryConfiguration.cs b/src/Tgstation.Server.Host/Configuration/TelemetryConfiguration.cs deleted file mode 100644 index 7ec0361759..0000000000 --- a/src/Tgstation.Server.Host/Configuration/TelemetryConfiguration.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace Tgstation.Server.Host.Configuration -{ - /// - /// Configuration options for telemetry. - /// - public sealed class TelemetryConfiguration - { - /// - /// The key for the the resides in. - /// - public const string Section = "Telemetry"; - - /// - /// The default value of . - /// - private const long DefaultVersionReportingRepositoryId = 841149827; // https://github.com/tgstation/tgstation-server-deployments - - /// - /// If version reporting telemetry is disabled. - /// - public bool DisableVersionReporting { get; set; } - - /// - /// The friendly name used on GitHub deployments for version reporting. If only the server will be shown. - /// - public string? ServerFriendlyName { get; set; } - - /// - /// The GitHub repository ID used for version reporting. - /// - public long? VersionReportingRepositoryId { get; set; } = DefaultVersionReportingRepositoryId; - } -} diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs index 1d3c9cb662..90dca6a151 100644 --- a/src/Tgstation.Server.Host/Core/Application.cs +++ b/src/Tgstation.Server.Host/Core/Application.cs @@ -168,7 +168,6 @@ namespace Tgstation.Server.Host.Core services.UseStandardConfig(Configuration); services.UseStandardConfig(Configuration); services.UseStandardConfig(Configuration); - services.UseStandardConfig(Configuration); // enable options which give us config reloading services.AddOptions(); @@ -488,7 +487,6 @@ namespace Tgstation.Server.Host.Core services.AddSingleton(); services.AddSingleton(fileSystem); services.AddHostedService(); - services.AddHostedService(); services.AddFileDownloader(); services.AddGitHub(); diff --git a/src/Tgstation.Server.Host/Core/VersionReportingService.cs b/src/Tgstation.Server.Host/Core/VersionReportingService.cs deleted file mode 100644 index 3a4feeed37..0000000000 --- a/src/Tgstation.Server.Host/Core/VersionReportingService.cs +++ /dev/null @@ -1,271 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; - -using Octokit; - -using Tgstation.Server.Common.Extensions; -using Tgstation.Server.Host.Configuration; -using Tgstation.Server.Host.Extensions; -using Tgstation.Server.Host.IO; -using Tgstation.Server.Host.Properties; -using Tgstation.Server.Host.System; -using Tgstation.Server.Host.Utils; -using Tgstation.Server.Host.Utils.GitHub; - -namespace Tgstation.Server.Host.Core -{ - /// - /// Handles TGS version reporting, if enabled. - /// - sealed class VersionReportingService : BackgroundService - { - /// - /// The for the . - /// - readonly IGitHubClientFactory gitHubClientFactory; - - /// - /// The for the . - /// - readonly IIOManager ioManager; - - /// - /// The for the . - /// - readonly IAsyncDelayer asyncDelayer; - - /// - /// The for the . - /// - readonly IAssemblyInformationProvider assemblyInformationProvider; - - /// - /// The for the . - /// - readonly ILogger logger; - - /// - /// The for the . - /// - readonly TelemetryConfiguration telemetryConfiguration; - - /// - /// The passed to . - /// - CancellationToken shutdownCancellationToken; - - /// - /// Initializes a new instance of the class. - /// - /// The value of . - /// The value of . - /// The value of . - /// The value of . - /// The containing the value of . - /// The value of . - public VersionReportingService( - IGitHubClientFactory gitHubClientFactory, - IIOManager ioManager, - IAsyncDelayer asyncDelayer, - IAssemblyInformationProvider assemblyInformationProvider, - IOptions telemetryConfigurationOptions, - ILogger logger) - { - this.gitHubClientFactory = gitHubClientFactory ?? throw new ArgumentNullException(nameof(gitHubClientFactory)); - this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager)); - this.asyncDelayer = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer)); - this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider)); - telemetryConfiguration = telemetryConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(telemetryConfigurationOptions)); - this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); - } - - /// - public override Task StopAsync(CancellationToken cancellationToken) - { - shutdownCancellationToken = cancellationToken; - return base.StopAsync(cancellationToken); - } - - /// - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - if (telemetryConfiguration.DisableVersionReporting) - { - logger.LogDebug("Version telemetry disabled"); - return; - } - - if (!telemetryConfiguration.VersionReportingRepositoryId.HasValue) - { - logger.LogError("Version reporting repository is misconfigured. Telemetry cannot be sent!"); - return; - } - - var attribute = TelemetryAppSerializedKeyAttribute.Instance; - if (attribute == null) - { - logger.LogDebug("TGS build configuration does not allow for version telemetry"); - return; - } - - logger.LogDebug("Starting..."); - - try - { - var telemetryIdDirectory = ioManager.GetPathInLocalDirectory(assemblyInformationProvider); - var telemetryIdFile = ioManager.ResolvePath( - ioManager.ConcatPath( - telemetryIdDirectory, - "telemetry.id")); - - Guid telemetryId; - if (!await ioManager.FileExists(telemetryIdFile, stoppingToken)) - { - telemetryId = Guid.NewGuid(); - await ioManager.CreateDirectory(telemetryIdDirectory, stoppingToken); - await ioManager.WriteAllBytes(telemetryIdFile, Encoding.UTF8.GetBytes(telemetryId.ToString()), stoppingToken); - logger.LogInformation("Generated telemetry ID {telemetryId} and wrote to {file}", telemetryId, telemetryIdFile); - } - else - { - var contents = await ioManager.ReadAllBytes(telemetryIdFile, stoppingToken); - - string guidStr; - try - { - guidStr = Encoding.UTF8.GetString(contents); - } - catch (Exception ex) - { - logger.LogError(ex, "Cannot decode telemetry ID from installation file ({path}). Telemetry will not be sent!", telemetryIdFile); - return; - } - - if (!Guid.TryParse(guidStr, out telemetryId)) - { - logger.LogError("Cannot parse telemetry ID from installation file ({path}). Telemetry will not be sent!", telemetryIdFile); - return; - } - } - - try - { - while (!stoppingToken.IsCancellationRequested) - { - var nextDelayHours = await TryReportVersion( - telemetryId, - attribute.SerializedKey, - telemetryConfiguration.VersionReportingRepositoryId.Value, - false, - stoppingToken) - ? 24 - : 1; - - logger.LogDebug("Next version report in {hours} hours", nextDelayHours); - await asyncDelayer.Delay(TimeSpan.FromHours(nextDelayHours), stoppingToken); - } - } - catch (OperationCanceledException ex) - { - logger.LogTrace(ex, "Inner cancellation"); - } - - shutdownCancellationToken.ThrowIfCancellationRequested(); - - logger.LogDebug("Sending shutdown telemetry"); - await TryReportVersion( - telemetryId, - attribute.SerializedKey, - telemetryConfiguration.VersionReportingRepositoryId.Value, - true, - shutdownCancellationToken); - } - catch (OperationCanceledException ex) - { - logger.LogTrace(ex, "Exiting due to outer cancellation..."); - } - catch (Exception ex) - { - logger.LogError(ex, "Crashed!"); - } - } - - /// - /// Make an attempt to report the current to the configured GitHub repository. - /// - /// The telemetry for the installation. - /// The serialized authentication for the . - /// The ID of the repository to send telemetry to. - /// If this is shutdown telemetry. - /// The for the operation. - /// A resulting in if telemetry was reported successfully, otherwise. - async ValueTask TryReportVersion(Guid telemetryId, string serializedPem, long repositoryId, bool shutdown, CancellationToken cancellationToken) - { - logger.LogDebug("Sending version telemetry..."); - - var serverFriendlyName = telemetryConfiguration.ServerFriendlyName; - if (String.IsNullOrWhiteSpace(serverFriendlyName)) - serverFriendlyName = null; - - logger.LogTrace( - "Repository ID: {repoId}, Server friendly name: {friendlyName}", - repositoryId, - serverFriendlyName == null - ? "(null)" - : $"\"{serverFriendlyName}\""); - try - { - var gitHubClient = await gitHubClientFactory.CreateClientForRepository( - serializedPem, - new RepositoryIdentifier(repositoryId), - cancellationToken); - - if (gitHubClient == null) - { - logger.LogWarning("Could not create GitHub client to connect to repository ID {repoId}!", repositoryId); - return false; - } - - // remove this lookup once https://github.com/octokit/octokit.net/pull/2960 is merged and released - var repository = await gitHubClient.Repository.Get(repositoryId); - - logger.LogTrace("Repository ID {id} resolved to {owner}/{name}", repositoryId, repository.Owner.Name, repository.Name); - - var inputs = new Dictionary - { - { "telemetry_id", telemetryId.ToString() }, - { "tgs_semver", assemblyInformationProvider.Version.Semver().ToString() }, - { "shutdown", shutdown ? "true" : "false" }, - }; - - if (serverFriendlyName != null) - inputs.Add("server_friendly_name", serverFriendlyName); - - await gitHubClient.Actions.Workflows.CreateDispatch( - repository.Owner.Login, - repository.Name, - ".github/workflows/tgs_deployments_telemetry.yml", - new CreateWorkflowDispatch("main") - { - Inputs = inputs, - }); - - logger.LogTrace("Telemetry sent successfully"); - - return true; - } - catch (Exception ex) - { - logger.LogWarning(ex, "Failed to report version!"); - return false; - } - } - } -} diff --git a/src/Tgstation.Server.Host/Properties/TelemetryAppSerializedKeyAttribute.cs b/src/Tgstation.Server.Host/Properties/TelemetryAppSerializedKeyAttribute.cs deleted file mode 100644 index 6d2ff1be5b..0000000000 --- a/src/Tgstation.Server.Host/Properties/TelemetryAppSerializedKeyAttribute.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Reflection; - -namespace Tgstation.Server.Host.Properties -{ - /// - /// Attribute for bundling the GitHub App serialized private key used for version telemetry. - /// - [AttributeUsage(AttributeTargets.Assembly)] - sealed class TelemetryAppSerializedKeyAttribute : Attribute - { - /// - /// Return the 's instance of the . - /// - public static TelemetryAppSerializedKeyAttribute? Instance => Assembly - .GetExecutingAssembly() - .GetCustomAttribute(); - - /// - /// The serialized GitHub App Client ID and private key. - /// - public string SerializedKey { get; } - - /// - /// Initializes a new instance of the class. - /// - /// The value of . - public TelemetryAppSerializedKeyAttribute(string serializedKey) - { - SerializedKey = serializedKey ?? throw new ArgumentNullException(nameof(serializedKey)); - } - } -} diff --git a/src/Tgstation.Server.Host/Setup/SetupWizard.cs b/src/Tgstation.Server.Host/Setup/SetupWizard.cs index ea1ba73d85..ef0019ef8b 100644 --- a/src/Tgstation.Server.Host/Setup/SetupWizard.cs +++ b/src/Tgstation.Server.Host/Setup/SetupWizard.cs @@ -958,31 +958,6 @@ namespace Tgstation.Server.Host.Setup }; } - /// - /// Prompts the user to create a . - /// - /// The for the operation. - /// A resulting in the new . - async ValueTask ConfigureTelemetry(CancellationToken cancellationToken) - { - bool enableReporting = await PromptYesNo("Enable version telemetry? This anonymously reports the TGS version in use.", true, cancellationToken); - - string? serverFriendlyName = null; - if (enableReporting) - { - await console.WriteAsync("(Optional) Publically associate your reported version with a friendly name:", false, cancellationToken); - serverFriendlyName = await console.ReadLineAsync(false, cancellationToken); - if (String.IsNullOrWhiteSpace(serverFriendlyName)) - serverFriendlyName = null; - } - - return new TelemetryConfiguration - { - DisableVersionReporting = !enableReporting, - ServerFriendlyName = serverFriendlyName, - }; - } - /// /// Saves a given set to . /// @@ -994,7 +969,6 @@ namespace Tgstation.Server.Host.Setup /// The to save. /// The to save. /// The to save. - /// The to save. /// The for the operation. /// A representing the running operation. async ValueTask SaveConfiguration( @@ -1006,7 +980,6 @@ namespace Tgstation.Server.Host.Setup ElasticsearchConfiguration? elasticsearchConfiguration, ControlPanelConfiguration controlPanelConfiguration, SwarmConfiguration? swarmConfiguration, - TelemetryConfiguration? telemetryConfiguration, CancellationToken cancellationToken) { newGeneralConfiguration.ApiPort = hostingPort ?? GeneralConfiguration.DefaultApiPort; @@ -1019,7 +992,6 @@ namespace Tgstation.Server.Host.Setup { ElasticsearchConfiguration.Section, elasticsearchConfiguration }, { ControlPanelConfiguration.Section, controlPanelConfiguration }, { SwarmConfiguration.Section, swarmConfiguration }, - { TelemetryConfiguration.Section, telemetryConfiguration }, }; var versionConverter = new VersionConverter(); @@ -1093,8 +1065,6 @@ namespace Tgstation.Server.Host.Setup var swarmConfiguration = await ConfigureSwarm(cancellationToken); - var telemetryConfiguration = await ConfigureTelemetry(cancellationToken); - await console.WriteAsync(null, true, cancellationToken); await console.WriteAsync(String.Format(CultureInfo.InvariantCulture, "Configuration complete! Saving to {0}", userConfigFileName), true, cancellationToken); @@ -1107,7 +1077,6 @@ namespace Tgstation.Server.Host.Setup elasticSearchConfiguration, controlPanelConfiguration, swarmConfiguration, - telemetryConfiguration, cancellationToken); } @@ -1225,7 +1194,6 @@ namespace Tgstation.Server.Host.Setup AllowAnyOrigin = true, }, null, - null, cancellationToken); } else diff --git a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj index e5b0af46a8..ce1831c4ae 100644 --- a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj +++ b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj @@ -66,26 +66,6 @@ - - - - - - - - <_Parameter1>@(SerializedTelemetryKey) - - - - - - - - - - - - diff --git a/src/Tgstation.Server.Host/appsettings.yml b/src/Tgstation.Server.Host/appsettings.yml index ff244ea7e4..e0d490e6e4 100644 --- a/src/Tgstation.Server.Host/appsettings.yml +++ b/src/Tgstation.Server.Host/appsettings.yml @@ -92,7 +92,3 @@ Swarm: # Should be left empty if using swarm mode is not desired # PublicAddress: # The public address of the swarm node # ControllerAddress: # Required on non-controller nodes. The internal address of the swarm controller's API'. Should be left empty on the controller itself # UpdateRequiredNodeCount: # The number of nodes expected to be in the swarm before initiating an update. This should count every server irrespective of whether or not they are the controller MINUS 1 -Telemetry: - DisableVersionReporting: false # Prevents you installation and the version you're using from being reported on the source repository's deployments list - ServerFriendlyName: null # Sets a friendly name for your server in reported telemetry. Must be unique. First come first serve - VersionReportingRepositoryId: 841149827 # GitHub repostiory ID where the tgs_version_telemetry workflow can be found diff --git a/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs b/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs index d9d3a6bdc4..7c3033cad4 100644 --- a/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs +++ b/tests/Tgstation.Server.Host.Tests/Setup/TestSetupWizard.cs @@ -195,8 +195,6 @@ namespace Tgstation.Server.Host.Setup.Tests "y", // swarm config "n", - // telemetry config - "n", //saved, now for second run //this time use defaults amap String.Empty, @@ -236,9 +234,6 @@ namespace Tgstation.Server.Host.Setup.Tests "privatekey", "n", "http://controller.com", - // telemetry config - "y", - "telemetry name", //third run, we already hit all the code coverage so just get through it String.Empty, nameof(DatabaseType.MariaDB), @@ -277,8 +272,6 @@ namespace Tgstation.Server.Host.Setup.Tests "https://controllerpublic.com", "privatekey", "y", - // telemetry config - "n", }; var inputPos = 0; diff --git a/tests/Tgstation.Server.Tests/Live/LiveTestingServer.cs b/tests/Tgstation.Server.Tests/Live/LiveTestingServer.cs index 8f81991b50..85ca591984 100644 --- a/tests/Tgstation.Server.Tests/Live/LiveTestingServer.cs +++ b/tests/Tgstation.Server.Tests/Live/LiveTestingServer.cs @@ -158,7 +158,6 @@ namespace Tgstation.Server.Tests.Live $"General:OpenDreamGitUrl={OpenDreamUrl}", $"Security:TokenExpiryMinutes=120", // timeouts are useless for us $"General:OpenDreamSuppressInstallOutput={TestingUtils.RunningInGitHubActions}", - "Telemetry:DisableVersionReporting=true", $"General:PrometheusPort={port}", $"General:ByondZipDownloadTemplate={TestingUtils.ByondZipDownloadTemplate}" };