diff --git a/credits/credits.md b/credits/credits.md index de4981be08..cc08a7e94d 100644 --- a/credits/credits.md +++ b/credits/credits.md @@ -33,7 +33,6 @@ Calamari is made possible thanks to the following great third-party products. | Microsoft.DotNet.Analyzers.Compatibility | Microsoft | [https://github.com/dotnet/platform-compat](https://github.com/dotnet/platform-compat) | [MIT](https://github.com/dotnet/platform-compat/blob/master/LICENSE) | | Microsoft.Identity.Client | Microsoft | [https://go.microsoft.com/fwlink/?linkid=844761](https://go.microsoft.com/fwlink/?linkid=844761) | [MIT](https://www.nuget.org/packages/Microsoft.Identity.Client/4.66.2/license) | | Microsoft.Net.Http | Microsoft | [http://go.microsoft.com/fwlink/?LinkID=280055](http://go.microsoft.com/fwlink/?LinkID=280055) | [Microsoft .Net Library License](http://go.microsoft.com/fwlink/?LinkId=329770) | -| Microsoft.NETFramework.ReferenceAssemblies.net462 | Microsoft | [https://github.com/Microsoft/dotnet/tree/master/releases/reference-assemblies](https://github.com/Microsoft/dotnet/tree/master/releases/reference-assemblies) | [MIT](https://github.com/Microsoft/dotnet/blob/master/LICENSE) | | Microsoft.Rest.ClientRuntime | Microsoft | [https://github.com/Azure/azure-sdk-for-net](https://github.com/Azure/azure-sdk-for-net) | [MIT](https://raw.githubusercontent.com/Microsoft/dotnet/master/LICENSE) | | Microsoft.ServiceFabric | Microsoft | [http://aka.ms/servicefabric](http://aka.ms/servicefabric) | [Microsoft .Net Library License](http://www.microsoft.com/web/webpi/eula/net_library_eula_ENU.htm) | | Microsoft.Web.Administration | Microsoft | [http://microsoft.com](http://microsoft.com) | [Undefined]() | diff --git a/source/Calamari.Azure/Kubernetes/Discovery/AzureKubernetesDiscoverer.cs b/source/Calamari.Azure/Kubernetes/Discovery/AzureKubernetesDiscoverer.cs index eadbe65618..fd4e30fabd 100644 --- a/source/Calamari.Azure/Kubernetes/Discovery/AzureKubernetesDiscoverer.cs +++ b/source/Calamari.Azure/Kubernetes/Discovery/AzureKubernetesDiscoverer.cs @@ -44,7 +44,7 @@ public override IEnumerable DiscoverClusters(string contextJs var discoveredClusters = new List(); // There appears to be an issue where the azure client returns stale data - // We need to upgrade this to use the newer SDK, but we need to upgrade to .NET 4.6.2 to support that. + // TODO: Upgrade from Microsoft.Azure.Management.Fluent to Azure.ResourceManager SDK var resourceGroups = azureClient.ResourceGroups.List(); //we don't care about resource groups that are being deleted foreach (var resourceGroup in resourceGroups.Where(rg => rg.ProvisioningState != "Deleting")) diff --git a/source/Calamari.AzureAppService/Calamari.AzureAppService.csproj b/source/Calamari.AzureAppService/Calamari.AzureAppService.csproj index aa124dd30b..c238b1dfc3 100644 --- a/source/Calamari.AzureAppService/Calamari.AzureAppService.csproj +++ b/source/Calamari.AzureAppService/Calamari.AzureAppService.csproj @@ -29,8 +29,7 @@ - - + diff --git a/source/Calamari.AzureResourceGroup.Tests/AzureResourceGroupActionHandlerFixture.cs b/source/Calamari.AzureResourceGroup.Tests/AzureResourceGroupActionHandlerFixture.cs index 4400d992cc..0c53289002 100644 --- a/source/Calamari.AzureResourceGroup.Tests/AzureResourceGroupActionHandlerFixture.cs +++ b/source/Calamari.AzureResourceGroup.Tests/AzureResourceGroupActionHandlerFixture.cs @@ -18,8 +18,6 @@ using Newtonsoft.Json.Linq; using NUnit.Framework; -// ReSharper disable MethodHasAsyncOverload - File.ReadAllTextAsync does not exist for .net framework targets - namespace Calamari.AzureResourceGroup.Tests { [TestFixture] @@ -138,8 +136,8 @@ await CommandTestBuilder.CreateAsync() public async Task Deploy_with_template_inline() { var packagePath = TestEnvironment.GetTestPath("Packages", "AzureResourceGroup"); - var templateFileContent = File.ReadAllText(Path.Combine(packagePath, "azure_website_template.json")); - var paramsFileContent = File.ReadAllText(Path.Combine(packagePath, "azure_website_params.json")); + var templateFileContent = await File.ReadAllTextAsync(Path.Combine(packagePath, "azure_website_template.json")); + var paramsFileContent = await File.ReadAllTextAsync(Path.Combine(packagePath, "azure_website_params.json")); var parameters = JObject.Parse(paramsFileContent)["parameters"].ToString(); await CommandTestBuilder.CreateAsync() @@ -148,7 +146,7 @@ await CommandTestBuilder.CreateAsync() AddDefaults(context); context.Variables.Add(SpecialVariables.Action.Azure.ResourceGroupDeploymentMode, "Complete"); context.Variables.Add("Octopus.Action.Azure.TemplateSource", "Inline"); - context.Variables.Add(SpecialVariables.Action.Azure.ResourceGroupTemplate, File.ReadAllText(Path.Combine(packagePath, "azure_website_template.json"))); + context.Variables.Add(SpecialVariables.Action.Azure.ResourceGroupTemplate, templateFileContent); context.Variables.Add(SpecialVariables.Action.Azure.ResourceGroupTemplateParameters, parameters); context.WithFilesToCopy(packagePath); @@ -164,8 +162,8 @@ await CommandTestBuilder.CreateAsync() public async Task Deploy_Ensure_Tools_Are_Configured() { var packagePath = TestEnvironment.GetTestPath("Packages", "AzureResourceGroup"); - var templateFileContent = File.ReadAllText(Path.Combine(packagePath, "azure_website_template.json")); - var paramsFileContent = File.ReadAllText(Path.Combine(packagePath, "azure_website_params.json")); + var templateFileContent = await File.ReadAllTextAsync(Path.Combine(packagePath, "azure_website_template.json")); + var paramsFileContent = await File.ReadAllTextAsync(Path.Combine(packagePath, "azure_website_params.json")); var parameters = JObject.Parse(paramsFileContent)["parameters"].ToString(); const string psScript = @" $ErrorActionPreference = 'Continue' @@ -179,7 +177,7 @@ await CommandTestBuilder.CreateAsync() AddDefaults(context); context.Variables.Add(SpecialVariables.Action.Azure.ResourceGroupDeploymentMode, "Complete"); context.Variables.Add("Octopus.Action.Azure.TemplateSource", "Inline"); - context.Variables.Add(SpecialVariables.Action.Azure.ResourceGroupTemplate, File.ReadAllText(Path.Combine(packagePath, "azure_website_template.json"))); + context.Variables.Add(SpecialVariables.Action.Azure.ResourceGroupTemplate, templateFileContent); context.Variables.Add(SpecialVariables.Action.Azure.ResourceGroupTemplateParameters, parameters); context.Variables.Add(KnownVariables.Package.EnabledFeatures, KnownVariables.Features.CustomScripts); context.Variables.Add(KnownVariables.Action.CustomScripts.GetCustomScriptStage(DeploymentStages.Deploy, ScriptSyntax.PowerShell), psScript); diff --git a/source/Calamari.AzureResourceGroup/Calamari.AzureResourceGroup.csproj b/source/Calamari.AzureResourceGroup/Calamari.AzureResourceGroup.csproj index a53fd67917..680f20e2c6 100644 --- a/source/Calamari.AzureResourceGroup/Calamari.AzureResourceGroup.csproj +++ b/source/Calamari.AzureResourceGroup/Calamari.AzureResourceGroup.csproj @@ -24,8 +24,7 @@ - - + diff --git a/source/Calamari.AzureScripting/Calamari.AzureScripting.csproj b/source/Calamari.AzureScripting/Calamari.AzureScripting.csproj index 201deeeb6c..16670f4c79 100644 --- a/source/Calamari.AzureScripting/Calamari.AzureScripting.csproj +++ b/source/Calamari.AzureScripting/Calamari.AzureScripting.csproj @@ -28,8 +28,7 @@ - - + diff --git a/source/Calamari.AzureWebApp.Tests/Calamari.AzureWebApp.Tests.csproj b/source/Calamari.AzureWebApp.Tests/Calamari.AzureWebApp.Tests.csproj index 0b6a698239..1e9bcf2b4b 100644 --- a/source/Calamari.AzureWebApp.Tests/Calamari.AzureWebApp.Tests.csproj +++ b/source/Calamari.AzureWebApp.Tests/Calamari.AzureWebApp.Tests.csproj @@ -31,7 +31,7 @@ - + diff --git a/source/Calamari.AzureWebApp.Tests/DeployAzureWebCommandFixture.cs b/source/Calamari.AzureWebApp.Tests/DeployAzureWebCommandFixture.cs index 661a4a8b61..0186a51099 100644 --- a/source/Calamari.AzureWebApp.Tests/DeployAzureWebCommandFixture.cs +++ b/source/Calamari.AzureWebApp.Tests/DeployAzureWebCommandFixture.cs @@ -413,13 +413,10 @@ public async Task Deploy_WebApp_Ensure_Tools_Are_Configured() az group list"; File.WriteAllText(Path.Combine(tempPath.DirectoryPath, "PreDeploy.ps1"), psScript); - // This should be references from Sashimi.Server.Contracts, since Calamari.AzureWebApp is a net461 project this cannot be included. - var AccountType = "Octopus.Account.AccountType"; - await CommandTestBuilder.CreateAsync() .WithArrange(context => { - context.Variables.Add(AccountType, "AzureServicePrincipal"); + context.Variables.Add(SpecialVariables.Account.AccountType, "AzureServicePrincipal"); AddDefaults(context); context.Variables.Add(KnownVariables.Package.EnabledFeatures, KnownVariables.Features.CustomScripts); context.Variables.Add(KnownVariables.Action.CustomScripts.GetCustomScriptStage(DeploymentStages.Deploy, ScriptSyntax.PowerShell), psScript); diff --git a/source/Calamari.AzureWebApp/Calamari.AzureWebApp.csproj b/source/Calamari.AzureWebApp/Calamari.AzureWebApp.csproj index 678908382b..a5ab628665 100644 --- a/source/Calamari.AzureWebApp/Calamari.AzureWebApp.csproj +++ b/source/Calamari.AzureWebApp/Calamari.AzureWebApp.csproj @@ -63,8 +63,7 @@ - - + diff --git a/source/Calamari.Common/Calamari.Common.csproj b/source/Calamari.Common/Calamari.Common.csproj index 02b49ed93a..45e26754df 100644 --- a/source/Calamari.Common/Calamari.Common.csproj +++ b/source/Calamari.Common/Calamari.Common.csproj @@ -31,8 +31,6 @@ - - diff --git a/source/Calamari.Common/CalamariFlavourProgram.cs b/source/Calamari.Common/CalamariFlavourProgram.cs index 6d2f09df84..1d40261aa3 100644 --- a/source/Calamari.Common/CalamariFlavourProgram.cs +++ b/source/Calamari.Common/CalamariFlavourProgram.cs @@ -41,7 +41,6 @@ protected virtual int Run(string[] args) { AppDomainConfiguration.SetDefaultRegexMatchTimeout(); - SecurityProtocols.EnableAllSecurityProtocols(); var options = CommonOptions.Parse(args); log.Verbose($"Calamari Version: {GetType().Assembly.GetInformationalVersion()}"); diff --git a/source/Calamari.Common/CalamariFlavourProgramAsync.cs b/source/Calamari.Common/CalamariFlavourProgramAsync.cs index 4a1b470832..50011d85e2 100644 --- a/source/Calamari.Common/CalamariFlavourProgramAsync.cs +++ b/source/Calamari.Common/CalamariFlavourProgramAsync.cs @@ -106,7 +106,6 @@ protected async Task Run(string[] args) { AppDomainConfiguration.SetDefaultRegexMatchTimeout(); - SecurityProtocols.EnableAllSecurityProtocols(); var options = CommonOptions.Parse(args); log.Verbose($"Calamari Version: {GetType().Assembly.GetInformationalVersion()}"); diff --git a/source/Calamari.Common/Plumbing/Extensions/ScriptingEnvironment.cs b/source/Calamari.Common/Plumbing/Extensions/ScriptingEnvironment.cs index de17250510..7c757105c9 100644 --- a/source/Calamari.Common/Plumbing/Extensions/ScriptingEnvironment.cs +++ b/source/Calamari.Common/Plumbing/Extensions/ScriptingEnvironment.cs @@ -9,12 +9,6 @@ namespace Calamari.Common.Plumbing.Extensions { public class ScriptingEnvironment { - public static bool IsNet45OrNewer() - { - // Class "ReflectionContext" exists from .NET 4.5 onwards. - return Type.GetType("System.Reflection.ReflectionContext", false) != null; - } - public static bool IsRunningOnMono() { var monoRuntime = Type.GetType("Mono.Runtime"); diff --git a/source/Calamari.Common/Plumbing/SecurityProtocols.cs b/source/Calamari.Common/Plumbing/SecurityProtocols.cs deleted file mode 100644 index 7592acf454..0000000000 --- a/source/Calamari.Common/Plumbing/SecurityProtocols.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Net; -using Calamari.Common.Plumbing.Logging; - -namespace Calamari.Common.Plumbing -{ - public static class SecurityProtocols - { - public static void EnableAllSecurityProtocols() - { - // TLS1.2 was required to access GitHub apis as of 22 Feb 2018. - // https://developer.github.com/changes/2018-02-01-weak-crypto-removal-notice/ - - // TLS1.1 and below was discontinued on MavenCentral as of 18 June 2018 - //https://central.sonatype.org/articles/2018/May/04/discontinue-support-for-tlsv11-and-below/ - - var securityProtocolTypes = SecurityProtocolType.Tls; - - // Enum.IsDefined is used as even though it may be compiled against net40 which does not have the flag - // if at runtime it runs on say net475 the flags are present - if (Enum.IsDefined(typeof(SecurityProtocolType), 768)) - securityProtocolTypes |= (SecurityProtocolType)768; - - if (Enum.IsDefined(typeof(SecurityProtocolType), 3072)) - securityProtocolTypes |= (SecurityProtocolType)3072; - else - Log.Verbose($"TLS1.2 is not supported, this means that some outgoing connections to third party endpoints will not work as they now only support TLS1.2.{Environment.NewLine}This includes GitHub feeds and Maven feeds."); - - ServicePointManager.SecurityProtocol = securityProtocolTypes; - } - } -} \ No newline at end of file diff --git a/source/Calamari.Common/Plumbing/Variables/KnownVariables.cs b/source/Calamari.Common/Plumbing/Variables/KnownVariables.cs index d4cd91b2af..4b603e9bda 100644 --- a/source/Calamari.Common/Plumbing/Variables/KnownVariables.cs +++ b/source/Calamari.Common/Plumbing/Variables/KnownVariables.cs @@ -14,8 +14,6 @@ public class KnownVariables public static readonly string AppliedXmlConfigTransforms = "OctopusAppliedXmlConfigTransforms"; public static readonly string ShouldFailDeploymentOnSubstitutionFails = "OctopusShouldFailDeploymentOnSubstitutionFails"; - public static readonly string NugetHttpTimeout = "OctopusNugetHttpTimeout"; - public const string EnabledFeatureToggles = "OctopusEnabledFeatureToggles"; public static class Action diff --git a/source/Calamari.ConsolidateCalamariPackages.Tests/ConsolidationVerificationTests.cs b/source/Calamari.ConsolidateCalamariPackages.Tests/ConsolidationVerificationTests.cs index f5025f474d..a3fd2d0d74 100644 --- a/source/Calamari.ConsolidateCalamariPackages.Tests/ConsolidationVerificationTests.cs +++ b/source/Calamari.ConsolidateCalamariPackages.Tests/ConsolidationVerificationTests.cs @@ -10,17 +10,7 @@ namespace Calamari.ConsolidateCalamariPackages.Tests { - struct PackagePropertiesToTest - { - public string[] Architectures { get; } - public bool IsNupkg { get; } - - public PackagePropertiesToTest(string[] architectures, bool isNupkg) - { - Architectures = architectures; - IsNupkg = isNupkg; - } - } + record PackagePropertiesToTest(string[] Architectures, bool IsNupkg); [TestFixture] public class ConsolidationVerificationTests @@ -32,67 +22,64 @@ public class ConsolidationVerificationTests const string WindowsX64Arch = "win-x64"; static readonly string[] NetCoreArchitectures = - { + [ "linux-arm", "linux-arm64", "linux-x64", "osx-x64", WindowsX64Arch - }; + ]; static Dictionary PackagesWithDetails() { return new Dictionary { { "Calamari", new PackagePropertiesToTest(NetCoreArchitectures, false /* this is no longer a nuget package */) }, - { "Calamari.AzureServiceFabric", new PackagePropertiesToTest(new[] { WindowsX64Arch }, false) }, + { "Calamari.AzureServiceFabric", new PackagePropertiesToTest([WindowsX64Arch], false) }, { "Calamari.AzureAppService", new PackagePropertiesToTest(NetCoreArchitectures, false) }, { "Calamari.AzureResourceGroup", new PackagePropertiesToTest(NetCoreArchitectures, false) }, { "Calamari.GoogleCloudScripting", new PackagePropertiesToTest(NetCoreArchitectures, false) }, { "Calamari.AzureScripting", new PackagePropertiesToTest(NetCoreArchitectures, false) }, - { "Calamari.AzureWebApp", new PackagePropertiesToTest(new[] { WindowsX64Arch }, false) }, + { "Calamari.AzureWebApp", new PackagePropertiesToTest([WindowsX64Arch], false) }, { "Calamari.Terraform", new PackagePropertiesToTest(NetCoreArchitectures, false) } }; } - static bool PackageSupported(string packageId, bool isWindows) - { - var packages = BuildableCalamariProjects.GetCalamariProjectsToBuild(isWindows); - return packages.Contains(packageId); - } - - static IEnumerable ExpectedPackages() + static readonly HashSet PackagesWithDotnetScript = + [ + "Calamari", + "Calamari.AzureScripting", + "Calamari.AzureResourceGroup", + "Calamari.AzureAppService", + "Calamari.GoogleCloudScripting", + "Calamari.AzureWebApp" + ]; + + static IEnumerable> SupportedPackages() { var isWindowsEnvValue = Environment.GetEnvironmentVariable("IS_WINDOWS"); - var isWindows = isWindowsEnvValue == null ? RuntimeInformation.IsOSPlatform(OSPlatform.Windows) : bool.Parse(isWindowsEnvValue); + var buildable = BuildableCalamariProjects.GetCalamariProjectsToBuild(isWindows); return PackagesWithDetails() - .Where(kvp => PackageSupported(kvp.Key, isWindows)) - .Select(kvp => kvp.Key); + .Where(kvp => buildable.Contains(kvp.Key)); } + static IEnumerable ExpectedPackages() + => SupportedPackages().Select(kvp => kvp.Key); + static IEnumerable ExpectedPackageArchitectureMappings() - { - var isWindowsEnvValue = Environment.GetEnvironmentVariable("IS_WINDOWS"); + => SupportedPackages() + .Select(kvp => new TestCaseData(kvp.Key, kvp.Value.Architectures).SetName($"Package_{kvp.Key}_HasExpectedArchitectures")); - var isWindows = isWindowsEnvValue == null ? RuntimeInformation.IsOSPlatform(OSPlatform.Windows) : bool.Parse(isWindowsEnvValue); - - return PackagesWithDetails() - .Where(kvp => PackageSupported(kvp.Key, isWindows)) - .Select(kvp => new TestCaseData(kvp.Key, kvp.Value.Architectures).SetName($"Package_{kvp.Key}_HasExpectedArchitectures")); - } + static IEnumerable ExpectedPackagesWithDotnetScript() + => SupportedPackages() + .Where(kvp => PackagesWithDotnetScript.Contains(kvp.Key)) + .Select(kvp => new TestCaseData(kvp.Key).SetName($"Package_{kvp.Key}_ContainsDotnetScript")); static IEnumerable ExpectedPackageNugetStatus() - { - var isWindowsEnvValue = Environment.GetEnvironmentVariable("IS_WINDOWS"); - - var isWindows = isWindowsEnvValue == null ? RuntimeInformation.IsOSPlatform(OSPlatform.Windows) : bool.Parse(isWindowsEnvValue); - - return PackagesWithDetails() - .Where(kvp => PackageSupported(kvp.Key, isWindows)) - .Select(kvp => new TestCaseData(kvp.Key, kvp.Value.IsNupkg).SetName($"Package {kvp.Key} Has Expected Nuget PackageFlag")); - } + => SupportedPackages() + .Select(kvp => new TestCaseData(kvp.Key, kvp.Value.IsNupkg).SetName($"Package {kvp.Key} Has Expected Nuget PackageFlag")); [SetUp] public void SetUp() @@ -101,10 +88,8 @@ public void SetUp() expectedVersion = Environment.GetEnvironmentVariable("EXPECTED_VERSION") ?? ""; var indexLoader = new ConsolidatedPackageIndexLoader(); - using (var fileStream = File.OpenRead(consolidatedFilePath)) - { - consolidatedPackageIndex = indexLoader.Load(fileStream); - } + using var fileStream = File.OpenRead(consolidatedFilePath); + consolidatedPackageIndex = indexLoader.Load(fileStream); } [TestCaseSource(nameof(ExpectedPackageArchitectureMappings))] @@ -127,5 +112,18 @@ public void ConsolidatedPackageIndex_FlagsNugetPackagesCorrectly(string packageN var package = consolidatedPackageIndex.GetPackage(packageName); package.IsNupkg.Should().Be(isNugetPackage); } + + [TestCaseSource(nameof(ExpectedPackagesWithDotnetScript))] + public void ConsolidatedPackageIndex_ContainsDotnetScriptForScriptingFlavours(string packageName) + { + var package = consolidatedPackageIndex.GetPackage(packageName); + foreach (var (platform, fileTransfers) in package.PlatformFiles) + { + fileTransfers.Should().Contain( + ft => ft.Destination.Contains("dotnet-script/"), + $"{packageName} on {platform} should contain dotnet-script"); + } + } } } + diff --git a/source/Calamari.GoogleCloudScripting.Tests/Calamari.GoogleCloudScripting.Tests.csproj b/source/Calamari.GoogleCloudScripting.Tests/Calamari.GoogleCloudScripting.Tests.csproj index bb23de344f..2497f483bb 100644 --- a/source/Calamari.GoogleCloudScripting.Tests/Calamari.GoogleCloudScripting.Tests.csproj +++ b/source/Calamari.GoogleCloudScripting.Tests/Calamari.GoogleCloudScripting.Tests.csproj @@ -12,7 +12,6 @@ - diff --git a/source/Calamari.GoogleCloudScripting/Calamari.GoogleCloudScripting.csproj b/source/Calamari.GoogleCloudScripting/Calamari.GoogleCloudScripting.csproj index 2f3bf29646..ac7743381d 100644 --- a/source/Calamari.GoogleCloudScripting/Calamari.GoogleCloudScripting.csproj +++ b/source/Calamari.GoogleCloudScripting/Calamari.GoogleCloudScripting.csproj @@ -18,8 +18,7 @@ - - + diff --git a/source/Calamari.Shared/Calamari.Shared.csproj b/source/Calamari.Shared/Calamari.Shared.csproj index b188ac573f..fdece437f5 100644 --- a/source/Calamari.Shared/Calamari.Shared.csproj +++ b/source/Calamari.Shared/Calamari.Shared.csproj @@ -38,17 +38,14 @@ - - - diff --git a/source/Calamari.Shared/Integration/Packages/Download/MavenPackageDownloader.cs b/source/Calamari.Shared/Integration/Packages/Download/MavenPackageDownloader.cs index 3ae7d5cf26..069ea3f967 100644 --- a/source/Calamari.Shared/Integration/Packages/Download/MavenPackageDownloader.cs +++ b/source/Calamari.Shared/Integration/Packages/Download/MavenPackageDownloader.cs @@ -49,7 +49,6 @@ public PackagePhysicalFileMetadata DownloadPackage(string packageId, int maxDownloadAttempts, TimeSpan downloadAttemptBackoff) { - ServicePointManager.SecurityProtocol |= (SecurityProtocolType)3072; var cacheDirectory = PackageDownloaderUtils.GetPackageRoot(feedId); fileSystem.EnsureDirectoryExists(cacheDirectory); diff --git a/source/Calamari.Shared/Integration/Packages/Download/NpmPackageDownloader.cs b/source/Calamari.Shared/Integration/Packages/Download/NpmPackageDownloader.cs index b6f50ecd9f..d29e313504 100644 --- a/source/Calamari.Shared/Integration/Packages/Download/NpmPackageDownloader.cs +++ b/source/Calamari.Shared/Integration/Packages/Download/NpmPackageDownloader.cs @@ -43,7 +43,6 @@ public PackagePhysicalFileMetadata DownloadPackage( int maxDownloadAttempts, TimeSpan downloadAttemptBackoff) { - ServicePointManager.SecurityProtocol |= (SecurityProtocolType)3072; var cacheDirectory = PackageDownloaderUtils.GetPackageRoot(feedId); fileSystem.EnsureDirectoryExists(cacheDirectory); diff --git a/source/Calamari.Shared/Integration/Packages/NuGet/InternalNuGetPackageDownloader.cs b/source/Calamari.Shared/Integration/Packages/NuGet/InternalNuGetPackageDownloader.cs index 6618f3097a..8d57ad880b 100644 --- a/source/Calamari.Shared/Integration/Packages/NuGet/InternalNuGetPackageDownloader.cs +++ b/source/Calamari.Shared/Integration/Packages/NuGet/InternalNuGetPackageDownloader.cs @@ -99,20 +99,8 @@ private void DownloadPackageAction(string packageId, IVersion version, Uri feedU } - WarnIfHttpTimeoutHasBeenSet(); NuGetV3LibDownloader.DownloadPackage(packageId, version, feedUri, feedCredentials, targetFilePath); } - - void WarnIfHttpTimeoutHasBeenSet() - { - if (variables.IsSet(KnownVariables.NugetHttpTimeout)) - { - Log.Warn( - $"A Nuget HTTP timeout was set via the '{KnownVariables.NugetHttpTimeout}' variable. " - + "This variable is only supported when running on .NET Framework." - ); - } - } bool IsHttp(string uri) { diff --git a/source/Calamari.Terraform.Tests/CommandsFixture.cs b/source/Calamari.Terraform.Tests/CommandsFixture.cs index 716b4b4225..68fa6a023c 100644 --- a/source/Calamari.Terraform.Tests/CommandsFixture.cs +++ b/source/Calamari.Terraform.Tests/CommandsFixture.cs @@ -153,7 +153,7 @@ async Task DownloadCli(string destination, string version) .FirstOrDefault(f => Path.GetFileName(f).Contains("terraform")); Console.WriteLine($"Downloaded terraform to {customTerraformExecutable}"); - AddExecutePermission(customTerraformExecutable!); + ExecutableHelper.AddExecutePermission(customTerraformExecutable!); break; } catch @@ -863,21 +863,5 @@ void IgnoreIfVersionIsNotInRange(string minimum, string maximum, string because) } } - //TODO: This is ported over from the ExecutableHelper in Sashimi.Tests.Shared. This project doesn't have a valid nuget package for net452 - static void AddExecutePermission(string exePath) - { - if (CalamariEnvironment.IsRunningOnWindows) - return; - StringBuilder stdOut = new StringBuilder(); - StringBuilder stdError = new StringBuilder(); - if (SilentProcessRunner.ExecuteCommand("chmod", - "+x " + exePath, - Path.GetDirectoryName(exePath) ?? string.Empty, - (Action)(s => stdOut.AppendLine(s)), - (Action)(s => stdError.AppendLine(s))) - .ExitCode - != 0) - throw new Exception(stdOut.ToString() + stdError?.ToString()); - } } -} \ No newline at end of file +} diff --git a/source/Calamari.Testing/Calamari.Testing.csproj b/source/Calamari.Testing/Calamari.Testing.csproj index d78695c693..00c5c11e69 100644 --- a/source/Calamari.Testing/Calamari.Testing.csproj +++ b/source/Calamari.Testing/Calamari.Testing.csproj @@ -14,7 +14,6 @@ - diff --git a/source/Calamari.Tests/Calamari.Tests.csproj b/source/Calamari.Tests/Calamari.Tests.csproj index 05dffbea16..d06b6fdbf2 100644 --- a/source/Calamari.Tests/Calamari.Tests.csproj +++ b/source/Calamari.Tests/Calamari.Tests.csproj @@ -34,7 +34,6 @@ - @@ -241,16 +240,7 @@ - - - - + @@ -260,7 +250,6 @@ - @@ -272,7 +261,6 @@ - diff --git a/source/Calamari.Tests/GlobalTestSetup.cs b/source/Calamari.Tests/GlobalTestSetup.cs deleted file mode 100644 index 18d117fa59..0000000000 --- a/source/Calamari.Tests/GlobalTestSetup.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Calamari.Common.Plumbing; -using NUnit.Framework; - -namespace Calamari.Tests -{ - // using statements - - [SetUpFixture] - public class GlobalTestSetup - { - [OneTimeSetUp] - public void EnableAllSecurityProtocols() - { - // Enabling of TLS1.2 happens on Calamari.exe startup in main, - // however this will ensure it is applied during Unit Tests which will bypass the main entrypoint - SecurityProtocols.EnableAllSecurityProtocols(); - } - } -} diff --git a/source/Calamari/Calamari.csproj b/source/Calamari/Calamari.csproj index 343e03f00e..90b3cfe4cf 100644 --- a/source/Calamari/Calamari.csproj +++ b/source/Calamari/Calamari.csproj @@ -30,10 +30,6 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - @@ -44,9 +40,7 @@ - - @@ -57,15 +51,7 @@ PreserveNewest - - - + diff --git a/source/Calamari/Kubernetes/Commands/KubernetesDeploymentCommandBase.cs b/source/Calamari/Kubernetes/Commands/KubernetesDeploymentCommandBase.cs index 55dbec13d5..66a9655c6d 100644 --- a/source/Calamari/Kubernetes/Commands/KubernetesDeploymentCommandBase.cs +++ b/source/Calamari/Kubernetes/Commands/KubernetesDeploymentCommandBase.cs @@ -68,13 +68,8 @@ protected KubernetesDeploymentCommandBase( protected virtual IEnumerable CommandSpecificInstallConventions() => Enumerable.Empty(); - /// - /// This empty implementation uses Task.FromResult(new object()); instead of - /// Task.CompletedTask because Task.CompletedTask was only added in .NET 4.6.1 - /// so it is not compatible with Calamari. - /// - protected virtual async Task ExecuteCommand(RunningDeployment runningDeployment) => - await Task.FromResult(true); + protected virtual Task ExecuteCommand(RunningDeployment runningDeployment) => + Task.FromResult(true); public override int Execute(string[] commandLineArguments) { diff --git a/source/Directory.Build.props b/source/Directory.Build.props deleted file mode 100644 index c078493167..0000000000 --- a/source/Directory.Build.props +++ /dev/null @@ -1,6 +0,0 @@ - - - true - false - -