From 2d13ddb8413de1e1f16dd5edce8dd5893ab3acf2 Mon Sep 17 00:00:00 2001 From: Simon Foster Date: Fri, 10 Feb 2023 13:08:48 +0000 Subject: [PATCH 1/8] Update README.md (#48) typo in the code example --- src/Elastic.Elasticsearch.Xunit/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Elastic.Elasticsearch.Xunit/README.md b/src/Elastic.Elasticsearch.Xunit/README.md index 8b6af35..e25a768 100644 --- a/src/Elastic.Elasticsearch.Xunit/README.md +++ b/src/Elastic.Elasticsearch.Xunit/README.md @@ -78,7 +78,7 @@ public class ExampleTest : IClusterFixture var settings = new ConnectionSettings(connectionPool) .EnableDebugMode(); return new ElasticClient(settings); - ); + }); } private ElasticClient Client { get; } From ac3772d82300a6e900b996fa1711922e2f9db013 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Fri, 30 Jun 2023 11:34:54 +0200 Subject: [PATCH 2/8] Update Github Actions to ubuntu-latest (#49) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f3aa45..7dba5dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ on: jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: From 9d88cf66c8a26a5fa38b0d246c9a038f1a912a8d Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Fri, 30 Jun 2023 11:43:10 +0200 Subject: [PATCH 3/8] Don't error when warnings are written over stderr (#54) --- .../Tasks/IClusterComposeTask.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Elastic.Elasticsearch.Ephemeral/Tasks/IClusterComposeTask.cs b/src/Elastic.Elasticsearch.Ephemeral/Tasks/IClusterComposeTask.cs index d13e990..52c39c0 100644 --- a/src/Elastic.Elasticsearch.Ephemeral/Tasks/IClusterComposeTask.cs +++ b/src/Elastic.Elasticsearch.Ephemeral/Tasks/IClusterComposeTask.cs @@ -184,9 +184,13 @@ private static void ExecuteBinaryInternal(EphemeralClusterConfiguration config, if (errorOut.Any() && config.Version < "5.2.0") errorOut = errorOut.Where(e => !e.Line.Contains("No log4j2 configuration file found")).ToList(); - if (errorOut.Any(e => - !string.IsNullOrWhiteSpace(e.Line) && !e.Line.Contains("usage of JAVA_HOME is deprecated")) && - !binary.Contains("plugin") && !binary.Contains("cert")) + errorOut = errorOut + .Where(e => !string.IsNullOrWhiteSpace(e.Line)) + .Where(e => !e.Line.Contains("usage of JAVA_HOME is deprecated")) + .Where(e => !e.Line.Trim().StartsWith("warning:")) + .ToList(); + + if (errorOut.Any() && !binary.Contains("plugin") && !binary.Contains("cert")) throw new Exception( $"Received error out with exitCode ({result.ExitCode}) while executing {description}: {command}"); From 8ce99ed7123fbb03c84767846231339027c8eeae Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Fri, 30 Jun 2023 11:43:24 +0200 Subject: [PATCH 4/8] bump to net6 and net462 (#55) --- examples/Elastic.Managed.Example/Elastic.Managed.Example.csproj | 2 +- .../Elastic.Xunit.ExampleComplex.csproj | 2 +- .../Elastic.Xunit.ExampleMinimal.csproj | 2 +- examples/Elastic.Xunit.ExampleMinimal/ExampleTest.cs | 2 +- examples/ScratchPad/ScratchPad.csproj | 2 +- global.json | 2 +- .../Elastic.Elasticsearch.Ephemeral.csproj | 2 +- .../Elastic.Elasticsearch.Managed.csproj | 2 +- .../Elastic.Elasticsearch.Xunit.csproj | 2 +- .../Elastic.Stack.ArtifactsApi.csproj | 2 +- src/Nest.TypescriptExporter/Nest.TypescriptExporter.csproj | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/Elastic.Managed.Example/Elastic.Managed.Example.csproj b/examples/Elastic.Managed.Example/Elastic.Managed.Example.csproj index 778ede3..cc1f68c 100644 --- a/examples/Elastic.Managed.Example/Elastic.Managed.Example.csproj +++ b/examples/Elastic.Managed.Example/Elastic.Managed.Example.csproj @@ -2,7 +2,7 @@ Exe - net5.0 + net6.0 False diff --git a/examples/Elastic.Xunit.ExampleComplex/Elastic.Xunit.ExampleComplex.csproj b/examples/Elastic.Xunit.ExampleComplex/Elastic.Xunit.ExampleComplex.csproj index dedea61..25d4ff8 100644 --- a/examples/Elastic.Xunit.ExampleComplex/Elastic.Xunit.ExampleComplex.csproj +++ b/examples/Elastic.Xunit.ExampleComplex/Elastic.Xunit.ExampleComplex.csproj @@ -1,6 +1,6 @@ - net5.0;net461 + net6.0;net462 False diff --git a/examples/Elastic.Xunit.ExampleMinimal/Elastic.Xunit.ExampleMinimal.csproj b/examples/Elastic.Xunit.ExampleMinimal/Elastic.Xunit.ExampleMinimal.csproj index a96d86e..de16926 100644 --- a/examples/Elastic.Xunit.ExampleMinimal/Elastic.Xunit.ExampleMinimal.csproj +++ b/examples/Elastic.Xunit.ExampleMinimal/Elastic.Xunit.ExampleMinimal.csproj @@ -1,6 +1,6 @@ - net5.0;net461 + net6.0;net462 False diff --git a/examples/Elastic.Xunit.ExampleMinimal/ExampleTest.cs b/examples/Elastic.Xunit.ExampleMinimal/ExampleTest.cs index 5d0f410..0b44131 100644 --- a/examples/Elastic.Xunit.ExampleMinimal/ExampleTest.cs +++ b/examples/Elastic.Xunit.ExampleMinimal/ExampleTest.cs @@ -37,7 +37,7 @@ public ExampleTest(MyTestCluster cluster) => // 2) We do not want Elastic.Elasticsearch.Xunit to depend on NEST. Elastic.Elasticsearch.Xunit can start 2.x, 5.x and 6.x clusters // and NEST Major.x is only tested and supported against Elasticsearch Major.x. // - Client = cluster.GetOrAddClient(c => + Client = cluster.GetOrAddClient(c => { var nodes = cluster.NodesUris(); var connectionPool = new StaticConnectionPool(nodes); diff --git a/examples/ScratchPad/ScratchPad.csproj b/examples/ScratchPad/ScratchPad.csproj index 7462b94..cef057c 100644 --- a/examples/ScratchPad/ScratchPad.csproj +++ b/examples/ScratchPad/ScratchPad.csproj @@ -1,7 +1,7 @@  Exe - net5.0 + net6.0 False diff --git a/global.json b/global.json index a3c9d40..c317b00 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.408", + "version": "6.0.302", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/src/Elastic.Elasticsearch.Ephemeral/Elastic.Elasticsearch.Ephemeral.csproj b/src/Elastic.Elasticsearch.Ephemeral/Elastic.Elasticsearch.Ephemeral.csproj index d0c2cae..2a1477a 100644 --- a/src/Elastic.Elasticsearch.Ephemeral/Elastic.Elasticsearch.Ephemeral.csproj +++ b/src/Elastic.Elasticsearch.Ephemeral/Elastic.Elasticsearch.Ephemeral.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net461 + netstandard2.0;net462 Provides an EphemeralCluster implementation that can download/bootstrap/run a throwaway customizable Elasticsearch cluster elastic,elasticsearch,cluster,ephemeral diff --git a/src/Elastic.Elasticsearch.Managed/Elastic.Elasticsearch.Managed.csproj b/src/Elastic.Elasticsearch.Managed/Elastic.Elasticsearch.Managed.csproj index ba7a1ed..5dd1bbb 100644 --- a/src/Elastic.Elasticsearch.Managed/Elastic.Elasticsearch.Managed.csproj +++ b/src/Elastic.Elasticsearch.Managed/Elastic.Elasticsearch.Managed.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net461 + netstandard2.0;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 diff --git a/src/Elastic.Elasticsearch.Xunit/Elastic.Elasticsearch.Xunit.csproj b/src/Elastic.Elasticsearch.Xunit/Elastic.Elasticsearch.Xunit.csproj index 3b6ae34..9877920 100644 --- a/src/Elastic.Elasticsearch.Xunit/Elastic.Elasticsearch.Xunit.csproj +++ b/src/Elastic.Elasticsearch.Xunit/Elastic.Elasticsearch.Xunit.csproj @@ -1,6 +1,6 @@  - netstandard2.0;netstandard2.1;net461 + netstandard2.0;netstandard2.1;net462 True Provides an Xunit test framework allowing you to run integration tests against local ephemeral Elasticsearch clusters elastic,elasticsearch,xunit,cluster,integration,test,ephemeral diff --git a/src/Elastic.Stack.ArtifactsApi/Elastic.Stack.ArtifactsApi.csproj b/src/Elastic.Stack.ArtifactsApi/Elastic.Stack.ArtifactsApi.csproj index 962abdf..02bfc9f 100644 --- a/src/Elastic.Stack.ArtifactsApi/Elastic.Stack.ArtifactsApi.csproj +++ b/src/Elastic.Stack.ArtifactsApi/Elastic.Stack.ArtifactsApi.csproj @@ -1,6 +1,6 @@  - netstandard2.0;net461 + netstandard2.0;net462 Provides a set of classes to resolve the location of Elastic stack products in various stages: released, snapshot and build candidates elastic,elasticsearch,stack,versioning,artifacts diff --git a/src/Nest.TypescriptExporter/Nest.TypescriptExporter.csproj b/src/Nest.TypescriptExporter/Nest.TypescriptExporter.csproj index f34599c..da98198 100644 --- a/src/Nest.TypescriptExporter/Nest.TypescriptExporter.csproj +++ b/src/Nest.TypescriptExporter/Nest.TypescriptExporter.csproj @@ -1,7 +1,7 @@  Exe - net5.0 + net6.0 False False From 5fd0c20b703b6458ba071c5db733ddc9be9e020a Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Fri, 30 Jun 2023 13:17:54 +0200 Subject: [PATCH 5/8] Added ephemeral example (#53) --- .github/workflows/ci.yml | 7 ++++--- Directory.Build.props | 2 +- Elastic.Abstractions.sln | 7 +++++++ build/scripts/Targets.fs | 2 +- build/scripts/scripts.fsproj | 2 +- dotnet-tools.json | 8 ++++---- .../Elastic.Ephemeral.Example.csproj | 15 +++++++++++++++ examples/Elastic.Ephemeral.Example/Program.cs | 9 +++++++++ 8 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 examples/Elastic.Ephemeral.Example/Elastic.Ephemeral.Example.csproj create mode 100644 examples/Elastic.Ephemeral.Example/Program.cs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7dba5dc..e18c5fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,10 +25,11 @@ jobs: git fetch --prune --unshallow --tags echo exit code $? git tag --list - - uses: actions/setup-dotnet@v1 + + # Install .NET version as mandated by global.json + - uses: actions/setup-dotnet@v3 with: - dotnet-version: '5.0.408' - source-url: https://nuget.pkg.github.com/elastic/index.json + global-json-file: global.json env: NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/Directory.Build.props b/Directory.Build.props index 7b8bd0a..53d0449 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,6 +9,6 @@ - + \ No newline at end of file diff --git a/Elastic.Abstractions.sln b/Elastic.Abstractions.sln index a1e0e9f..9cada97 100644 --- a/Elastic.Abstractions.sln +++ b/Elastic.Abstractions.sln @@ -43,6 +43,8 @@ ProjectSection(SolutionItems) = preProject .github\workflows\ci.yml = .github\workflows\ci.yml EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Ephemeral.Example", "examples\Elastic.Ephemeral.Example\Elastic.Ephemeral.Example.csproj", "{9666AFDC-B0E8-489C-A25A-17E67303A969}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -62,6 +64,7 @@ Global {80DE8673-CB3E-4D0B-99F4-A5CECF6BE752} = {77E78EDE-60D5-469A-B431-443A7966A243} {C05F7B36-EEF7-4BCD-86A2-F5F1BB8CFEB9} = {77E78EDE-60D5-469A-B431-443A7966A243} {D6997ADC-E933-418E-831C-DE1A78897493} = {F75ACC18-D314-4F1F-88A3-2002EAC4E207} + {9666AFDC-B0E8-489C-A25A-17E67303A969} = {9D154338-4AA8-40A9-A378-B27C05D45791} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {AFADDCED-A7DD-43E7-B03C-27F57AC5C358} @@ -107,5 +110,9 @@ Global {80DE8673-CB3E-4D0B-99F4-A5CECF6BE752}.Debug|Any CPU.Build.0 = Debug|Any CPU {80DE8673-CB3E-4D0B-99F4-A5CECF6BE752}.Release|Any CPU.ActiveCfg = Release|Any CPU {80DE8673-CB3E-4D0B-99F4-A5CECF6BE752}.Release|Any CPU.Build.0 = Release|Any CPU + {9666AFDC-B0E8-489C-A25A-17E67303A969}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9666AFDC-B0E8-489C-A25A-17E67303A969}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9666AFDC-B0E8-489C-A25A-17E67303A969}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9666AFDC-B0E8-489C-A25A-17E67303A969}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/build/scripts/Targets.fs b/build/scripts/Targets.fs index 331d677..59ee764 100644 --- a/build/scripts/Targets.fs +++ b/build/scripts/Targets.fs @@ -21,7 +21,7 @@ let private restoreTools = lazy(exec "dotnet" ["tool"; "restore"]) let private currentVersion = lazy( restoreTools.Value |> ignore - let r = Proc.Start("dotnet", "minver", "-d", "canary", "-m", "0.1") + let r = Proc.Start("dotnet", "minver", "-d=canary", "-m=0.1", "-v=e") let o = r.ConsoleOut |> Seq.find (fun l -> not(l.Line.StartsWith("MinVer:"))) o.Line ) diff --git a/build/scripts/scripts.fsproj b/build/scripts/scripts.fsproj index b0377d4..5220347 100644 --- a/build/scripts/scripts.fsproj +++ b/build/scripts/scripts.fsproj @@ -2,7 +2,7 @@ Exe - net5.0 + net6.0 false diff --git a/dotnet-tools.json b/dotnet-tools.json index 6da0302..bd0c010 100644 --- a/dotnet-tools.json +++ b/dotnet-tools.json @@ -3,25 +3,25 @@ "isRoot": true, "tools": { "minver-cli": { - "version": "2.3.1", + "version": "4.3.0", "commands": [ "minver" ] }, "assembly-differ": { - "version": "0.13.0", + "version": "0.14.0", "commands": [ "assembly-differ" ] }, "release-notes": { - "version": "0.3.0", + "version": "0.5.2", "commands": [ "release-notes" ] }, "nupkg-validator": { - "version": "0.4.0", + "version": "0.5.0", "commands": [ "nupkg-validator" ] diff --git a/examples/Elastic.Ephemeral.Example/Elastic.Ephemeral.Example.csproj b/examples/Elastic.Ephemeral.Example/Elastic.Ephemeral.Example.csproj new file mode 100644 index 0000000..3745a2f --- /dev/null +++ b/examples/Elastic.Ephemeral.Example/Elastic.Ephemeral.Example.csproj @@ -0,0 +1,15 @@ + + + + Exe + net6.0 + enable + enable + False + + + + + + + diff --git a/examples/Elastic.Ephemeral.Example/Program.cs b/examples/Elastic.Ephemeral.Example/Program.cs new file mode 100644 index 0000000..f4cdb1c --- /dev/null +++ b/examples/Elastic.Ephemeral.Example/Program.cs @@ -0,0 +1,9 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// 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.Ephemeral; + +var config = new EphemeralClusterConfiguration("8.7.0"); +var cluster = new EphemeralCluster(config); +using var started = cluster.Start(); From df502528eec0fdd9cd31d638c5a3cf03c261f89e Mon Sep 17 00:00:00 2001 From: Brendon Page Date: Fri, 30 Jun 2023 17:21:32 +0400 Subject: [PATCH 6/8] Added support for version >= 8.0.0 (#46) Co-authored-by: Martijn Laarman --- examples/Elastic.Ephemeral.Example/Program.cs | 14 +++- .../EphemeralFileSystem.cs | 1 + .../XPack/GenerateCertificatesTask.cs | 64 ++++++++++++++----- .../Tasks/IClusterComposeTask.cs | 1 + 4 files changed, 61 insertions(+), 19 deletions(-) diff --git a/examples/Elastic.Ephemeral.Example/Program.cs b/examples/Elastic.Ephemeral.Example/Program.cs index f4cdb1c..5d03b9b 100644 --- a/examples/Elastic.Ephemeral.Example/Program.cs +++ b/examples/Elastic.Ephemeral.Example/Program.cs @@ -3,7 +3,17 @@ // See the LICENSE file in the project root for more information using Elastic.Elasticsearch.Ephemeral; +using static Elastic.Elasticsearch.Ephemeral.ClusterFeatures; -var config = new EphemeralClusterConfiguration("8.7.0"); -var cluster = new EphemeralCluster(config); + +var config = new EphemeralClusterConfiguration("8.7.0", XPack | Security | SSL); +using var cluster = new EphemeralCluster(config); + +var exitEvent = new ManualResetEvent(false); +Console.CancelKeyPress += (sender, eventArgs) => { + cluster.Dispose(); + eventArgs.Cancel = true; + exitEvent.Set(); +}; using var started = cluster.Start(); +exitEvent.WaitOne(); diff --git a/src/Elastic.Elasticsearch.Ephemeral/EphemeralFileSystem.cs b/src/Elastic.Elasticsearch.Ephemeral/EphemeralFileSystem.cs index 6551fee..15acaa7 100644 --- a/src/Elastic.Elasticsearch.Ephemeral/EphemeralFileSystem.cs +++ b/src/Elastic.Elasticsearch.Ephemeral/EphemeralFileSystem.cs @@ -32,6 +32,7 @@ public EphemeralFileSystem(ElasticVersion version, string clusterName) : base(ve public string CertificatesPath => Path.Combine(ConfigPath, CertificateFolderName); public string CaCertificate => Path.Combine(CertificatesPath, "ca", "ca") + ".crt"; + public string CaPrivateKey => Path.Combine(CertificatesPath, "ca", "ca") + ".key"; public string NodePrivateKey => Path.Combine(CertificatesPath, CertificateNodeName, CertificateNodeName) + ".key"; diff --git a/src/Elastic.Elasticsearch.Ephemeral/Tasks/BeforeStartNodeTasks/XPack/GenerateCertificatesTask.cs b/src/Elastic.Elasticsearch.Ephemeral/Tasks/BeforeStartNodeTasks/XPack/GenerateCertificatesTask.cs index da7a0c2..c8a6b0a 100644 --- a/src/Elastic.Elasticsearch.Ephemeral/Tasks/BeforeStartNodeTasks/XPack/GenerateCertificatesTask.cs +++ b/src/Elastic.Elasticsearch.Ephemeral/Tasks/BeforeStartNodeTasks/XPack/GenerateCertificatesTask.cs @@ -2,6 +2,7 @@ // 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 System; using System.IO; using System.IO.Compression; using System.Linq; @@ -39,6 +40,12 @@ public override void Run(IEphemeralCluster cluste if (!cluster.ClusterConfiguration.EnableSsl) return; var config = cluster.ClusterConfiguration; + + if (Directory.Exists(config.FileSystem.CertificatesPath)) + { + cluster.Writer.WriteDiagnostic($"{{{nameof(GenerateCertificatesTask)}}} Skipping certificate generation as ${{{config.FileSystem.CertificatesPath}}} already exists"); + return; + } var fileSystem = cluster.FileSystem; //due to a bug in certgen this file needs to live in two places @@ -80,7 +87,12 @@ private static void GenerateCertificates(IEphemeralCluster GenerateCaCertificate(config, zipLocation, writer), + "8.0.0"); + NewOrCachedCertificates(cluster, name, path, writer, + zipLocation => GenerateCertificate(config, name, path, zipLocation, silentModeConfigFile, writer) + ); } private static void GenerateUnusedCertificates(IEphemeralCluster cluster, @@ -89,16 +101,23 @@ private static void GenerateUnusedCertificates(IEphemeralCluster GenerateCaCertificate(config, zipLocation, writer), + "8.0.0"); + NewOrCachedCertificates(cluster, name, path, writer, + zipLocation => GenerateCertificate(config, name, path, zipLocation, silentModeConfigFile, writer) + ); } private static void NewOrCachedCertificates(IEphemeralCluster cluster, - string name, string path, string silentModeConfigFile, IConsoleLineHandler writer) + string name, string path, IConsoleLineHandler writer, Action generateCertificateAction, string minVersion = null) { var config = cluster.ClusterConfiguration; var cachedEsHomeFolder = Path.Combine(config.FileSystem.LocalFolder, cluster.GetCacheFolderName()); var zipLocationCache = Path.Combine(cachedEsHomeFolder, name) + ".zip"; + if (minVersion != null && config.Version < minVersion) return; + if (File.Exists(zipLocationCache)) { writer.WriteDiagnostic( @@ -110,7 +129,7 @@ private static void NewOrCachedCertificates(IEphemeralCluster= "6.3.0" ? Path.Combine(config.FileSystem.ConfigPath, name) + ".zip" : Path.Combine(config.FileSystem.ConfigPath, "x-pack", name) + ".zip"; - GenerateCertificate(config, name, path, zipLocation, silentModeConfigFile, writer); + generateCertificateAction(zipLocation); if (!File.Exists(zipLocationCache)) { @@ -133,17 +152,17 @@ private static void GenerateCertificate(EphemeralClusterConfiguration config, st : Path.Combine(fs.ElasticsearchHome, "bin", "elasticsearch-certutil") + BinarySuffix : Path.Combine(fs.ElasticsearchHome, "bin", "x-pack", "certgen") + BinarySuffix; - - if (!Directory.Exists(path)) - { - if (config.Version < "7.0.0") - ExecuteBinary(config, writer, binary, "generating ssl certificates for this session", - "-in", silentModeConfigFile, "-out", @out); - else - ExecuteBinary(config, writer, binary, "generating ssl certificates for this session", - "cert", - "-in", silentModeConfigFile, "-out", @out); - } + if (config.Version < "7.0.0") + ExecuteBinary(config, writer, binary, "generating ssl certificates for this session", + "-in", silentModeConfigFile, "-out", @out); + else if (config.Version < "8.0.0") + ExecuteBinary(config, writer, binary, "generating ssl certificates for this session", + "cert", + "--in", silentModeConfigFile, "--out", @out); + else + ExecuteBinary(config, writer, binary, "generating ssl certificates for this session", + "cert", "--pem", + "--in", silentModeConfigFile, "--out", @out, "--ca-cert", fs.CaCertificate, "--ca-key", fs.CaPrivateKey); var badLocation = Path.Combine(config.FileSystem.ElasticsearchHome, "config", "x-pack", @out); //not necessary anymore now that we patch .in.bat i think @@ -154,14 +173,25 @@ private static void GenerateCertificate(EphemeralClusterConfiguration config, st } } + private static void GenerateCaCertificate(EphemeralClusterConfiguration config, + string zipLocation, IConsoleLineHandler writer) + { + if (config.Version < "8.0.0") return; + + var binary = Path.Combine(config.FileSystem.ElasticsearchHome, "bin", "elasticsearch-certutil") + BinarySuffix; + + ExecuteBinary(config, writer, binary, "generating CA certificate for this session", + "ca", "--pem", "--out", zipLocation); + } + private static void UnpackCertificatesZip(string zipLocation, string outFolder, IConsoleLineHandler writer) { - if (Directory.Exists(outFolder)) return; - writer.WriteDiagnostic($"{{{nameof(GenerateCertificatesTask)}}} unzipping certificates to {outFolder}"); Directory.CreateDirectory(outFolder); + ZipFile.ExtractToDirectory(zipLocation, outFolder); + } } } diff --git a/src/Elastic.Elasticsearch.Ephemeral/Tasks/IClusterComposeTask.cs b/src/Elastic.Elasticsearch.Ephemeral/Tasks/IClusterComposeTask.cs index 52c39c0..ebfdbf6 100644 --- a/src/Elastic.Elasticsearch.Ephemeral/Tasks/IClusterComposeTask.cs +++ b/src/Elastic.Elasticsearch.Ephemeral/Tasks/IClusterComposeTask.cs @@ -187,6 +187,7 @@ private static void ExecuteBinaryInternal(EphemeralClusterConfiguration config, errorOut = errorOut .Where(e => !string.IsNullOrWhiteSpace(e.Line)) .Where(e => !e.Line.Contains("usage of JAVA_HOME is deprecated")) + .Where(e => !e.Line.Contains("using ES_JAVA_HOME")) .Where(e => !e.Line.Trim().StartsWith("warning:")) .ToList(); From d1417d841337c379242a6bccb7a970f9deb9c3d9 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Fri, 30 Jun 2023 15:23:30 +0200 Subject: [PATCH 7/8] remove bad argument to github push to github pacakge repo (#56) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e18c5fa..c5eddf0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: until dotnet nuget push 'build/output/*.nupkg' -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate --no-symbols true; do echo "Retrying"; sleep 1; done; # Github packages requires authentication, this is likely going away in the future so for now we publish to feedz.io - - run: dotnet nuget push 'build/output/*.nupkg' -k ${{secrets.FEEDZ_IO_API_KEY}} -s https://f.feedz.io/elastic/all/nuget/index.json --skip-duplicate --no-symbols true + - run: dotnet nuget push 'build/output/*.nupkg' -k ${{secrets.FEEDZ_IO_API_KEY}} -s https://f.feedz.io/elastic/all/nuget/index.json --skip-duplicate --no-symbols name: publish canary packages to feedz.io if: github.event_name == 'push' && startswith(github.ref, 'refs/heads') From 169a5a0be36d5fa1769dda9bb76c0dde26980fa8 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Fri, 30 Jun 2023 15:30:59 +0200 Subject: [PATCH 8/8] fix github package repos push (#57) --- .github/workflows/ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5eddf0..510378f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,8 +45,10 @@ jobs: - name: publish canary packages github package repository if: github.event_name == 'push' && startswith(github.ref, 'refs/heads') shell: bash - run: | - until dotnet nuget push 'build/output/*.nupkg' -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate --no-symbols true; do echo "Retrying"; sleep 1; done; + timeout-minutes: 10 + continue-on-error: true + run: | + until dotnet nuget push 'build/output/*.nupkg' -k ${{secrets.GITHUB_TOKEN}} --skip-duplicate --no-symbols -s https://nuget.pkg.github.com/elastic/index.json; do echo "Retrying"; sleep 1; done; # Github packages requires authentication, this is likely going away in the future so for now we publish to feedz.io - run: dotnet nuget push 'build/output/*.nupkg' -k ${{secrets.FEEDZ_IO_API_KEY}} -s https://f.feedz.io/elastic/all/nuget/index.json --skip-duplicate --no-symbols @@ -60,6 +62,6 @@ jobs: if: github.event_name == 'push' && startswith(github.ref, 'refs/tags') name: Create or update release for tag on github - - run: dotnet nuget push 'build/output/*.nupkg' -k ${{secrets.NUGET_ORG_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols true + - run: dotnet nuget push 'build/output/*.nupkg' -k ${{secrets.NUGET_ORG_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols name: release to nuget.org if: github.event_name == 'push' && startswith(github.ref, 'refs/tags')