Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ else {
# This means we would need to manually update our global.json file every time there is a new
# .NET SDK available, and then all developers would need to immediately install this on their machines.
#
# In our builds, we want the same "automatic roll-forward" behaviour that we get when we use the dotnet/sdk:8.0 docker
# In our builds, we want the same "automatic roll-forward" behaviour that we get when we use the dotnet/sdk:10.0 docker
# images -- where we always get the latest patch version of the SDK without manual intervention.
#
# We achieve this with a small tweak to the Nuke bootstrapper to tell it to install the latest version from
# the 8.0 channel, regardless of what's in the global.json.
# the 10.0 channel, regardless of what's in the global.json.

Remove-Variable DotNetVersion
$DotNetChannel = "8.0"
$DotNetChannel = "10.0"
# ----- End Octopus Deploy Modification -----

# Install by channel or version
Expand Down
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ else
# This means we would need to manually update our global.json file every time there is a new
# .NET SDK available, and then all developers would need to immediately install this on their machines.
#
# In our builds, we want the same "automatic roll-forward" behaviour that we get when we use the dotnet/sdk:8.0 docker
# In our builds, we want the same "automatic roll-forward" behaviour that we get when we use the dotnet/sdk:10.0 docker
# images -- where we always get the latest patch version of the SDK without manual intervention.
#
# We achieve this with a small tweak to the Nuke bootstrapper to tell it to install the latest version from
# the 8.0 channel, regardless of what's in the global.json.
# the 10.0 channel, regardless of what's in the global.json.

unset DOTNET_VERSION
DOTNET_CHANNEL="8.0"
DOTNET_CHANNEL="10.0"
# ----- End Octopus Deploy Modification -----

# Install by channel or version
Expand Down
4 changes: 2 additions & 2 deletions build/Build.PackageCalamariProjects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public partial class Build
.Select(rid =>
{
//we are making the bold assumption all projects only have a single target framework
var framework = project.GetTargetFrameworks()?.Single() ?? Frameworks.Net80;
var framework = project.GetTargetFrameworks()?.Single() ?? Frameworks.Net100;
return new CalamariPackageMetadata(project, framework, rid);
}))
.ToList();
Expand Down Expand Up @@ -109,7 +109,7 @@ public partial class Build
DotNetPublish(s => s
.SetConfiguration(Configuration)
.SetProject(helperProject)
.SetFramework(Frameworks.Net80)
.SetFramework(Frameworks.Net100)
.SetRuntime(rid)
.SetVersion(NugetVersion.Value)
.SetInformationalVersion(OctoVersionInfo.Value?.InformationalVersion)
Expand Down
2 changes: 1 addition & 1 deletion build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public Build()
// Mimic the behaviour of this attribute, but lazily so we don't pay the OctoVersion cost when it isn't needed
OctoVersionInfo = new Lazy<OctoVersionInfo?>(() =>
{
var attribute = new OctoVersionAttribute { BranchMember = nameof(BranchName), Framework = "net8.0"};
var attribute = new OctoVersionAttribute { BranchMember = nameof(BranchName), Framework = Frameworks.Net100};

// the Attribute does all the work such as calling TeamCity.Instance?.SetBuildNumber for us
var version = attribute.GetValue(null!, this);
Expand Down
4 changes: 2 additions & 2 deletions build/Frameworks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Calamari.Build
{
public static class Frameworks
{
public const string Net80 = "net8.0";
public const string Net80Windows = "net8.0-windows";
public const string Net100 = "net10.0";
public const string Net100Windows = "net10.0-windows";
}
}
5 changes: 5 additions & 0 deletions build/Signing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ static bool HasAuthenticodeSignature(string filePath)
{
try
{
// SYSLIB0057 points at X509CertificateLoader, but that only loads certificate *files*.
// There is no replacement for reading the Authenticode signature embedded in a signed
// PE file, so this API is still the only way to do this check.
#pragma warning disable SYSLIB0057
X509Certificate.CreateFromSignedFile(filePath);
#pragma warning restore SYSLIB0057
return true;
}
catch
Expand Down
7 changes: 6 additions & 1 deletion build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<RuntimeIdentifiers>win-x64;linux-x64;linux-arm;linux-arm64</RuntimeIdentifiers>
<RootNamespace>Calamari.Build</RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
Expand All @@ -25,6 +25,11 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.10" />
<!-- Pinned to remediate vulnerable versions pulled in transitively via Octopus.Nuke.Common.
The .NET 10 SDK audits transitive packages during restore, so these surface as NU1902/NU1903. -->
<PackageReference Include="System.Security.Cryptography.Xml" Version="10.0.10" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.10" />
<PackageReference Include="RestSharp" Version="112.1.0" />
<PackageReference Include="NuGet.CommandLine" Version="7.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.419",
"version": "10.0.302",
"rollForward": "latestFeature",
"allowPrerelease": false
}
Expand Down
2 changes: 1 addition & 1 deletion source/Calamari.Aws/Calamari.Aws.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<ApplicationManifest>Calamari.Aws.exe.manifest</ApplicationManifest>
<ApplicationIcon />
<StartupObject />
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion source/Calamari.Azure/Calamari.Azure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<OutputType>Library</OutputType>
<Authors>Octopus Deploy</Authors>
<Copyright>Octopus Deploy Pty Ltd</Copyright>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>Calamari.AzureAppService.Tests</AssemblyName>
<IsPackable>false</IsPackable>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64;linux-arm;linux-arm64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

Expand All @@ -18,7 +18,6 @@
<PackageReference Include="NUnit3TestAdapter" Version="5.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="Polly" Version="8.3.1" />
<PackageReference Include="System.Text.Json" Version="9.0.16" />
<PackageReference Include="TeamCity.VSTest.TestAdapter" Version="1.0.41" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64;linux-arm;linux-arm64</RuntimeIdentifiers>
<NoWarn>NU5104</NoWarn>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
Expand All @@ -17,7 +17,6 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="Polly" Version="8.3.1" />
<PackageReference Include="SharpCompress" Version="0.49.1" />
<PackageReference Include="System.Text.Json" Version="9.0.16" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Calamari.AzureScripting\Calamari.AzureScripting.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<AssemblyName>Calamari.AzureResourceGroup.Tests</AssemblyName>
<IsPackable>false</IsPackable>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64;linux-arm;linux-arm64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<IsPackable>false</IsPackable>
<ValidateExecutableReferencesMatchSelfContained>false</ValidateExecutableReferencesMatchSelfContained>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64;linux-arm;linux-arm64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64;linux-arm;linux-arm64</RuntimeIdentifiers>
<IsPackable>false</IsPackable>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64;linux-arm;linux-arm64</RuntimeIdentifiers>
<IsPackable>true</IsPackable>
<ValidateExecutableReferencesMatchSelfContained>false</ValidateExecutableReferencesMatchSelfContained>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion source/Calamari.AzureScripting/CalamariCertificateStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static bool HasPrivateKey(X509Certificate2 certificate2)
{
try
{
var cert = new X509Certificate2(file, (string)null!, flags);
var cert = X509CertificateLoader.LoadPkcs12FromFile(file, null, flags);

// ReSharper disable once InvertIf
if (!HasPrivateKey(cert) && requirePrivateKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<RootNamespace>Calamari.AzureServiceFabric.Tests</RootNamespace>
<AssemblyName>Calamari.AzureServiceFabric.Tests</AssemblyName>
<IsPackable>false</IsPackable>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net10.0-windows</TargetFramework>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net10.0-windows</TargetFramework>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static X509Certificate2 TryLoadCertificate(string file, X509KeyStorageFlags flag
{
try
{
var cert = new X509Certificate2(file, password, flags);
var cert = X509CertificateLoader.LoadPkcs12FromFile(file, password, flags);

// ReSharper disable once InvertIf
if (!HasPrivateKey(cert) && requirePrivateKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<RootNamespace>Calamari.AzureWebApp.Tests</RootNamespace>
<AssemblyName>Calamari.AzureWebApp.Tests</AssemblyName>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<IsPackable>false</IsPackable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
9 changes: 9 additions & 0 deletions source/Calamari.AzureWebApp/AzureWebAppBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ public async Task Execute(RunningDeployment deployment)
RemoteCertificateValidationCallback originalServerCertificateValidationCallback = null;
try
{
// TODO: this callback appears to be dead code and should be removed or reinstated properly.
// NetCoreWebDeploymentExecutor runs Web Deploy in a separate net462 child process (the
// NetCoreShim), so a ServicePointManager callback registered here cannot affect the TLS
// validation the child performs. That has been true since Web Deploy moved into the shim,
// not something .NET 10 changed - but .NET 10's obsoletion message says these settings no
// longer affect SslStream or HttpClient, which makes it worth resolving deliberately rather
// than deleting as a drive-by in a framework migration.
#pragma warning disable SYSLIB0014
originalServerCertificateValidationCallback = ServicePointManager.ServerCertificateValidationCallback;
ServicePointManager.ServerCertificateValidationCallback = WrapperForServerCertificateValidationCallback;

Expand All @@ -70,6 +78,7 @@ public async Task Execute(RunningDeployment deployment)
finally
{
ServicePointManager.ServerCertificateValidationCallback = originalServerCertificateValidationCallback;
#pragma warning restore SYSLIB0014
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/Calamari.AzureWebApp/Calamari.AzureWebApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<LangVersion>8.0</LangVersion>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<RootNamespace>Calamari.CloudAccounts</RootNamespace>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<PackageId>Octopus.Calamari.CloudAccounts</PackageId>
<Title>Calamari.CloudAccounts</Title>
<Authors>Octopus Deploy</Authors>
Expand Down
4 changes: 2 additions & 2 deletions source/Calamari.Common/Calamari.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<PlatformTarget>anycpu</PlatformTarget>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
Expand All @@ -19,7 +19,7 @@
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="9.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
<PackageReference Include="System.Threading.AccessControl" Version="4.3.0" />
<PackageReference Include="Autofac" Version="4.8.0" />
<PackageReference Include="Autofac" Version="9.3.1" />
<PackageReference Include="Octopus.Globfish" Version="1.0.8" />
<PackageReference Include="JavaPropertiesParser" Version="0.2.1" />
<PackageReference Include="Microsoft.Web.Xdt" Version="3.1.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace Calamari.Common.Features.Scripting.DotnetScript
{
public class DotnetScriptExecutor : ScriptExecutor
{
const string DotnetRollForwardVariableName = "DOTNET_ROLL_FORWARD";

readonly ICommandLineRunner commandLineRunner;

public DotnetScriptExecutor(ICommandLineRunner commandLineRunner, ILog log): base(log)
Expand All @@ -37,13 +39,37 @@ protected override IEnumerable<ScriptExecution> PrepareExecution(Script script,
bool.TryParse(variables.Get("Octopus.Action.Script.CSharp.BypassIsolation", "false"), out var bypassDotnetScriptIsolation);

var cli = CreateCommandLineInvocation(executable, arguments, !string.IsNullOrWhiteSpace(localDotnetScriptPath));
cli.EnvironmentVars = environmentVars;
cli.EnvironmentVars = WithDotnetRollForward(environmentVars);
cli.WorkingDirectory = workingDirectory;
cli.Isolate = !bypassDotnetScriptIsolation;

yield return new ScriptExecution(cli, otherTemporaryFiles.Concat(new[] { bootstrapFile, configurationFile }));
}

/// <summary>
/// dotnet-script is a framework-dependent application - the bundled copy targets
/// Microsoft.NETCore.App 8.0.0. By default a framework-dependent app will not roll forward
/// across a major version, so on a machine that only has a newer runtime installed it fails
/// to launch with "You must install or update .NET to run this application".
///
/// Calamari itself is published self-contained and carries no such requirement; this affects
/// only the separate dotnet-script process. Setting DOTNET_ROLL_FORWARD=Major lets it run on
/// whatever newer runtime is present, so C# script steps don't additionally require the exact
/// runtime dotnet-script was built against.
/// </summary>
static Dictionary<string, string> WithDotnetRollForward(Dictionary<string, string>? environmentVars)
{
var vars = environmentVars == null
? new Dictionary<string, string>()
: new Dictionary<string, string>(environmentVars);

// Don't override an explicit value - the surrounding environment may have set one deliberately.
if (!vars.ContainsKey(DotnetRollForwardVariableName))
vars[DotnetRollForwardVariableName] = "Major";

return vars;
}

private string GetExecutable(string? localDotnetScriptPath, string bundledExecutable)
{
return string.IsNullOrWhiteSpace(localDotnetScriptPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<RootNamespace>Octopus.Calamari.ConsolidatedPackage.Api</RootNamespace>
<AssemblyName>Octopus.Calamari.ConsolidatedPackage.Api</AssemblyName>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Authors>Octopus Deploy</Authors>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<RootNamespace>Octopus.Calamari.ConsolidatedPackage</RootNamespace>
<AssemblyName>Octopus.Calamari.ConsolidatedPackage</AssemblyName>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Octopus Deploy</Authors>
Expand Down
2 changes: 1 addition & 1 deletion source/Calamari.Contracts/Calamari.Contracts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<RootNamespace>Octopus.Calamari.Contracts</RootNamespace>
<AssemblyName>Octopus.Calamari.Contracts</AssemblyName>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Authors>Octopus Deploy</Authors>
Expand Down
Loading