Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
df437ed
Make SCMU run on .NET 7
DavidBoike Oct 17, 2023
17ae6d2
Enable single-file self-contained publish
DavidBoike Oct 17, 2023
32de2c1
Embedding zip files in Engine as resources
DavidBoike Oct 17, 2023
cd3635f
Don't remove translation assemblies since we're embedding resources
DavidBoike Oct 17, 2023
c1b1ec8
Unsure about these changes
DavidBoike Oct 17, 2023
00df918
Don't add zips to PowerShell module, they're in the Engine DLL as res…
DavidBoike Oct 18, 2023
5b3543b
tmp - wrap with target
DavidBoike Oct 18, 2023
cb1693f
Fix build warnings
bording Oct 18, 2023
d723b71
Ensure resources are embedded properly
bording Oct 19, 2023
744cc6f
Remove CustomActions project
bording Oct 19, 2023
f27fe61
Update workflows, use static graph
bording Oct 19, 2023
1ec3278
Remove Setup project
DavidBoike Oct 19, 2023
13679d5
Finish use of resources throughout installer primitives
DavidBoike Oct 19, 2023
3a6bf74
Clean up databases so that CI doesn’t run out of disk
DavidBoike Oct 19, 2023
4a3cc4e
.NET returns null here where .NET Framework throws
DavidBoike Oct 19, 2023
5d463c3
Make unzipping testable without having to use the Engine zip resources
DavidBoike Oct 19, 2023
23044dc
DotnetVersionValidator, but not integrated in installer yet
DavidBoike Oct 20, 2023
d9beb0f
Allow more structured text to look nice in ShowMessage() dialogs
DavidBoike Oct 23, 2023
04fd3d4
Stop commands via UX and PowerShell when prereqs not present
DavidBoike Oct 23, 2023
46ea1c7
Check prereqs on startup as well
DavidBoike Oct 23, 2023
200f8e5
Approval tests add EnableFullTextSearchOnBodies
DavidBoike Oct 19, 2023
01ecbfd
dotnet publish
DavidBoike Oct 23, 2023
8050da5
Sign and rename single-file output
DavidBoike Oct 24, 2023
c65c04d
Rename SCMU app
DavidBoike Oct 24, 2023
bf05729
Formatting
bording Oct 25, 2023
9bae795
Return Task from Raygun methods because callers are async
bording Oct 25, 2023
cefd547
Teach test to find packages when location has been overridden
bording Oct 25, 2023
7d53ac5
Dispose resource stream
bording Oct 25, 2023
0d1278e
Consolidate PlatformZipInfo implementation
bording Oct 25, 2023
a8efc2a
Make Constants class static
bording Oct 25, 2023
145b35a
Formatting and typos
bording Oct 25, 2023
51f1d3b
Update workflow SDK version
bording Oct 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 6.0.x
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.3
dotnet-version: 7.0.x
- name: Build
run: msbuild src -p:Configuration=Release -restore -m -verbosity:minimal
run: dotnet build src --configuration Release -graph
- name: Zip PowerShell module
run: |
New-Item assets\PowerShellModules -ItemType Directory
Expand Down
42 changes: 21 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 6.0.x
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.3
dotnet-version: 7.0.x
- name: Build
run: msbuild src -p:Configuration=Release -restore -m -verbosity:minimal
run: dotnet build src --configuration Release -graph
- name: Build ServiceControl Management
run: dotnet publish src\ServiceControl.Config\ServiceControl.Config.csproj --configuration Release --runtime win-x64 --no-build --output assets
- name: Sign NuGet packages
uses: Particular/sign-nuget-packages-action@v1.0.0
with:
Expand All @@ -44,6 +44,20 @@ jobs:
run: New-FileCatalog -Path deploy\PowerShellModules\Particular.ServiceControl.Management -CatalogFilePath deploy\PowerShellModules\Particular.ServiceControl.Management\Particular.ServiceControl.Management.cat -CatalogVersion 2.0
- name: Install AzureSignTool
run: dotnet tool install --global azuresigntool
- name: Sign ServiceControl Management EXE
run: |
AzureSignTool sign `
--file-digest sha256 `
--timestamp-rfc3161 http://timestamp.digicert.com `
--azure-key-vault-url https://particularcodesigning.vault.azure.net `
--azure-key-vault-client-id ${{ secrets.AZURE_KEY_VAULT_CLIENT_ID }} `
--azure-key-vault-tenant-id ${{ secrets.AZURE_KEY_VAULT_TENANT_ID }} `
--azure-key-vault-client-secret ${{ secrets.AZURE_KEY_VAULT_CLIENT_SECRET }} `
--azure-key-vault-certificate ${{ secrets.AZURE_KEY_VAULT_CERTIFICATE_NAME }} `
assets\Particular.ServiceControl.exe
- name: Rename ServiceControl Management EXE
run: Rename-Item -Path assets\Particular.ServiceControl.exe -NewName "Particular.ServiceControl-${{ env.MinVerVersion }}.exe"
shell: pwsh
- name: Sign PowerShell module
run: |
AzureSignTool sign `
Expand All @@ -59,20 +73,6 @@ jobs:
run: |
New-Item assets\PowerShellModules -ItemType Directory
Compress-Archive -Path deploy\PowerShellModules\Particular.ServiceControl.Management\* -DestinationPath assets\PowerShellModules\Particular.ServiceControl.Management.zip
- name: Setup Advanced Installer
run: |
$version = "20.2.1"
choco install advanced-installer --version=$version
& "C:\Program Files (x86)\Caphyon\Advanced Installer $version\bin\x86\AdvancedInstaller.com" /register ${{ secrets.ADVANCED_INSTALLER_LICENSE_KEY }}
- name: Prepare AIP file
run: |
$content = Get-Content -Raw -Path src/Setup/ServiceControl.aip
$content = $content -replace "replace-tenant-id", "${{ secrets.AZURE_KEY_VAULT_TENANT_ID }}" -replace "replace-app-id", "${{ secrets.AZURE_KEY_VAULT_CLIENT_ID }}" -replace "replace-cert-name", "${{ secrets.AZURE_KEY_VAULT_CERTIFICATE_NAME }}"
Set-Content src/Setup/ServiceControl.aip $content
- name: Build Windows installer
env:
AZURE_KEY_VAULT_CLIENT_SECRET: ${{ secrets.AZURE_KEY_VAULT_CLIENT_SECRET }}
run: dotnet build src/Setup --configuration Release
# - name: Build Docker images
# if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
# run: dotnet build src/ServiceControl.DockerImages --configuration Release
Expand Down Expand Up @@ -105,9 +105,9 @@ jobs:
$nugetsCount = (Get-ChildItem -Recurse -File nugets).Count
$zipCount = (Get-ChildItem -Recurse -File zip).Count

$expectedAssetsCount = 2
$expectedNugetsCount = 1
$expectedZipCount = 3
$expectedAssetsCount = 2 # SCMU & PowerShell module
$expectedNugetsCount = 1 # PlatformSample
$expectedZipCount = 3 # ServiceControl, Audit, & Monitoring

if ($assetsCount -ne $expectedAssetsCount)
{
Expand Down
5 changes: 2 additions & 3 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="2.3.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageVersion Include="Microsoft.Owin.Cors" Version="4.2.2" />
<PackageVersion Include="Mindscape.Raygun4Net" Version="6.0.3" />
<PackageVersion Include="Mindscape.Raygun4Net.NetCore" Version="7.1.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NLog.Extensions.Logging" Version="5.3.3" />
<PackageVersion Include="NServiceBus" Version="7.8.4" />
Expand Down Expand Up @@ -73,8 +73,7 @@
<PackageVersion Include="System.Text.Json" Version="7.0.3" />
<PackageVersion Include="System.Threading.Channels" Version="7.0.0" />
<PackageVersion Include="Validar.Fody" Version="1.9.0" />
<PackageVersion Include="Windows7APICodePack-Shell" Version="1.1.0" />
<PackageVersion Include="WixToolset.Dtf.CustomAction" Version="4.0.2" />
<PackageVersion Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.5" />
</ItemGroup>

<ItemGroup Label="Versions to pin transitive references">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using ServiceControl.Audit.Persistence.RavenDb;
using ServiceControl.Audit.Persistence.Tests;
Expand All @@ -10,15 +11,17 @@ class AcceptanceTestStorageConfiguration
{
public string PersistenceType { get; protected set; }

EmbeddedDatabase databaseInstance;
string databaseName;

public async Task<IDictionary<string, string>> CustomizeSettings()
{
var databaseName = Guid.NewGuid().ToString();

var instance = await SharedEmbeddedServer.GetInstance();
databaseName = Guid.NewGuid().ToString();
databaseInstance = await SharedEmbeddedServer.GetInstance();

return new Dictionary<string, string>
{
{ RavenDbPersistenceConfiguration.ConnectionStringKey,instance.ServerUrl },
{ RavenDbPersistenceConfiguration.ConnectionStringKey,databaseInstance.ServerUrl },
{ RavenDbPersistenceConfiguration.DatabaseNameKey,databaseName}
};
}
Expand All @@ -30,9 +33,9 @@ public Task Configure()
return Task.CompletedTask;
}

public Task Cleanup()
public async Task Cleanup()
{
return Task.CompletedTask;
await databaseInstance.DeleteDatabase(databaseName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using NServiceBus.Logging;
using Raven.Client.Documents;
using Raven.Client.Documents.Conventions;
using Raven.Client.ServerWide.Operations;
using Raven.Embedded;

public class EmbeddedDatabase : IDisposable
Expand Down Expand Up @@ -148,6 +149,14 @@ public async Task<IDocumentStore> Connect(CancellationToken cancellationToken)
return store;
}

public async Task DeleteDatabase(string dbName)
{
using (var store = await EmbeddedServer.Instance.GetDocumentStoreAsync(new DatabaseOptions(dbName) { SkipCreatingDatabase = true }))
{
await store.Maintenance.Server.SendAsync(new DeleteDatabasesOperation(dbName, true));
}
}

public void Dispose()
{
shutdownTokenSource.Cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<add key="ServiceControl.Audit/TransportType" value="ServiceControl.Transports.Msmq.MsmqTransportCustomization, ServiceControl.Transports.Msmq" />
<add key="ServiceControl.Audit/PersistenceType" value="ServiceControl.Audit.Persistence.RavenDb.RavenDbPersistenceConfiguration, ServiceControl.Audit.Persistence.RavenDb5" />
<add key="ServiceControl.Audit/AuditRetentionPeriod" value="00:00:00" />
<add key="ServiceControl.Audit/EnableFullTextSearchOnBodies"
value="false" />
<add key="ServiceControl.Audit/DBPath" value="value-not-asserted" />
<add key="ServiceControl.Audit/DatabaseMaintenancePort" value="33333" />
</appSettings>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<add key="ServiceControl.Audit/TransportType" value="ServiceControl.Transports.Msmq.MsmqTransportCustomization, ServiceControl.Transports.Msmq" />
<add key="ServiceControl.Audit/PersistenceType" value="ServiceControl.Audit.Persistence.InMemory.InMemoryPersistenceConfiguration, ServiceControl.Audit.Persistence.InMemory" />
<add key="ServiceControl.Audit/AuditRetentionPeriod" value="00:00:00" />
<add key="ServiceControl.Audit/EnableFullTextSearchOnBodies"
value="false" />
</appSettings>
<runtime>
<gcServer enabled="true" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
namespace ServiceControl.Audit.Persistence.Tests
{
using System;
using System.IO;
using System.Linq;
using System.Text.Json;
Expand All @@ -21,7 +20,7 @@ public void Should_write_expected_config_file()
persistenceManifest = JsonSerializer.Deserialize<PersistenceManifest>(manifestContent);
}

var newInstance = new ServiceControlAuditNewInstance(new Version(1, 0, 0), persistenceManifest);
var newInstance = new ServiceControlAuditNewInstance(persistenceManifest);

var installPath = Path.Combine(Path.GetTempPath(), TestContext.CurrentContext.Test.ID, "install");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<TargetFramework>net7.0-windows10.0.17763.0</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\ServiceControl.Config\ServiceControl.Config.csproj" />
<ProjectReference Include="..\TestHelper\TestHelper.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.DirectoryServices.AccountManagement" />
<Reference Include="System.Messaging" />
<Reference Include="System.ServiceProcess" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
Expand Down
21 changes: 1 addition & 20 deletions src/ServiceControl.Config/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
{
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using UI.MessageBox;

public partial class App
Expand All @@ -23,29 +21,12 @@ public App()
[STAThread]
public static void Main(string[] args)
{
AppDomain.CurrentDomain.AssemblyResolve += (s, e) => ResolveAssembly(e.Name);

Splash.Show();
if (args.Length == 0)
{
Splash.Show();
var app = new App();
app.Run();
}
}

static Assembly ResolveAssembly(string name)
{
var assemblyLocation = Assembly.GetEntryAssembly().Location;
var appDirectory = Path.GetDirectoryName(assemblyLocation);
var requestingName = new AssemblyName(name).Name;

var combine = Path.Combine(appDirectory, requestingName + ".dll");
if (!File.Exists(combine))
{
return null;
}

return Assembly.LoadFrom(combine);
}
}
}
10 changes: 10 additions & 0 deletions src/ServiceControl.Config/AppBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
using Caliburn.Micro;
using FluentValidation;
using ReactiveUI;
using ServiceControl.Config.Framework;
using ServiceControlInstaller.Engine.Validation;
using UI.Shell;

public class AppBootstrapper : BootstrapperBase
Expand Down Expand Up @@ -87,6 +89,14 @@ protected override async void OnStartup(object sender, StartupEventArgs e)
ValidatorOptions.Global.DefaultRuleLevelCascadeMode = CascadeMode.Stop;

await DisplayRootViewForAsync<ShellViewModel>();

if (DotnetVersionValidator.FrameworkRequirementsAreMissing(true, out var message))
{
message += $"{Environment.NewLine}{Environment.NewLine}Until the prerequisites are installed, no ServiceControl instances can be installed.";

var windowManager = GetInstance(typeof(IServiceControlWindowManager), null) as IServiceControlWindowManager;
await windowManager.ShowMessage("Missing prerequisites", message, acceptText: "I understand", hideCancel: true);
}
}

IContainer container;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using ServiceControlInstaller.Engine.Configuration.ServiceControl;
using ServiceControlInstaller.Engine.Instances;
using ServiceControlInstaller.Engine.ReportCard;
using ServiceControlInstaller.Engine.Validation;
using UI.InstanceDetails;

class UpgradeAuditInstanceCommand : AwaitableAbstractCommand<InstanceDetailsViewModel>
Expand Down Expand Up @@ -95,6 +96,12 @@ public override async Task ExecuteAsync(InstanceDetailsViewModel model)
}
}

if (DotnetVersionValidator.FrameworkRequirementsAreMissing(needsRavenDB: true, out var missingMessage))
{
await windowManager.ShowMessage("Missing prerequisites", missingMessage, acceptText: "Cancel", hideCancel: true);
return;
}

if (instance.TransportPackage.IsOldRabbitMQTransport() &&
!await windowManager.ShowYesNoDialog("UPGRADE WARNING", $"ServiceControl version {serviceControlInstaller.ZipInfo.Version} requires RabbitMQ broker version 3.10.0 or higher. Also, the stream_queue and quorum_queue feature flags must be enabled on the broker. Please confirm your broker meets the minimum requirements before upgrading.",
"Do you want to proceed?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using ServiceControl.Engine.Extensions;
using ServiceControlInstaller.Engine.Instances;
using ServiceControlInstaller.Engine.ReportCard;
using ServiceControlInstaller.Engine.Validation;
using UI.InstanceDetails;

class UpgradeMonitoringInstanceCommand : AwaitableAbstractCommand<InstanceDetailsViewModel>
Expand Down Expand Up @@ -46,6 +47,12 @@ public override async Task ExecuteAsync(InstanceDetailsViewModel model)

instance.Service.Refresh();

if (DotnetVersionValidator.FrameworkRequirementsAreMissing(needsRavenDB: false, out var missingMessage))
{
await windowManager.ShowMessage("Missing prerequisites", missingMessage, acceptText: "Cancel", hideCancel: true);
return;
}

if (instance.TransportPackage.IsOldRabbitMQTransport() &&
!await windowManager.ShowYesNoDialog("UPGRADE WARNING", $"ServiceControl version {installer.ZipInfo.Version} requires RabbitMQ broker version 3.10.0 or higher. Also, the stream_queue and quorum_queue feature flags must be enabled on the broker. Please confirm your broker meets the minimum requirements before upgrading.",
"Do you want to proceed?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ await windowManager.ShowMessage("UPGRADE INCOMPATIBLE",
}
}

if (DotnetVersionValidator.FrameworkRequirementsAreMissing(needsRavenDB: true, out var missingMessage))
{
await windowManager.ShowMessage("Missing prerequisites", missingMessage, acceptText: "Cancel", hideCancel: true);
return;
}

if (instance.TransportPackage.IsOldRabbitMQTransport() &&
!await windowManager.ShowYesNoDialog("UPGRADE WARNING", $"ServiceControl version {serviceControlInstaller.ZipInfo.Version} requires RabbitMQ broker version 3.10.0 or higher. Also, the stream_queue and quorum_queue feature flags must be enabled on the broker. Please confirm your broker meets the minimum requirements before upgrading.",
"Do you want to proceed?",
Expand Down
6 changes: 6 additions & 0 deletions src/ServiceControl.Config/Extensions/FilePathExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ public static class FilePathExtensions
{
static bool TryGetPathRoot(string path, out string root)
{
if (string.IsNullOrWhiteSpace(path))
{
root = string.Empty;
return false;
}

try
{
root = Path.GetPathRoot(path);
Expand Down
Loading