diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 510378f..faf127f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,13 +27,15 @@ jobs: git tag --list # Install .NET version as mandated by global.json - - uses: actions/setup-dotnet@v3 + - uses: actions/setup-dotnet@v4.1.0 with: global-json-file: global.json + dotnet-version: | + 6.x env: NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - run: ./build.sh build -s true + - run: ./build.sh test name: Build - run: ./build.sh generatepackages -s true name: Generate local nuget packages diff --git a/build/scripts/CommandLine.fs b/build/scripts/CommandLine.fs index d94108f..4672ec8 100644 --- a/build/scripts/CommandLine.fs +++ b/build/scripts/CommandLine.fs @@ -10,7 +10,8 @@ open Microsoft.FSharp.Reflection type Arguments = | [] Clean | [] Build - + | [] Test + | [] PristineCheck | [] GeneratePackages | [] ValidatePackages @@ -27,10 +28,11 @@ with interface IArgParserTemplate with member this.Usage = match this with - | Clean _ -> "clean known output locations" - | Build _ -> "Run build and tests" - | Release _ -> "runs build, and create an validates the packages shy of publishing them" - | Publish _ -> "Runs the full release" + | Clean -> "clean known output locations" + | Build -> "Run build" + | Test -> "Run build and tests" + | Release -> "runs build, and create an validates the packages shy of publishing them" + | Publish -> "Runs the full release" | SingleTarget _ -> "Runs the provided sub command without running their dependencies" | Token _ -> "Token to be used to authenticate with github" diff --git a/build/scripts/Targets.fs b/build/scripts/Targets.fs index 59ee764..7da3aaa 100644 --- a/build/scripts/Targets.fs +++ b/build/scripts/Targets.fs @@ -14,9 +14,8 @@ open ProcNet let exec binary args = - let r = Proc.Exec (binary, args |> List.map (fun a -> sprintf "\"%s\"" a) |> List.toArray) - match r.HasValue with | true -> r.Value | false -> failwithf "invocation of `%s` timed out" binary - + Proc.Exec (binary, args |> List.toArray) + let private restoreTools = lazy(exec "dotnet" ["tool"; "restore"]) let private currentVersion = lazy( @@ -38,6 +37,8 @@ let private clean (arguments:ParseResults) = let private build (arguments:ParseResults) = exec "dotnet" ["build"; "-c"; "Release"] |> ignore +let private test (arguments:ParseResults) = ignore() + let private pristineCheck (arguments:ParseResults) = match Information.isCleanWorkingCopy "." with | true -> printfn "The checkout folder does not have pending changes, proceeding" @@ -142,7 +143,8 @@ let Setup (parsed:ParseResults) (subCommand:Arguments) = step Clean.Name clean cmd Build.Name None (Some [Clean.Name]) <| fun _ -> build parsed - + cmd Test.Name None (Some [Build.Name]) <| fun _ -> test parsed + step PristineCheck.Name pristineCheck step GeneratePackages.Name generatePackages step ValidatePackages.Name validatePackages diff --git a/build/scripts/scripts.fsproj b/build/scripts/scripts.fsproj index 5220347..f2027b1 100644 --- a/build/scripts/scripts.fsproj +++ b/build/scripts/scripts.fsproj @@ -8,7 +8,7 @@ - + diff --git a/examples/Elastic.Ephemeral.Example/Program.cs b/examples/Elastic.Ephemeral.Example/Program.cs index ffe89e1..f5c8fb1 100644 --- a/examples/Elastic.Ephemeral.Example/Program.cs +++ b/examples/Elastic.Ephemeral.Example/Program.cs @@ -11,7 +11,7 @@ using HttpMethod = Elastic.Transport.HttpMethod; -var config = new EphemeralClusterConfiguration("8.7.0", XPack | Security | SSL); +var config = new EphemeralClusterConfiguration("8.15.0"); using var cluster = new EphemeralCluster(config); var exitEvent = new ManualResetEvent(false); diff --git a/examples/Elastic.Managed.Example/Program.cs b/examples/Elastic.Managed.Example/Program.cs index 5a00083..f569037 100644 --- a/examples/Elastic.Managed.Example/Program.cs +++ b/examples/Elastic.Managed.Example/Program.cs @@ -3,9 +3,12 @@ // See the LICENSE file in the project root for more information using System; +using System.IO; using Elastic.Elasticsearch.Managed; using Elastic.Elasticsearch.Managed.Configuration; using Elastic.Elasticsearch.Managed.ConsoleWriters; +using Elastic.Stack.ArtifactsApi; +using Elastic.Stack.ArtifactsApi.Products; namespace Elastic.Managed.Example { @@ -13,12 +16,13 @@ public static class Program { public static void Main(string[] args) { - var version = "6.3.0"; - var esHome = - Environment.ExpandEnvironmentVariables( - $@"%LOCALAPPDATA%\ElasticManaged\{version}\elasticsearch-{version}"); + ElasticVersion version = "latest-8"; + var folderName = version.Artifact(Product.Elasticsearch).LocalFolderName; - var clusterConfiguration = new ClusterConfiguration(version, esHome, 2); + var temp = Path.Combine(Path.GetTempPath(), "elastic", folderName, "my-cluster"); + var home = Path.Combine(temp, "home"); + + var clusterConfiguration = new ClusterConfiguration(version, home, 2); using (var cluster = new ElasticsearchCluster(clusterConfiguration)) cluster.Start(new ConsoleLineWriter(), TimeSpan.FromMinutes(2)); diff --git a/examples/Elastic.Xunit.ExampleComplex/Clusters.cs b/examples/Elastic.Xunit.ExampleComplex/Clusters.cs index 9d5b146..7e51c93 100644 --- a/examples/Elastic.Xunit.ExampleComplex/Clusters.cs +++ b/examples/Elastic.Xunit.ExampleComplex/Clusters.cs @@ -12,11 +12,10 @@ namespace Elastic.Xunit.ExampleComplex { internal static class EphemeralClusterExtensions { - private static readonly ConcurrentDictionary Clients = - new ConcurrentDictionary(); + private static readonly ConcurrentDictionary Clients = new(); public static IElasticClient GetOrAddClient(this IEphemeralCluster cluster) => - Clients.GetOrAdd(cluster, (c) => + Clients.GetOrAdd(cluster, c => { var connectionPool = new StaticConnectionPool(c.NodesUris()); var settings = new ConnectionSettings(connectionPool); @@ -30,15 +29,11 @@ public interface IMyCluster IElasticClient Client { get; } } - public abstract class MyClusterBase : XunitClusterBase, IMyCluster + public abstract class MyClusterBase() : XunitClusterBase(new XunitClusterConfiguration(MyRunOptions.TestVersion) + { + ShowElasticsearchOutputAfterStarted = false, + }), IMyCluster { - protected MyClusterBase() : base(new XunitClusterConfiguration(MyRunOptions.TestVersion) - { - ShowElasticsearchOutputAfterStarted = false, - }) - { - } - public IElasticClient Client => this.GetOrAddClient(); } diff --git a/examples/Elastic.Xunit.ExampleComplex/Elastic.Xunit.ExampleComplex.csproj b/examples/Elastic.Xunit.ExampleComplex/Elastic.Xunit.ExampleComplex.csproj index 25d4ff8..ddda97c 100644 --- a/examples/Elastic.Xunit.ExampleComplex/Elastic.Xunit.ExampleComplex.csproj +++ b/examples/Elastic.Xunit.ExampleComplex/Elastic.Xunit.ExampleComplex.csproj @@ -5,12 +5,12 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/examples/Elastic.Xunit.ExampleComplex/Tests.cs b/examples/Elastic.Xunit.ExampleComplex/Tests.cs index 8a97d8d..1035a56 100644 --- a/examples/Elastic.Xunit.ExampleComplex/Tests.cs +++ b/examples/Elastic.Xunit.ExampleComplex/Tests.cs @@ -2,11 +2,9 @@ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information -using Elastic.Elasticsearch.Managed; using Elastic.Elasticsearch.Xunit.XunitPlumbing; using Elasticsearch.Net; using FluentAssertions; -using Xunit; namespace Elastic.Xunit.ExampleComplex { diff --git a/examples/Elastic.Xunit.ExampleMinimal/Elastic.Xunit.ExampleMinimal.csproj b/examples/Elastic.Xunit.ExampleMinimal/Elastic.Xunit.ExampleMinimal.csproj index de16926..71630d4 100644 --- a/examples/Elastic.Xunit.ExampleMinimal/Elastic.Xunit.ExampleMinimal.csproj +++ b/examples/Elastic.Xunit.ExampleMinimal/Elastic.Xunit.ExampleMinimal.csproj @@ -4,12 +4,12 @@ False - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/examples/Elastic.Xunit.ExampleMinimal/ExampleTest.cs b/examples/Elastic.Xunit.ExampleMinimal/ExampleTest.cs index 493522c..ca861a1 100644 --- a/examples/Elastic.Xunit.ExampleMinimal/ExampleTest.cs +++ b/examples/Elastic.Xunit.ExampleMinimal/ExampleTest.cs @@ -21,7 +21,7 @@ public class MyTestCluster : XunitClusterBase /// We pass our configuration instance to the base class. /// We only configure it to run version 6.2.3 here but lots of additional options are available. /// - public MyTestCluster() : base(new XunitClusterConfiguration("latest-8") { }) + public MyTestCluster() : base(new XunitClusterConfiguration("latest-8")) { } } diff --git a/examples/ScratchPad/ScratchPad.csproj b/examples/ScratchPad/ScratchPad.csproj index cef057c..9810b28 100644 --- a/examples/ScratchPad/ScratchPad.csproj +++ b/examples/ScratchPad/ScratchPad.csproj @@ -5,7 +5,7 @@ False - + diff --git a/global.json b/global.json index c317b00..789bff3 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.302", + "version": "8.0.100", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 3f90319..7384c98 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -33,6 +33,6 @@ - + diff --git a/src/Elastic.Elasticsearch.Ephemeral/Elastic.Elasticsearch.Ephemeral.csproj b/src/Elastic.Elasticsearch.Ephemeral/Elastic.Elasticsearch.Ephemeral.csproj index 2a1477a..ad351d1 100644 --- a/src/Elastic.Elasticsearch.Ephemeral/Elastic.Elasticsearch.Ephemeral.csproj +++ b/src/Elastic.Elasticsearch.Ephemeral/Elastic.Elasticsearch.Ephemeral.csproj @@ -1,15 +1,18 @@  - netstandard2.0;net462 + netstandard2.0;netstandard2.1;net462 Provides an EphemeralCluster implementation that can download/bootstrap/run a throwaway customizable Elasticsearch cluster elastic,elasticsearch,cluster,ephemeral - + + + + \ No newline at end of file diff --git a/src/Elastic.Elasticsearch.Ephemeral/EphemeralFileSystem.cs b/src/Elastic.Elasticsearch.Ephemeral/EphemeralFileSystem.cs index 15acaa7..a1166ec 100644 --- a/src/Elastic.Elasticsearch.Ephemeral/EphemeralFileSystem.cs +++ b/src/Elastic.Elasticsearch.Ephemeral/EphemeralFileSystem.cs @@ -56,8 +56,9 @@ public EphemeralFileSystem(ElasticVersion version, string clusterName) : base(ve protected static string EphemeralHome(ElasticVersion version, string clusterName) { - var temp = Path.Combine(Path.GetTempPath(), SubFolder, - version.Artifact(Product.Elasticsearch).LocalFolderName, clusterName); + var artifact = version.Artifact(Product.Elasticsearch); + var localFolder = artifact.LocalFolderName; + var temp = Path.Combine(Path.GetTempPath(), SubFolder, localFolder, clusterName); return Path.Combine(temp, "home"); } } diff --git a/src/Elastic.Elasticsearch.Ephemeral/Tasks/BeforeStartNodeTasks/XPack/EnsureSecurityUsersInDefaultRealmAreAdded.cs b/src/Elastic.Elasticsearch.Ephemeral/Tasks/BeforeStartNodeTasks/XPack/EnsureSecurityUsersInDefaultRealmAreAdded.cs index c42c682..b781ce8 100644 --- a/src/Elastic.Elasticsearch.Ephemeral/Tasks/BeforeStartNodeTasks/XPack/EnsureSecurityUsersInDefaultRealmAreAdded.cs +++ b/src/Elastic.Elasticsearch.Ephemeral/Tasks/BeforeStartNodeTasks/XPack/EnsureSecurityUsersInDefaultRealmAreAdded.cs @@ -49,8 +49,10 @@ public override void Run(IEphemeralCluster cluste var pluginBat = Path.Combine(pluginFolder, binary) + BinarySuffix; foreach (var cred in ClusterAuthentication.AllUsers) + { ExecuteBinary(cluster.ClusterConfiguration, cluster.Writer, pluginBat, - $"adding user {cred.Username}", $"useradd {cred.Username} -p {cred.Password} -r {cred.Role}"); + $"adding user {cred.Username}", "useradd", cred.Username, "-p", cred.Password, "-r", cred.Role); + } if (!Directory.Exists(xpackConfigFolderCached)) Directory.CreateDirectory(xpackConfigFolderCached); diff --git a/src/Elastic.Elasticsearch.Ephemeral/Tasks/IClusterComposeTask.cs b/src/Elastic.Elasticsearch.Ephemeral/Tasks/IClusterComposeTask.cs index 536c22d..c6e4184 100644 --- a/src/Elastic.Elasticsearch.Ephemeral/Tasks/IClusterComposeTask.cs +++ b/src/Elastic.Elasticsearch.Ephemeral/Tasks/IClusterComposeTask.cs @@ -148,14 +148,10 @@ protected static void WriteFileIfNotExist(string fileLocation, string contents) protected static void ExecuteBinary(EphemeralClusterConfiguration config, IConsoleLineHandler writer, string binary, string description, params string[] arguments) => - ExecuteBinaryInternal(config, writer, binary, description, null, arguments); - - protected static void ExecuteBinary(EphemeralClusterConfiguration config, IConsoleLineHandler writer, - string binary, string description, StartedHandler startedHandler, params string[] arguments) => - ExecuteBinaryInternal(config, writer, binary, description, startedHandler, arguments); + ExecuteBinaryInternal(config, writer, binary, description, arguments); private static void ExecuteBinaryInternal(EphemeralClusterConfiguration config, IConsoleLineHandler writer, - string binary, string description, StartedHandler startedHandler, params string[] arguments) + string binary, string description, params string[] arguments) { var command = $"{{{binary}}} {{{string.Join(" ", arguments)}}}"; writer?.WriteDiagnostic($"{{{nameof(ExecuteBinary)}}} starting process [{description}] {command}"); @@ -167,12 +163,14 @@ private static void ExecuteBinaryInternal(EphemeralClusterConfiguration config, { {config.FileSystem.ConfigEnvironmentVariableName, config.FileSystem.ConfigPath}, {"ES_HOME", config.FileSystem.ElasticsearchHome} - } + }, + Timeout = timeout, + ConsoleOutWriter = new ConsoleOutColorWriter(), }; - var result = startedHandler != null - ? Proc.Start(processStartArguments, timeout, new ConsoleOutColorWriter(), startedHandler) - : Proc.Start(processStartArguments, timeout, new ConsoleOutColorWriter()); + writer.WriteDiagnostic($"{binary} {string.Join(" ", arguments)}"); + + var result = Proc.Start(processStartArguments); if (!result.Completed) throw new Exception($"Timeout while executing {description} exceeded {timeout}"); @@ -227,21 +225,23 @@ protected static void Extract(string file, string toFolder) private static void ExtractTar(string file, string toFolder) { - using (var inStream = File.OpenRead(file)) - using (var tarArchive = TarArchive.CreateInputTarArchive(inStream)) - tarArchive.ExtractContents(toFolder); + using var inStream = File.OpenRead(file); + using var tarArchive = TarArchive.CreateInputTarArchive(inStream); + tarArchive.ExtractContents(toFolder); } private static void ExtractTarGz(string file, string toFolder) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - using (var inStream = File.OpenRead(file)) - using (var gzipStream = new GZipInputStream(inStream)) - using (var tarArchive = TarArchive.CreateInputTarArchive(gzipStream)) - tarArchive.ExtractContents(toFolder); + { + using var inStream = File.OpenRead(file); + using var gzipStream = new GZipInputStream(inStream); + using var tarArchive = TarArchive.CreateInputTarArchive(gzipStream); + tarArchive.ExtractContents(toFolder); + } else //SharpZipLib loses permissions when untarring - Proc.Exec("tar", "-xvf", file, "-C", toFolder); + Proc.Exec("tar", "-zxvf", file, "-C", toFolder); } private static void ExtractZip(string file, string toFolder) => diff --git a/src/Elastic.Elasticsearch.Managed/ClusterBase.cs b/src/Elastic.Elasticsearch.Managed/ClusterBase.cs index 110bf31..54b22f2 100644 --- a/src/Elastic.Elasticsearch.Managed/ClusterBase.cs +++ b/src/Elastic.Elasticsearch.Managed/ClusterBase.cs @@ -53,12 +53,8 @@ public interface ICluster : ICluster,IDisposable } - public abstract class ClusterBase : ClusterBase - { - protected ClusterBase(ClusterConfiguration clusterConfiguration) : base(clusterConfiguration) - { - } - } + public abstract class ClusterBase(ClusterConfiguration clusterConfiguration) + : ClusterBase(clusterConfiguration); public abstract class ClusterBase : ICluster where TConfiguration : IClusterConfiguration diff --git a/src/Elastic.Elasticsearch.Managed/Configuration/NodeSettings.cs b/src/Elastic.Elasticsearch.Managed/Configuration/NodeSettings.cs index 714c625..1ddcaad 100644 --- a/src/Elastic.Elasticsearch.Managed/Configuration/NodeSettings.cs +++ b/src/Elastic.Elasticsearch.Managed/Configuration/NodeSettings.cs @@ -11,9 +11,6 @@ namespace Elastic.Elasticsearch.Managed.Configuration { public class NodeSettings : List { - private static readonly ElasticVersion - LastVersionWithoutPrefixForSettings = ElasticVersion.From("5.0.0-alpha2"); - public NodeSettings() { } @@ -37,8 +34,7 @@ public void Add(string key, string value, string versionRange) => public string[] ToCommandLineArguments(ElasticVersion version) { - var settingsPrefix = version > LastVersionWithoutPrefixForSettings ? "" : "es."; - var settingArgument = version.Major >= 5 ? "-E " : "-D"; + var settingArgument = "-E"; return this //if a node setting is only applicable for a certain version make sure its filtered out .Where(s => string.IsNullOrEmpty(s.VersionRange) || version.InRange(s.VersionRange)) @@ -47,7 +43,9 @@ public string[] ToCommandLineArguments(ElasticVersion version) //on the command with the latter taking precedence .GroupBy(setting => setting.Key) .Select(g => g.Last()) - .Select(s => s.Key.StartsWith(settingArgument) ? s.ToString() : $"{settingArgument}{settingsPrefix}{s}") + .SelectMany( + s => [settingArgument, $"{s}"] + ) .ToArray(); } } diff --git a/src/Elastic.Elasticsearch.Managed/Elastic.Elasticsearch.Managed.csproj b/src/Elastic.Elasticsearch.Managed/Elastic.Elasticsearch.Managed.csproj index 5dd1bbb..5ab042f 100644 --- a/src/Elastic.Elasticsearch.Managed/Elastic.Elasticsearch.Managed.csproj +++ b/src/Elastic.Elasticsearch.Managed/Elastic.Elasticsearch.Managed.csproj @@ -1,19 +1,15 @@  - netstandard2.0;net462 + netstandard2.0;netstandard2.1;net462 Provides an observable ElasticsearchNode abstraction that can be used to wrap an elasticsearch process. Also ships with an cluster abstraction that can start one or more ElasticsearchNode's elastic,elasticsearch,cluster,observable,rx - - - - - + \ No newline at end of file diff --git a/src/Elastic.Elasticsearch.Managed/ElasticsearchCluster.cs b/src/Elastic.Elasticsearch.Managed/ElasticsearchCluster.cs index 4288773..40f5f5b 100644 --- a/src/Elastic.Elasticsearch.Managed/ElasticsearchCluster.cs +++ b/src/Elastic.Elasticsearch.Managed/ElasticsearchCluster.cs @@ -4,12 +4,7 @@ using Elastic.Elasticsearch.Managed.Configuration; -namespace Elastic.Elasticsearch.Managed -{ - public class ElasticsearchCluster : ClusterBase - { - public ElasticsearchCluster(ClusterConfiguration clusterConfiguration) : base(clusterConfiguration) - { - } - } -} +namespace Elastic.Elasticsearch.Managed; + +public class ElasticsearchCluster(ClusterConfiguration clusterConfiguration) + : ClusterBase(clusterConfiguration); diff --git a/src/Elastic.Elasticsearch.Managed/ElasticsearchNode.cs b/src/Elastic.Elasticsearch.Managed/ElasticsearchNode.cs index 57ee13e..8c2dae7 100644 --- a/src/Elastic.Elasticsearch.Managed/ElasticsearchNode.cs +++ b/src/Elastic.Elasticsearch.Managed/ElasticsearchNode.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Threading; using Elastic.Elasticsearch.Managed.Configuration; using Elastic.Elasticsearch.Managed.ConsoleWriters; @@ -116,12 +117,17 @@ public IDisposable SubscribeLines(IConsoleLineHandler writer, Action on var node = NodeConfiguration.DesiredNodeName; writer?.WriteDiagnostic($"Elasticsearch location: [{Binary}]", node); writer?.WriteDiagnostic($"Settings: {{{string.Join(" ", NodeConfiguration.CommandLineArguments)}}}", node); + writer?.WriteDiagnostic($"Environment: {{{string.Join(" ", StartArguments.Environment)}}}", node); + var envArgs = string.Join(" ", StartArguments.Environment.Select(kv => $"{kv.Key}={kv.Value}")); + writer?.WriteDiagnostic($"Full CMD: env {envArgs} {Binary} {string.Join(" ", NodeConfiguration.CommandLineArguments)} ", node); var envVarName = NodeConfiguration.Version.InRange("<7.12.0") ? "JAVA_HOME" : "ES_JAVA_HOME"; var javaHome = Environment.GetEnvironmentVariable(envVarName); - writer?.WriteDiagnostic($"{envVarName}: {{{javaHome}}}", node); - Process.StartInfo.Environment[envVarName] = javaHome; - + if (!string.IsNullOrWhiteSpace(javaHome)) + { + writer?.WriteDiagnostic($"{envVarName}: {{{javaHome}}}", node); + Process.StartInfo.Environment[envVarName] = javaHome; + } return SubscribeLines( l => { diff --git a/src/Elastic.Elasticsearch.Xunit/Elastic.Elasticsearch.Xunit.csproj b/src/Elastic.Elasticsearch.Xunit/Elastic.Elasticsearch.Xunit.csproj index 6015f45..0f66301 100644 --- a/src/Elastic.Elasticsearch.Xunit/Elastic.Elasticsearch.Xunit.csproj +++ b/src/Elastic.Elasticsearch.Xunit/Elastic.Elasticsearch.Xunit.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Elastic.Stack.ArtifactsApi/Elastic.Stack.ArtifactsApi.csproj b/src/Elastic.Stack.ArtifactsApi/Elastic.Stack.ArtifactsApi.csproj index 02bfc9f..5cc40ff 100644 --- a/src/Elastic.Stack.ArtifactsApi/Elastic.Stack.ArtifactsApi.csproj +++ b/src/Elastic.Stack.ArtifactsApi/Elastic.Stack.ArtifactsApi.csproj @@ -1,4 +1,4 @@ - + netstandard2.0;net462 Provides a set of classes to resolve the location of Elastic stack products in various stages: released, snapshot and build candidates @@ -6,8 +6,13 @@ - - + + + + + + + diff --git a/src/Elastic.Stack.ArtifactsApi/ElasticVersion.cs b/src/Elastic.Stack.ArtifactsApi/ElasticVersion.cs index 843bf66..b461d56 100644 --- a/src/Elastic.Stack.ArtifactsApi/ElasticVersion.cs +++ b/src/Elastic.Stack.ArtifactsApi/ElasticVersion.cs @@ -34,7 +34,7 @@ public int CompareTo(string other) public Artifact Artifact(Product product) { var cacheKey = product.ToString(); - if (_resolved.TryGetValue(cacheKey, out var artifact)) + if (_resolved.TryGetValue(cacheKey, out var artifact) && artifact != null) return artifact; switch (ArtifactBuildState) { diff --git a/src/Elastic.Stack.ArtifactsApi/Resolvers/SnapshotApiResolver.cs b/src/Elastic.Stack.ArtifactsApi/Resolvers/SnapshotApiResolver.cs index 8269ddd..cf42be5 100644 --- a/src/Elastic.Stack.ArtifactsApi/Resolvers/SnapshotApiResolver.cs +++ b/src/Elastic.Stack.ArtifactsApi/Resolvers/SnapshotApiResolver.cs @@ -18,8 +18,8 @@ namespace Elastic.Stack.ArtifactsApi.Resolvers { public static class SnapshotApiResolver { - public static readonly System.Lazy> AvailableVersions = - new System.Lazy>(LoadVersions, LazyThreadSafetyMode.ExecutionAndPublication); + public static readonly Lazy> AvailableVersions = + new(LoadVersions, LazyThreadSafetyMode.ExecutionAndPublication); private static Regex PackageProductRegex { get; } = new Regex(@"(.*?)-(\d+\.\d+\.\d+(?:-(?:SNAPSHOT|alpha\d+|beta\d+|rc\d+))?)"); diff --git a/src/Nest.TypescriptExporter/Nest.TypescriptExporter.csproj b/src/Nest.TypescriptExporter/Nest.TypescriptExporter.csproj index da98198..e534a8d 100644 --- a/src/Nest.TypescriptExporter/Nest.TypescriptExporter.csproj +++ b/src/Nest.TypescriptExporter/Nest.TypescriptExporter.csproj @@ -11,6 +11,6 @@ - + \ No newline at end of file