diff --git a/build/Build.Pack.cs b/build/Build.Pack.cs index eafa4cd84..29dcb7226 100644 --- a/build/Build.Pack.cs +++ b/build/Build.Pack.cs @@ -41,7 +41,10 @@ partial class Build .DependsOn(BuildOsx) .Executes(() => { - RuntimeIds.Where(x => x.StartsWith("osx-")).ForEach(PackTarballs); + foreach (var runtimeId in RuntimeIds.Where(x => x.StartsWith("osx-"))) + { + PackTarballs(NetCore, runtimeId); + } }); [PublicAPI] @@ -55,7 +58,10 @@ partial class Build .DependsOn(BuildLinux) .Executes(() => { - RuntimeIds.Where(x => x.StartsWith("linux-")).ForEach(PackTarballs); + foreach (var runtimeId in RuntimeIds.Where(x => x.StartsWith("linux-"))) + { + PackTarballs(NetCore, runtimeId); + } }); [PublicAPI] @@ -106,7 +112,7 @@ void CreateLinuxPackages(string runtimeId) "SIGN_PASSPHRASE") .SetVolume( $"{debBuildDir / "scripts"}:/scripts", - $"{BuildDirectory / "zip" / "net6.0" / runtimeId / "tentacle"}:/input", + $"{BuildDirectory / "zip" / NetCore / runtimeId / "tentacle"}:/input", $"{debBuildDir / "output"}:/output" ) .SetImage(dockerToolsContainerImage) @@ -264,7 +270,7 @@ void PackWindowsInstallers(MSBuildTargetPlatform platform, AbsolutePath wixNuget (BuildDirectory / "Octopus.Manager.Tentacle" / framework / "win").GlobFiles("*") .ForEach(x => FileSystemTasks.CopyFileToDirectory(x, installerDirectory, FileExistsPolicy.Overwrite)); } - else if (framework == NetCoreWindows) + else if (framework is NetCoreWindows) { (BuildDirectory / "Tentacle" / framework / $"win-{platform}").GlobFiles("*") .ForEach(x => FileSystemTasks.CopyFileToDirectory(x, installerDirectory, FileExistsPolicy.Overwrite)); @@ -333,19 +339,12 @@ void BuildMsiInstallerForPlatform(MSBuildTargetPlatform platform, AbsolutePath w var builtMsi = RootDirectory / "installer" / "Octopus.Tentacle.Installer" / "bin" / platform / "Octopus.Tentacle.msi"; Signing.Sign(builtMsi); - string platformString; - if (framework == NetFramework) - { - platformString = platform == MSBuildTargetPlatform.x64 ? "-x64" : ""; - } - else if (framework == NetCoreWindows) + var platformString = framework switch { - platformString = $"-{NetCoreWindows}-win" + (platform == MSBuildTargetPlatform.x64 ? "-x64" : "-x86"); - } - else - { - platformString = $"-{NetCore}-win" + (platform == MSBuildTargetPlatform.x64 ? "-x64" : "-x86"); - } + NetFramework => platform == MSBuildTargetPlatform.x64 ? "-x64" : "", + NetCoreWindows => $"-{framework}-win" + (platform == MSBuildTargetPlatform.x64 ? "-x64" : "-x86"), + _ => $"-{framework}-win" + (platform == MSBuildTargetPlatform.x64 ? "-x64" : "-x86") + }; FileSystemTasks.MoveFile( builtMsi, @@ -467,13 +466,14 @@ string ConstructRedHatPackageFilename(string packageName, string architecture) FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}.msi", workingDirectory / "Octopus.Tentacle.msi"); FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-x64.msi", workingDirectory / "Octopus.Tentacle-x64.msi"); - FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net6.0-win-x86.msi", workingDirectory / "Octopus.Tentacle-net6.0-win-x86.msi"); - FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net6.0-win-x64.msi", workingDirectory / "Octopus.Tentacle-net6.0-win-x64.msi"); - FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net6.0-windows-win-x86.msi", workingDirectory / "Octopus.Tentacle-net6.0-windows-win-x86.msi"); - FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net6.0-windows-win-x64.msi", workingDirectory / "Octopus.Tentacle-net6.0-windows-win-x64.msi"); - FileSystemTasks.CopyFile(BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x86" / "Octopus.Tentacle.Upgrader.exe", workingDirectory / "Octopus.Tentacle.Upgrader-net6.0-win-x86.exe"); - FileSystemTasks.CopyFile(BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x64" / "Octopus.Tentacle.Upgrader.exe", workingDirectory / "Octopus.Tentacle.Upgrader-net6.0-win-x64.exe"); + FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-win-x86.msi", workingDirectory / "Octopus.Tentacle-net8.0-win-x86.msi"); + FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-win-x64.msi", workingDirectory / "Octopus.Tentacle-net8.0-win-x64.msi"); + FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-windows-win-x86.msi", workingDirectory / "Octopus.Tentacle-net8.0-windows-win-x86.msi"); + FileSystemTasks.CopyFile(ArtifactsDirectory / "msi" / $"Octopus.Tentacle.{FullSemVer}-net8.0-windows-win-x64.msi", workingDirectory / "Octopus.Tentacle-net8.0-windows-win-x64.msi"); + + FileSystemTasks.CopyFile(BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x86" / "Octopus.Tentacle.Upgrader.exe", workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x86.exe"); + FileSystemTasks.CopyFile(BuildDirectory / "Octopus.Tentacle.Upgrader" / NetCore / "win-x64" / "Octopus.Tentacle.Upgrader.exe", workingDirectory / "Octopus.Tentacle.Upgrader-net8.0-win-x64.exe"); var octopusTentacleUpgraderDirectory = BuildDirectory / "Octopus.Tentacle.Upgrader" / NetFramework / "win"; octopusTentacleUpgraderDirectory.GlobFiles("*").ForEach(x => FileSystemTasks.CopyFileToDirectory(x, workingDirectory)); @@ -504,13 +504,16 @@ string ConstructRedHatPackageFilename(string packageName, string architecture) Assert.True((workingDirectory / "Octopus.Tentacle.msi").FileExists(), "Missing Octopus.Tentacle.msi"); Assert.True((workingDirectory / "Octopus.Tentacle-x64.msi").FileExists(), "Missing Octopus.Tentacle-x64.msi"); - Assert.True((workingDirectory / "Octopus.Tentacle-net6.0-win-x86.msi").FileExists(), "Missing Octopus.Tentacle-net6.0-win-x86.msi"); - Assert.True((workingDirectory / "Octopus.Tentacle-net6.0-win-x64.msi").FileExists(), "Missing Octopus.Tentacle-net6.0-win-x64.msi"); - Assert.True((workingDirectory / "Octopus.Tentacle-net6.0-windows-win-x86.msi").FileExists(), "Missing Octopus.Tentacle-net6.0-windows-win-x86.msi"); - Assert.True((workingDirectory / "Octopus.Tentacle-net6.0-windows-win-x64.msi").FileExists(), "Missing Octopus.Tentacle-net6.0-windows-win-x64.msi"); Assert.True((workingDirectory / "Octopus.Tentacle.Upgrader.exe").FileExists(), "Missing Octopus.Tentacle.Upgrader.exe"); - Assert.True((workingDirectory / "Octopus.Tentacle.Upgrader-net6.0-win-x86.exe").FileExists(), "Missing Octopus.Tentacle.Upgrader-net6.0-win-x86.exe"); - Assert.True((workingDirectory / "Octopus.Tentacle.Upgrader-net6.0-win-x64.exe").FileExists(), "Missing Octopus.Tentacle.Upgrader-net6.0-win-x64.exe"); + foreach (var framework in new[] {NetCore}) + { + Assert.True((workingDirectory / $"Octopus.Tentacle-{framework}-win-x86.msi").FileExists(), $"Missing Octopus.Tentacle-{framework}-win-x86.msi"); + Assert.True((workingDirectory / $"Octopus.Tentacle-{framework}-win-x64.msi").FileExists(), $"Missing Octopus.Tentacle-{framework}-win-x64.msi"); + Assert.True((workingDirectory / $"Octopus.Tentacle-{framework}-windows-win-x86.msi").FileExists(), $"Missing Octopus.Tentacle-{framework}-windows-win-x86.msi"); + Assert.True((workingDirectory / $"Octopus.Tentacle-{framework}-windows-win-x64.msi").FileExists(), $"Missing Octopus.Tentacle-{framework}-windows-win-x64.msi"); + Assert.True((workingDirectory / $"Octopus.Tentacle.Upgrader-{framework}-win-x86.exe").FileExists(), $"Missing Octopus.Tentacle.Upgrader-{framework}-win-x86.exe"); + Assert.True((workingDirectory / $"Octopus.Tentacle.Upgrader-{framework}-win-x64.exe").FileExists(), $"Missing Octopus.Tentacle.Upgrader-{framework}-win-x64.exe"); + } Assert.True((workingDirectory / debAmd64PackageFilename).FileExists(), $"Missing {debAmd64PackageFilename}"); Assert.True((workingDirectory / debArm64PackageFilename).FileExists(), $"Missing {debArm64PackageFilename}"); Assert.True((workingDirectory / debArm32PackageFilename).FileExists(), $"Missing {debArm32PackageFilename}"); @@ -540,15 +543,15 @@ string ConstructRedHatPackageFilename(string packageName, string architecture) .DependsOn(PackContracts) .DependsOn(PackClient); - void PackTarballs(string runtimeId) + void PackTarballs(string framework, string runtimeId) { (ArtifactsDirectory / "zip").CreateDirectory(); - var workingDir = BuildDirectory / "zip" / NetCore / runtimeId; + var workingDir = BuildDirectory / "zip" / framework / runtimeId; (workingDir / "tentacle").CreateDirectory(); var linuxPackagesContent = RootDirectory / "linux-packages" / "content"; - var tentacleDirectory = BuildDirectory / "Tentacle" / NetCore / runtimeId; + var tentacleDirectory = BuildDirectory / "Tentacle" / framework / runtimeId; linuxPackagesContent.GlobFiles("*") .ForEach(x => FileSystemTasks.CopyFileToDirectory(x, workingDir / "tentacle")); @@ -559,7 +562,7 @@ void PackTarballs(string runtimeId) workingDir, "tentacle", ArtifactsDirectory / "zip", - $"tentacle-{FullSemVer}-{NetCore}-{runtimeId}.tar.gz"); + $"tentacle-{FullSemVer}-{framework}-{runtimeId}.tar.gz"); } void BuildAndPushOrLoadKubernetesTentacleContainerImage(bool push, bool load, string? host = null, bool includeDebugger = false) @@ -627,4 +630,4 @@ string GetMicrok8sIpAddress() { "linux-arm64", ("arm64", "arm64") }, { "linux-arm", ("armhf", "armv7") } }; -} \ No newline at end of file +} diff --git a/build/Build.Tests.cs b/build/Build.Tests.cs index 898e90eb7..08919d18e 100644 --- a/build/Build.Tests.cs +++ b/build/Build.Tests.cs @@ -99,11 +99,7 @@ void RunLinuxPackageTestsFor(TestConfigurationOnLinuxDistribution testConfigurat new TestConfigurationOnLinuxDistribution(NetCore, "linux-x64", "ubuntu:focal", "deb"), // 20.04 new TestConfigurationOnLinuxDistribution(NetCore, "linux-x64", "ubuntu:bionic", "deb"), // 18.04 new TestConfigurationOnLinuxDistribution(NetCore, "linux-x64", "ubuntu:xenial", "deb"), // 16.04 - new TestConfigurationOnLinuxDistribution(NetCore, "linux-x64", "ubuntu:trusty", "deb"), // 14.04 - new TestConfigurationOnLinuxDistribution(NetCore, "linux-x64", "centos:7", "rpm"), - // new TestConfigurationOnLinuxDistribution(NetCore, "linux-x64", "fedora:latest", "rpm"), // Fedora 36 doesn't support netcore, related https://github.com/dotnet/core/issues/7467 (there is no issue for Fedora 36) - new TestConfigurationOnLinuxDistribution(NetCore, "linux-x64", "fedora:35", "rpm"), - new TestConfigurationOnLinuxDistribution(NetCore, "linux-x64", "roboxes/rhel7", "rpm"), + new TestConfigurationOnLinuxDistribution(NetCore, "linux-x64", "fedora:39", "rpm"), new TestConfigurationOnLinuxDistribution(NetCore, "linux-x64", "roboxes/rhel8", "rpm"), }; diff --git a/build/Build.cs b/build/Build.cs index d90cf6188..df147fdfa 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -87,8 +87,8 @@ public Build() readonly AbsolutePath TestDirectory = RootDirectory / "_test"; const string NetFramework = "net48"; - const string NetCore = "net6.0"; - const string NetCoreWindows = "net6.0-windows"; + const string NetCore = "net8.0"; + const string NetCoreWindows = "net8.0-windows"; IEnumerable RuntimeIds => SpecificRuntimeId != null ? new[] { SpecificRuntimeId } @@ -206,7 +206,10 @@ public Build() using var productWxsFile = UpdateMsiProductVersion(); RuntimeIds.Where(x => x.StartsWith("linux-")) - .ForEach(runtimeId => RunBuildFor(NetCore, runtimeId)); + .ForEach(runtimeId => + { + RunBuildFor(NetCore, runtimeId); + }); versionInfoFile.Dispose(); productWxsFile.Dispose(); @@ -222,7 +225,10 @@ public Build() using var productWxsFile = UpdateMsiProductVersion(); RuntimeIds.Where(x => x.StartsWith("osx-")) - .ForEach(runtimeId => RunBuildFor(NetCore, runtimeId)); + .ForEach(runtimeId => + { + RunBuildFor(NetCore, runtimeId); + }); versionInfoFile.Dispose(); productWxsFile.Dispose(); @@ -288,6 +294,7 @@ ModifiableFileWithRestoreContentsOnDispose ModifyTemplatedVersionAndProductFiles ModifiableFileWithRestoreContentsOnDispose UpdateMsiProductVersion() { var productWxsFilePath = RootDirectory / "installer" / "Octopus.Tentacle.Installer" / "Product.wxs"; + var productWxsFile = new ModifiableFileWithRestoreContentsOnDispose(productWxsFilePath); var xmlDoc = new XmlDocument(); xmlDoc.Load(productWxsFilePath); @@ -305,7 +312,7 @@ ModifiableFileWithRestoreContentsOnDispose UpdateMsiProductVersion() xmlDoc.Save(productWxsFilePath); - return new ModifiableFileWithRestoreContentsOnDispose(productWxsFilePath); + return productWxsFile; } void RunBuildFor(string framework, string runtimeId) @@ -342,4 +349,4 @@ void TarGZipCompress(AbsolutePath inputDirectory, string fileSpec, AbsolutePath } public static int Main() => Execute(x => x.Default); -} \ No newline at end of file +} diff --git a/build/ModifiableFileWithRestoreContentsOnDispose.cs b/build/ModifiableFileWithRestoreContentsOnDispose.cs index 78b55493d..764a5905a 100644 --- a/build/ModifiableFileWithRestoreContentsOnDispose.cs +++ b/build/ModifiableFileWithRestoreContentsOnDispose.cs @@ -11,6 +11,7 @@ public class ModifiableFileWithRestoreContentsOnDispose : IDisposable public readonly AbsolutePath FilePath; readonly string OriginalFileText; string FileText; + bool disposed = false; public ModifiableFileWithRestoreContentsOnDispose(AbsolutePath filePath) { @@ -20,6 +21,16 @@ public ModifiableFileWithRestoreContentsOnDispose(AbsolutePath filePath) } public void Dispose() + { + if (disposed) + { + return; + } + disposed = true; + RestoreContents(); + } + + public void RestoreContents() { Log.Information($"Restoring file {FilePath}"); File.WriteAllText(FilePath, OriginalFileText); diff --git a/build/test-scripts/integration/common/run-integration-tests-on-vm-agents.sh b/build/test-scripts/integration/common/run-integration-tests-on-vm-agents.sh index eb89b957d..4d7eeeb48 100755 --- a/build/test-scripts/integration/common/run-integration-tests-on-vm-agents.sh +++ b/build/test-scripts/integration/common/run-integration-tests-on-vm-agents.sh @@ -13,7 +13,7 @@ $SCRIPT_DIR/setup-vm-agent.sh source $SCRIPT_DIR/set-dotnet-envvars.sh -itdll=`pwd`/build/outputs/integrationtests/net6.0/linux-x64/Octopus.Tentacle.Tests.Integration.dll +itdll=`pwd`/build/outputs/integrationtests/${TARGET_FRAMEWORK:-net8.0}/linux-x64/Octopus.Tentacle.Tests.Integration.dll # We don't care about the exit code of dotnet test and instead depend on tests passing. diff --git a/build/test-scripts/integration/common/setup-vm-agent.sh b/build/test-scripts/integration/common/setup-vm-agent.sh index 9f4e09232..730eaa782 100755 --- a/build/test-scripts/integration/common/setup-vm-agent.sh +++ b/build/test-scripts/integration/common/setup-vm-agent.sh @@ -5,5 +5,4 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source $SCRIPT_DIR/dotnet-install.sh -# We install the 8.0 sdk and also the 6.0 runtime as the tests require it -install_dotnet --runtime 6.0 --sdk 8.0 +install_dotnet 8.0 diff --git a/build/test-scripts/integration/run-kubernetes-tests-on-vm-agents.sh b/build/test-scripts/integration/run-kubernetes-tests-on-vm-agents.sh index b841dec11..6455aa73c 100644 --- a/build/test-scripts/integration/run-kubernetes-tests-on-vm-agents.sh +++ b/build/test-scripts/integration/run-kubernetes-tests-on-vm-agents.sh @@ -13,7 +13,7 @@ $SCRIPT_DIR/common/setup-vm-agent.sh source $SCRIPT_DIR/common/set-dotnet-envvars.sh -itdll=`pwd`/build/outputs/integrationtests/net6.0/linux-x64/Octopus.Tentacle.Kubernetes.Tests.Integration.dll +itdll=`pwd`/build/outputs/integrationtests/${TARGET_FRAMEWORK:-net8.0}/linux-x64/Octopus.Tentacle.Kubernetes.Tests.Integration.dll # We don't care about the exit code of dotnet test and instead depend on tests passing. @@ -22,4 +22,4 @@ if [ "$TENTACLE_IT_WITH_SUDO" = "1" ]; then sudo -E env PATH=$PATH dotnet vstest $itdll "/testcasefilter:TestCategory!=TentacleBackwardsCompatibility" /logger:logger://teamcity /TestAdapterPath:/opt/TeamCity/BuildAgent/plugins/dotnet/tools/vstest15 /logger:console;verbosity=detailed else dotnet vstest $itdll "/testcasefilter:TestCategory!=RequiresSudoOnLinux&TestCategory!=TentacleBackwardsCompatibility" /logger:logger://teamcity /TestAdapterPath:/opt/TeamCity/BuildAgent/plugins/dotnet/tools/vstest15 /logger:console;verbosity=detailed -fi \ No newline at end of file +fi diff --git a/source/Octopus.Manager.Tentacle.Tests/AssemblyInfo.cs b/source/Octopus.Manager.Tentacle.Tests/AssemblyInfo.cs new file mode 100644 index 000000000..72751bbfa --- /dev/null +++ b/source/Octopus.Manager.Tentacle.Tests/AssemblyInfo.cs @@ -0,0 +1,4 @@ +#if NET8_0_OR_GREATER +using System.Runtime.Versioning; +[assembly: SupportedOSPlatform("windows")] +#endif \ No newline at end of file diff --git a/source/Octopus.Manager.Tentacle.Tests/Octopus.Manager.Tentacle.Tests.csproj b/source/Octopus.Manager.Tentacle.Tests/Octopus.Manager.Tentacle.Tests.csproj index 208d641d7..f22965063 100644 --- a/source/Octopus.Manager.Tentacle.Tests/Octopus.Manager.Tentacle.Tests.csproj +++ b/source/Octopus.Manager.Tentacle.Tests/Octopus.Manager.Tentacle.Tests.csproj @@ -11,7 +11,8 @@ true 9 annotations - net48;net6.0-windows + net48;net6.0-windows;net8.0-windows + false @@ -26,6 +27,11 @@ win-x86;win-x64 + + + win-x86;win-x64 + + diff --git a/source/Octopus.Manager.Tentacle/Octopus.Manager.Tentacle.csproj b/source/Octopus.Manager.Tentacle/Octopus.Manager.Tentacle.csproj index e73fcf682..65b061f85 100644 --- a/source/Octopus.Manager.Tentacle/Octopus.Manager.Tentacle.csproj +++ b/source/Octopus.Manager.Tentacle/Octopus.Manager.Tentacle.csproj @@ -12,13 +12,7 @@ true true true - net48;net6.0-windows - - false + net48;net6.0-windows;net8.0-windows Properties\Icon.ico @@ -32,6 +26,17 @@ + + win-x86;win-x64; + + false + + + win-x86;win-x64; @@ -139,6 +144,9 @@ + + + @@ -170,6 +178,5 @@ - diff --git a/source/Octopus.Manager.Tentacle/Properties/AssemblyInfo.cs b/source/Octopus.Manager.Tentacle/Properties/AssemblyInfo.cs index de4b2f344..e3ccafbc0 100644 --- a/source/Octopus.Manager.Tentacle/Properties/AssemblyInfo.cs +++ b/source/Octopus.Manager.Tentacle/Properties/AssemblyInfo.cs @@ -1,4 +1,5 @@ using System.Reflection; +using System.Runtime.Versioning; using System.Windows; [assembly: AssemblyTitle("Octopus.Manager.Tentacle")] @@ -10,3 +11,7 @@ //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] + +#if NET8_0_OR_GREATER +[assembly: SupportedOSPlatform("windows")] +#endif \ No newline at end of file diff --git a/source/Octopus.Tentacle.Client.Tests/Octopus.Tentacle.Client.Tests.csproj b/source/Octopus.Tentacle.Client.Tests/Octopus.Tentacle.Client.Tests.csproj index a816b767d..85971b0f1 100644 --- a/source/Octopus.Tentacle.Client.Tests/Octopus.Tentacle.Client.Tests.csproj +++ b/source/Octopus.Tentacle.Client.Tests/Octopus.Tentacle.Client.Tests.csproj @@ -10,9 +10,16 @@ true 9 annotations - net6.0 + net6.0;net8.0 + + win-x86;win-x64;linux-x64;osx-x64;osx-arm64;linux-arm64;linux-arm;linux-musl-x64 - + + + + false + win-x86;win-x64;linux-x64;osx-x64;osx-arm64;linux-arm64;linux-arm;linux-musl-x64 + diff --git a/source/Octopus.Tentacle.Client/Octopus.Tentacle.Client.csproj b/source/Octopus.Tentacle.Client/Octopus.Tentacle.Client.csproj index 1ecff2471..756390701 100644 --- a/source/Octopus.Tentacle.Client/Octopus.Tentacle.Client.csproj +++ b/source/Octopus.Tentacle.Client/Octopus.Tentacle.Client.csproj @@ -5,7 +5,7 @@ true false bin\ - net6.0 + net6.0;net8.0 true True true diff --git a/source/Octopus.Tentacle.CommonTestUtils/Octopus.Tentacle.CommonTestUtils.csproj b/source/Octopus.Tentacle.CommonTestUtils/Octopus.Tentacle.CommonTestUtils.csproj index 1c5c39bd4..791bc0b41 100644 --- a/source/Octopus.Tentacle.CommonTestUtils/Octopus.Tentacle.CommonTestUtils.csproj +++ b/source/Octopus.Tentacle.CommonTestUtils/Octopus.Tentacle.CommonTestUtils.csproj @@ -5,10 +5,10 @@ enable - net48;net6.0 + net48;net6.0;net8.0 - net6.0 + net6.0;net8.0 diff --git a/source/Octopus.Tentacle.Contracts/Octopus.Tentacle.Contracts.csproj b/source/Octopus.Tentacle.Contracts/Octopus.Tentacle.Contracts.csproj index e2030152a..cab9e9180 100644 --- a/source/Octopus.Tentacle.Contracts/Octopus.Tentacle.Contracts.csproj +++ b/source/Octopus.Tentacle.Contracts/Octopus.Tentacle.Contracts.csproj @@ -5,7 +5,7 @@ true false bin\ - net48;net6.0;net6.0-windows + net48;net6.0;net6.0-windows;net8.0;net8.0-windows true True true diff --git a/source/Octopus.Tentacle.Kubernetes.Tests.Integration/Octopus.Tentacle.Kubernetes.Tests.Integration.csproj b/source/Octopus.Tentacle.Kubernetes.Tests.Integration/Octopus.Tentacle.Kubernetes.Tests.Integration.csproj index 0f9d444b1..834a08661 100644 --- a/source/Octopus.Tentacle.Kubernetes.Tests.Integration/Octopus.Tentacle.Kubernetes.Tests.Integration.csproj +++ b/source/Octopus.Tentacle.Kubernetes.Tests.Integration/Octopus.Tentacle.Kubernetes.Tests.Integration.csproj @@ -7,10 +7,15 @@ bin ../../_build/$(AssemblyName)/$(TargetFramework)/$(RuntimeIdentifier) false - net6.0 + net6.0;net8.0 win-x86;win-x64;linux-x64;osx-x64;osx-arm64;linux-arm64;linux-arm;linux-musl-x64 + + + false + + @@ -23,10 +28,16 @@ all - + + + + + + + diff --git a/source/Octopus.Tentacle.Tests.Integration.Common/Octopus.Tentacle.Tests.Integration.Common.csproj b/source/Octopus.Tentacle.Tests.Integration.Common/Octopus.Tentacle.Tests.Integration.Common.csproj index 0dbd05b1c..c00106903 100644 --- a/source/Octopus.Tentacle.Tests.Integration.Common/Octopus.Tentacle.Tests.Integration.Common.csproj +++ b/source/Octopus.Tentacle.Tests.Integration.Common/Octopus.Tentacle.Tests.Integration.Common.csproj @@ -7,10 +7,15 @@ bin ../../_build/$(AssemblyName)/$(TargetFramework)/$(RuntimeIdentifier) false - net6.0 + net6.0;net8.0 win-x86;win-x64;linux-x64;osx-x64;osx-arm64;linux-arm64;linux-arm;linux-musl-x64 + + + false + + diff --git a/source/Octopus.Tentacle.Tests.Integration/Octopus.Tentacle.Tests.Integration.csproj b/source/Octopus.Tentacle.Tests.Integration/Octopus.Tentacle.Tests.Integration.csproj index 30b2a9893..7ac0dc344 100644 --- a/source/Octopus.Tentacle.Tests.Integration/Octopus.Tentacle.Tests.Integration.csproj +++ b/source/Octopus.Tentacle.Tests.Integration/Octopus.Tentacle.Tests.Integration.csproj @@ -11,13 +11,17 @@ true 9 annotations - net6.0 + net6.0;net8.0 win-x86;win-x64;linux-x64;osx-x64;osx-arm64;linux-arm64;linux-arm;linux-musl-x64 $(DefineConstants);DOES_NOT_SUPPORT_CANCELLATION_ON_SOCKETS + + + false + @@ -31,12 +35,20 @@ - - - - + + + + + + + + + + + + diff --git a/source/Octopus.Tentacle.Tests.Integration/Support/RuntimeDetection.cs b/source/Octopus.Tentacle.Tests.Integration/Support/RuntimeDetection.cs index ad0b8ffe0..6ccc54e2a 100644 --- a/source/Octopus.Tentacle.Tests.Integration/Support/RuntimeDetection.cs +++ b/source/Octopus.Tentacle.Tests.Integration/Support/RuntimeDetection.cs @@ -5,22 +5,40 @@ namespace Octopus.Tentacle.Tests.Integration.Support { public static class RuntimeDetection { - public const string DotNet6 = "net6.0"; public const string Framework48 = "net48"; - + public const string DotNet6 = "net6.0"; + public const string DotNet8 = "net8.0"; + public static string GetCurrentRuntime() { - // This wont work for future versions of dotnet - if (RuntimeInformation.FrameworkDescription.StartsWith(".NET 6.0")) + // Expected framework description values taken from here: + // https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.runtimeinformation.frameworkdescription?view=net-8.0#remarks + var frameworkDescription = RuntimeInformation.FrameworkDescription; + + if (frameworkDescription.StartsWith(".NET Core") || frameworkDescription.StartsWith(".NET Native")) + { + throw new NotSupportedException(".NET Core and .NET Native runtimes are not supported"); + } + + if (frameworkDescription.StartsWith(".NET Framework 4.8")) + { + return Framework48; + } + + if (frameworkDescription.StartsWith(".NET 6")) { return DotNet6; } - // This is the last net framework - return Framework48; + if (frameworkDescription.StartsWith(".NET 8")) + { + return DotNet8; + } + + throw new NotSupportedException($"'{frameworkDescription}' is not supported"); } - public static bool IsDotNet60 => GetCurrentRuntime() == DotNet6; + public static bool IsDotNet => GetCurrentRuntime() == DotNet8; public static bool IsFramework48 => GetCurrentRuntime() == Framework48; } } diff --git a/source/Octopus.Tentacle.Tests.Integration/Support/SetupFixtures/TurnOnTraceLoggingForLogFileForLatestTentacle.cs b/source/Octopus.Tentacle.Tests.Integration/Support/SetupFixtures/TurnOnTraceLoggingForLogFileForLatestTentacle.cs index d768145d0..8e07c0923 100644 --- a/source/Octopus.Tentacle.Tests.Integration/Support/SetupFixtures/TurnOnTraceLoggingForLogFileForLatestTentacle.cs +++ b/source/Octopus.Tentacle.Tests.Integration/Support/SetupFixtures/TurnOnTraceLoggingForLogFileForLatestTentacle.cs @@ -12,7 +12,7 @@ public class TurnOnTraceLoggingForLogFileForLatestTentacle : ISetupFixture public void OneTimeSetUp(ILogger logger) { - TryTurnOnTraceLoggingForTentacleRuntime(TentacleRuntime.DotNet6, logger); + TryTurnOnTraceLoggingForTentacleRuntime(TentacleRuntime.DotNet8, logger); TryTurnOnTraceLoggingForTentacleRuntime(TentacleRuntime.Framework48, logger); } diff --git a/source/Octopus.Tentacle.Tests.Integration/Support/SetupFixtures/WarmTentacleCache.cs b/source/Octopus.Tentacle.Tests.Integration/Support/SetupFixtures/WarmTentacleCache.cs index 70c5dea1e..c9ea79610 100644 --- a/source/Octopus.Tentacle.Tests.Integration/Support/SetupFixtures/WarmTentacleCache.cs +++ b/source/Octopus.Tentacle.Tests.Integration/Support/SetupFixtures/WarmTentacleCache.cs @@ -37,9 +37,9 @@ public void OneTimeSetUp(ILogger logger) private async Task GetTentacleVersion(ILogger logger, Version tentacleVersion) { - if (PlatformDetection.IsRunningOnWindows && RuntimeDetection.IsDotNet60) + if (PlatformDetection.IsRunningOnWindows && RuntimeDetection.IsDotNet) { - await GetTentacleVersionWithRuntime(logger, tentacleVersion, TentacleRuntime.DotNet6); + await GetTentacleVersionWithRuntime(logger, tentacleVersion, TentacleRuntime.DotNet8); await GetTentacleVersionWithRuntime(logger, tentacleVersion, TentacleRuntime.Framework48); } else diff --git a/source/Octopus.Tentacle.Tests.Integration/Support/TentacleConfigurationsAttribute.cs b/source/Octopus.Tentacle.Tests.Integration/Support/TentacleConfigurationsAttribute.cs index a2f0e9284..ebac3613a 100644 --- a/source/Octopus.Tentacle.Tests.Integration/Support/TentacleConfigurationsAttribute.cs +++ b/source/Octopus.Tentacle.Tests.Integration/Support/TentacleConfigurationsAttribute.cs @@ -138,7 +138,7 @@ public static IEnumerator GetEnumerator( #if !NETFRAMEWORK if (!testDefaultTentacleRuntimeOnly && PlatformDetection.IsRunningOnWindows) { - runtimes = new List { TentacleRuntime.DotNet6, TentacleRuntime.Framework48 }; + runtimes = new List { TentacleRuntime.DotNet8, TentacleRuntime.Framework48 }; } #endif @@ -225,4 +225,4 @@ static object[] CombineTestCaseWithAdditionalParameters(TentacleConfigurationTes return parameters; } } -} \ No newline at end of file +} diff --git a/source/Octopus.Tentacle.Tests.Integration/Support/TentacleExeFinder.cs b/source/Octopus.Tentacle.Tests.Integration/Support/TentacleExeFinder.cs index e0abc338a..21bdb5b13 100644 --- a/source/Octopus.Tentacle.Tests.Integration/Support/TentacleExeFinder.cs +++ b/source/Octopus.Tentacle.Tests.Integration/Support/TentacleExeFinder.cs @@ -24,13 +24,13 @@ public static string FindTentacleExe(TentacleRuntime version) // /opt/TeamCity/BuildAgent/work/639265b01610d682/build/outputs/tentaclereal/tentacle/Tentacle const string net48ArtifactDir = "tentaclereal-net48"; - const string net60ArtifactDir = "tentaclereal-net6.0"; + const string net80ArtifactDir = "tentaclereal-net8.0"; string artifactDir = version switch { TentacleRuntime.Framework48 => net48ArtifactDir, - TentacleRuntime.DotNet6 => net60ArtifactDir, + TentacleRuntime.DotNet8 => net80ArtifactDir, _ => throw new ArgumentOutOfRangeException(nameof(version), version, null) }; @@ -42,7 +42,7 @@ public static string FindTentacleExe(TentacleRuntime version) version switch { TentacleRuntime.Framework48 => "net48", - TentacleRuntime.DotNet6 => "net6.0", + TentacleRuntime.DotNet8 => "net8.0", _ => throw new ArgumentOutOfRangeException(nameof(version), version, null) }; diff --git a/source/Octopus.Tentacle.Tests.Integration/Support/TentacleFetchers/NugetTentacleFetcher.cs b/source/Octopus.Tentacle.Tests.Integration/Support/TentacleFetchers/NugetTentacleFetcher.cs index 22e98e934..31a90a71e 100644 --- a/source/Octopus.Tentacle.Tests.Integration/Support/TentacleFetchers/NugetTentacleFetcher.cs +++ b/source/Octopus.Tentacle.Tests.Integration/Support/TentacleFetchers/NugetTentacleFetcher.cs @@ -28,10 +28,10 @@ public NugetTentacleFetcher(ILogger logger) public async Task GetTentacleVersion(string downloadPath, Version version, TentacleRuntime runtime, CancellationToken cancellationToken) { - return await DownloadAndExtractFromUrl(downloadPath, runtime, DownloadUrlForVersion(version.ToString())); + return await DownloadAndExtractFromUrl(downloadPath, version, runtime, DownloadUrlForVersion(version.ToString())); } - async Task DownloadAndExtractFromUrl(string directoryPath, TentacleRuntime runtime, string url) + async Task DownloadAndExtractFromUrl(string directoryPath, Version version, TentacleRuntime runtime, string url) { await Task.CompletedTask; var downloadFilePath = Path.Combine(directoryPath, Guid.NewGuid().ToString("N")); @@ -44,7 +44,7 @@ async Task DownloadAndExtractFromUrl(string directoryPath, TentacleRunti ZipFile.ExtractToDirectory(downloadFilePath, extractionDirectory); // This is the path to the runtime-specific artifact - var tentacleArtifacts = TentacleArtifactNames(runtime) + var tentacleArtifacts = TentacleArtifactNames(version, runtime) .Select(name => Path.Combine(extractionDirectory, name)) .ToArray(); var tentacleArtifact = tentacleArtifacts.FirstOrDefault(File.Exists); @@ -71,18 +71,23 @@ async Task DownloadAndExtractFromUrl(string directoryPath, TentacleRunti return Path.Combine(tentacleFolder, "tentacle", "Tentacle"); } - public string[] TentacleArtifactNames(TentacleRuntime runtime) + public string[] TentacleArtifactNames(Version version, TentacleRuntime runtime) { if (PlatformDetection.IsRunningOnWindows) { + // Tentacle 8.2 is/was built on .NET8, previous versions were built on .NET6 + string runtimeForVersion = version.Major >= 8 && version.Minor >= 2 + ? RuntimeDetection.DotNet8 + : RuntimeDetection.DotNet6; + var net48ArtifactNames = new[] {"tentacle-net48-win.zip"}; - var net60ArtifactNames = Architectures() - .Select(a => $"tentacle-{RuntimeDetection.GetCurrentRuntime()}-win-{a}.zip") + var dotnetArtifactNames = Architectures() + .Select(a => $"tentacle-{runtimeForVersion}-win-{a}.zip") .ToArray(); var names = runtime switch { - TentacleRuntime.DotNet6 => net60ArtifactNames, + TentacleRuntime.DotNet8 => dotnetArtifactNames, TentacleRuntime.Framework48 => net48ArtifactNames, _ => throw new ArgumentOutOfRangeException(nameof(runtime), runtime, null) }; diff --git a/source/Octopus.Tentacle.Tests.Integration/Support/TentacleFetchers/TentacleBinaryCache.cs b/source/Octopus.Tentacle.Tests.Integration/Support/TentacleFetchers/TentacleBinaryCache.cs index 72e71721d..0818edcae 100644 --- a/source/Octopus.Tentacle.Tests.Integration/Support/TentacleFetchers/TentacleBinaryCache.cs +++ b/source/Octopus.Tentacle.Tests.Integration/Support/TentacleFetchers/TentacleBinaryCache.cs @@ -70,7 +70,7 @@ private static string GetRuntimeStringValue(TentacleRuntime runtime) // If non-default, use what was passed in return runtime switch { - TentacleRuntime.DotNet6 => TentacleRuntime.DotNet6.GetDescription(), + TentacleRuntime.DotNet8 => TentacleRuntime.DotNet8.GetDescription(), TentacleRuntime.Framework48 => TentacleRuntime.Framework48.GetDescription(), _ => throw new ArgumentOutOfRangeException(nameof(runtime), runtime, null) }; diff --git a/source/Octopus.Tentacle.Tests.Integration/Support/TentacleRuntime.cs b/source/Octopus.Tentacle.Tests.Integration/Support/TentacleRuntime.cs index 053d57e49..558244381 100644 --- a/source/Octopus.Tentacle.Tests.Integration/Support/TentacleRuntime.cs +++ b/source/Octopus.Tentacle.Tests.Integration/Support/TentacleRuntime.cs @@ -9,16 +9,16 @@ public static class DefaultTentacleRuntime #if NETFRAMEWORK TentacleRuntime.Framework48; #else - TentacleRuntime.DotNet6; + TentacleRuntime.DotNet8; #endif } public enum TentacleRuntime { - [Description(RuntimeDetection.DotNet6)] - DotNet6, - [Description(RuntimeDetection.Framework48)] - Framework48 + Framework48, + + [Description(RuntimeDetection.DotNet8)] + DotNet8, } } diff --git a/source/Octopus.Tentacle.Tests.Integration/TentacleCommandLineTests.cs b/source/Octopus.Tentacle.Tests.Integration/TentacleCommandLineTests.cs index 9cde42d2c..fba7ceedb 100644 --- a/source/Octopus.Tentacle.Tests.Integration/TentacleCommandLineTests.cs +++ b/source/Octopus.Tentacle.Tests.Integration/TentacleCommandLineTests.cs @@ -455,7 +455,7 @@ public async Task ShouldLogStartupDiagnosticsToInstanceLogFileOnly(TentacleConfi } return newLog; }); - + logFileText.Should().ContainEquivalentOf($"OperatingSystem: {RuntimeInformation.OSDescription}", "the OSVersion should be in our diagnostics"); logFileText.Should().ContainEquivalentOf("OperatingSystem:", "the OSVersion should be in our diagnostics"); logFileText.Should().ContainEquivalentOf($"OsBitVersion: {(Environment.Is64BitOperatingSystem ? "x64" : "x86")}", "the OsBitVersion should be in our diagnostics"); @@ -748,4 +748,4 @@ public class NotLoggedYetException : Exception { } } -} \ No newline at end of file +} diff --git a/source/Octopus.Tentacle.Tests/Octopus.Tentacle.Tests.csproj b/source/Octopus.Tentacle.Tests/Octopus.Tentacle.Tests.csproj index 2e18ebc46..9117bec8e 100644 --- a/source/Octopus.Tentacle.Tests/Octopus.Tentacle.Tests.csproj +++ b/source/Octopus.Tentacle.Tests/Octopus.Tentacle.Tests.csproj @@ -26,10 +26,10 @@ - net48;net6.0 + net48;net6.0;net8.0 - net6.0 + net6.0;net8.0 @@ -38,6 +38,11 @@ $(DefineConstants);DEFAULT_PROXY_IS_NOT_AVAILABLE + + $(DefineConstants);DEFAULT_PROXY_IS_NOT_AVAILABLE + + false + @@ -46,9 +51,15 @@ - + + + + + + +