Skip to content

Feature/7.x/upgrade helper #3822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jun 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
es71:
esVersion: '7.1.0'
steps:
- script: 'build.bat integrate $(esVersion) "readonly,writable,bool,xpack" skipdocs'
- script: 'build.bat integrate-one $(esVersion) "readonly,writable,bool,xpack" skipdocs'
displayName: '$(esVersion) windows integration tests'
- task: PublishTestResults@2
condition: succeededOrFailed()
Expand All @@ -54,7 +54,7 @@ jobs:
es7:
esVersion: '7.0.0'
steps:
- script: './build.sh integrate $(esVersion) "readonly,writable" skipdocs'
- script: './build.sh integrate-one $(esVersion) "readonly,writable" skipdocs'
displayName: '$(esVersion) linux integration tests'
- task: PublishTestResults@2
condition: succeededOrFailed()
Expand Down
29 changes: 29 additions & 0 deletions build/NEST.7xUpgradeAssistant.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>NEST.7xUpgradeAssistant</id>
<version>$version$</version>
<title>NEST - 7.x upgrade helper</title>
<authors>Elastic and contributors</authors>
<owners>Elastic</owners>
<copyright>2014-$year$ Elasticsearch BV</copyright>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="file">license.txt</license>
<projectUrl>https://github.com/elastic/elasticsearch-net</projectUrl>
<iconUrl>https://raw.githubusercontent.com/elastic/elasticsearch-net/master/build/nuget-icon.png</iconUrl>
<description>NEST 7.0 introduces namespaces on the client, this temporarily reintroduces removed methods on the client with instructions on how to upgrade</description>
<summary>NEST 7.0 introduces namespaces on the client, this temporarily reintroduces removed methods on the client with instructions on how to upgrade</summary>
<releaseNotes>https://github.com/elastic/elasticsearch-net/releases/tag/$version$</releaseNotes>
<tags>elasticsearch,elastic,search,lucene,nest</tags>
<dependencies>
<group targetFramework=".NETStandard2.0">
<dependency id="NEST" version="[$version$, $nextMajorVersion$)" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\license.txt" target="" />
<file src="output\Nest.7xUpgradeAssistant\netstandard2.0\Nest.7xUpgradeAssistant.dll" target="lib\netstandard2.0"/>
<file src="output\Nest.7xUpgradeAssistant\netstandard2.0\Nest.7xUpgradeAssistant.xml" target="lib\netstandard2.0"/>
</files>
</package>
8 changes: 7 additions & 1 deletion build/scripts/Projects.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ module Projects =
| NetStandard2_0
| Net461
| NetCoreApp2_1
static member All = [NetStandard2_0; Net461]
static member All = [NetStandard2_0; Net461]
static member AllTests = [NetCoreApp2_1; Net461]
member this.Identifier =
match this with
| NetStandard2_0 -> { MSBuild = "netstandard2.0"; Nuget = "netstandard2.0"; DefineConstants = ""; }
Expand All @@ -19,6 +20,7 @@ module Projects =
| Nest
| ElasticsearchNet
| NestJsonNetSerializer
| NestUpgradeAssistant

type PrivateProject =
| Tests
Expand All @@ -38,6 +40,7 @@ module Projects =
Project Project.ElasticsearchNet;
Project Project.Nest;
Project Project.NestJsonNetSerializer;
Project Project.NestUpgradeAssistant;
PrivateProject PrivateProject.Tests
]

Expand All @@ -46,6 +49,7 @@ module Projects =
Project Project.ElasticsearchNet;
Project Project.Nest;
Project Project.NestJsonNetSerializer;
Project Project.NestUpgradeAssistant;
]
static member Tests = seq [PrivateProject PrivateProject.Tests]

Expand All @@ -66,6 +70,7 @@ module Projects =
| Project Nest -> "Nest"
| Project ElasticsearchNet -> "Elasticsearch.Net"
| Project NestJsonNetSerializer -> "Nest.JsonNetSerializer"
| Project NestUpgradeAssistant -> "Nest.7xUpgradeAssistant"
| PrivateProject Tests -> "Tests"
| PrivateProject DocGenerator -> "DocGenerator"
| PrivateProject ApiGenerator -> "ApiGenerator"
Expand All @@ -75,6 +80,7 @@ module Projects =
match this with
| Project Nest -> "NEST"
| Project NestJsonNetSerializer -> "NEST.JsonNetSerializer"
| Project NestUpgradeAssistant -> "NEST.7xUpgradeAssistant"
| _ -> this.Name

member this.NeedsMerge = match this with | Project NestJsonNetSerializer -> false | _ -> true
Expand Down
10 changes: 9 additions & 1 deletion build/scripts/Releasing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module Release =
let private nugetPackMain (_:DotNetProject) nugetId nuspec properties version =
pack nuspec nugetId properties version

let private nugetPackVersioned (p:DotNetProject) nugetId nuspec properties version =
let private nugetPackVersionedUnfiltered (p:DotNetProject) nugetId nuspec properties version =
let currentMajorVersion = currentMajorVersion version
let newId = sprintf "%s.v%s" nugetId currentMajorVersion;
let nuspecVersioned = sprintf @"build/%s.nuspec" newId
Expand Down Expand Up @@ -107,6 +107,7 @@ module Release =
| Project ElasticsearchNet ->
rewriteDllFile p.Name
ignore()
| Project NestUpgradeAssistant
| Project NestJsonNetSerializer ->
let nestDeps = doc.XPathSelectElements("/x:package/x:metadata//x:dependency[@id='NEST']", nsManager);
nestDeps |> Seq.iter (fun e ->
Expand Down Expand Up @@ -140,6 +141,13 @@ module Release =

callback p nugetId nuspec properties version
)

let private nugetPackVersioned (p:DotNetProject) nugetId nuspec properties version =
match p with
| Project NestUpgradeAssistant ->
printfn "Skipping %s from building a versioned nightly" p.Name
ignore()
| _ -> nugetPackVersionedUnfiltered p nugetId nuspec properties version

let NugetPack (ArtifactsVersion(version)) = packProjects version nugetPackMain

Expand Down
7 changes: 5 additions & 2 deletions build/scripts/Testing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ module Tests =
let p = ["test"; "."; "-c"; "RELEASE"]
//make sure we only test netcoreapp on linux or requested on the command line to only test-one
match (target, Environment.isLinux) with
| (_, true)
| (Commandline.MultiTarget.One, _) -> ["--framework"; "netcoreapp2.1"] |> List.append p
| (_, true) -> ["--framework"; "netcoreapp2.1"] |> List.append p
| (Commandline.MultiTarget.One, _) ->
let random = new Random()
let fw = DotNetFramework.AllTests |> List.sortBy (fun _ -> random.Next()) |> List.head
["--framework"; fw.Identifier.MSBuild] |> List.append p
| _ -> p
let commandWithCodeCoverage =
// TODO /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
Expand Down
10 changes: 7 additions & 3 deletions build/scripts/Versioning.fs
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,20 @@ module Versioning =
let sn = sn ()
let out = Tooling.read sn ["-v"; dll;]

let valid = (out.ExitCode, out.Output |> Seq.findIndex(fun s -> s.Line.Contains("is valid")))
// Mono StrongName - version 5.18.1.0
// returns `is strongnamed`
let valid = (out.ExitCode, out.Output |> Seq.findIndex(fun s -> s.Line.Contains("is valid") || s.Line.Contains("is strongnamed")))
match valid with
| (0, i) when i >= 0 -> printfn "%s was signed correctly" name
| (_, _) -> failwithf "{0} was not validly signed"

let out = Tooling.read sn ["-T"; dll;]

let tokenMessage = (out.Output |> Seq.find(fun s -> s.Line.Contains("Public key token is")));
let tokenMessage = (out.Output |> Seq.find(fun s -> s.Line.Contains("Public key token", StringComparison.OrdinalIgnoreCase)));

let token = (tokenMessage.Line.Replace("Public key token is", "")).Trim();
// Mono StrongName - version 5.18.1.0
// returns `Key Token:`
let token = (tokenMessage.Line.Replace("Public Key Token:", "").Replace("Public key token is", "")).Trim();

let valid = (out.ExitCode, token)
match valid with
Expand Down
7 changes: 7 additions & 0 deletions src/Elasticsearch.sln
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ ProjectSection(SolutionItems) = preProject
..\build\NEST.nuspec = ..\build\NEST.nuspec
..\NuGet.config = ..\NuGet.config
..\build\Elasticsearch.Net.nuspec = ..\build\Elasticsearch.Net.nuspec
..\build\NEST.7xUpgradeAssistant.nuspec = ..\build\NEST.7xUpgradeAssistant.nuspec
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Markdown", "Markdown", "{2FABB663-F4DB-499A-89F8-3A08828D1D91}"
Expand All @@ -74,6 +75,8 @@ ProjectSection(SolutionItems) = preProject
..\readme.md = ..\readme.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nest.7xUpgradeAssistant", "Nest.7xUpgradeAssistant\Nest.7xUpgradeAssistant.csproj", "{B8B8C45A-22D3-4D1E-9A3A-C030997D5BF7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -158,5 +161,9 @@ Global
{D6997ADC-E933-418E-831C-DE1A78897493}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D6997ADC-E933-418E-831C-DE1A78897493}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D6997ADC-E933-418E-831C-DE1A78897493}.Release|Any CPU.Build.0 = Release|Any CPU
{B8B8C45A-22D3-4D1E-9A3A-C030997D5BF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B8B8C45A-22D3-4D1E-9A3A-C030997D5BF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B8B8C45A-22D3-4D1E-9A3A-C030997D5BF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B8B8C45A-22D3-4D1E-9A3A-C030997D5BF7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
32 changes: 32 additions & 0 deletions src/Nest.7xUpgradeAssistant/ElasticClient-AcknowledgeWatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Nest
{
public static partial class ElasticClientExtensions
{
[Obsolete("Moved to client.Watcher.Acknowledge(), please update this usage.")]
public static AcknowledgeWatchResponse AcknowledgeWatch(this IElasticClient client, Id id,
Func<AcknowledgeWatchDescriptor, IAcknowledgeWatchRequest> selector = null
)
=> client.Watcher.Acknowledge(id, selector);

[Obsolete("Moved to client.Watcher.Acknowledge(), please update this usage.")]
public static AcknowledgeWatchResponse AcknowledgeWatch(this IElasticClient client, IAcknowledgeWatchRequest request)
=> client.Watcher.Acknowledge(request);

[Obsolete("Moved to client.Watcher.AcknowledgeAsync(), please update this usage.")]
public static Task<AcknowledgeWatchResponse> AcknowledgeWatchAsync(this IElasticClient client, Id id,
Func<AcknowledgeWatchDescriptor, IAcknowledgeWatchRequest> selector = null,
CancellationToken ct = default
)
=> client.Watcher.AcknowledgeAsync(id, selector, ct);

[Obsolete("Moved to client.Watcher.AcknowledgeAsync(), please update this usage.")]
public static Task<AcknowledgeWatchResponse> AcknowledgeWatchAsync(this IElasticClient client, IAcknowledgeWatchRequest request,
CancellationToken ct = default
)
=> client.Watcher.AcknowledgeAsync(request, ct);
}
}
32 changes: 32 additions & 0 deletions src/Nest.7xUpgradeAssistant/ElasticClient-ActivateWatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Nest
{
public static partial class ElasticClientExtensions
{
[Obsolete("Moved to client.Watcher.Activate(), please update this usage.")]
public static ActivateWatchResponse ActivateWatch(this IElasticClient client, Id id,
Func<ActivateWatchDescriptor, IActivateWatchRequest> selector = null
)
=> client.Watcher.Activate(id, selector);

[Obsolete("Moved to client.Watcher.Activate(), please update this usage.")]
public static ActivateWatchResponse ActivateWatch(this IElasticClient client, IActivateWatchRequest request)
=> client.Watcher.Activate(request);

[Obsolete("Moved to client.Watcher.ActivateAsync(), please update this usage.")]
public static Task<ActivateWatchResponse> ActivateWatchAsync(this IElasticClient client, Id id,
Func<ActivateWatchDescriptor, IActivateWatchRequest> selector = null,
CancellationToken ct = default
)
=> client.Watcher.ActivateAsync(id, selector, ct);

[Obsolete("Moved to client.Watcher.ActivateAsync(), please update this usage.")]
public static Task<ActivateWatchResponse> ActivateWatchAsync(this IElasticClient client, IActivateWatchRequest request,
CancellationToken ct = default
)
=> client.Watcher.ActivateAsync(request, ct);
}
}
27 changes: 27 additions & 0 deletions src/Nest.7xUpgradeAssistant/ElasticClient-Alias.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Nest
{
public static partial class ElasticClientExtensions
{
[Obsolete("Moved to client.Indices.BulkAlias(), please update this usage.")]
public static BulkAliasResponse Alias(this IElasticClient client, Func<BulkAliasDescriptor, IBulkAliasRequest> selector)
=> client.Indices.BulkAlias(selector);

[Obsolete("Moved to client.Indices.BulkAlias(), please update this usage.")]
public static BulkAliasResponse Alias(this IElasticClient client, IBulkAliasRequest request)
=> client.Indices.BulkAlias(request);

[Obsolete("Moved to client.Indices.BulkAliasAsync(), please update this usage.")]
public static Task<BulkAliasResponse> AliasAsync(this IElasticClient client, Func<BulkAliasDescriptor, IBulkAliasRequest> selector,
CancellationToken ct = default
)
=> client.Indices.BulkAliasAsync(selector, ct);

[Obsolete("Moved to client.Indices.BulkAliasAsync(), please update this usage.")]
public static Task<BulkAliasResponse> AliasAsync(this IElasticClient client, IBulkAliasRequest request, CancellationToken ct = default)
=> client.Indices.BulkAliasAsync(request, ct);
}
}
34 changes: 34 additions & 0 deletions src/Nest.7xUpgradeAssistant/ElasticClient-AliasExists.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Elasticsearch.Net;

namespace Nest
{
using AliasExistConverter = Func<IApiCallDetails, Stream, ExistsResponse>;

public static partial class ElasticClientExtensions
{
[Obsolete("Moved to client.Indices.AliasExists(), please update this usage.")]
public static ExistsResponse AliasExists(this IElasticClient client, Names name,
Func<AliasExistsDescriptor, IAliasExistsRequest> selector = null
)
=> client.Indices.AliasExists(name, selector);

[Obsolete("Moved to client.Indices.AliasExists(), please update this usage.")]
public static ExistsResponse AliasExists(this IElasticClient client, IAliasExistsRequest request)
=> client.Indices.AliasExists(request);

[Obsolete("Moved to client.Indices.AliasExistsAsync(), please update this usage.")]
public static Task<ExistsResponse> AliasExistsAsync(this IElasticClient client, Names name,
Func<AliasExistsDescriptor, IAliasExistsRequest> selector = null,
CancellationToken ct = default
)
=> client.Indices.AliasExistsAsync(name, selector, ct);

[Obsolete("Moved to client.Indices.AliasExistsAsync(), please update this usage.")]
public static Task<ExistsResponse> AliasExistsAsync(this IElasticClient client, IAliasExistsRequest request, CancellationToken ct = default)
=> client.Indices.AliasExistsAsync(request, ct);
}
}
27 changes: 27 additions & 0 deletions src/Nest.7xUpgradeAssistant/ElasticClient-Analyze.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Nest
{
public static partial class ElasticClientExtensions
{
[Obsolete("Moved to client.Indices.Analyze(), please update this usage.")]
public static AnalyzeResponse Analyze(this IElasticClient client, Func<AnalyzeDescriptor, IAnalyzeRequest> selector)
=> client.Indices.Analyze(selector);

[Obsolete("Moved to client.Indices.Analyze(), please update this usage.")]
public static AnalyzeResponse Analyze(this IElasticClient client, IAnalyzeRequest request)
=> client.Indices.Analyze(request);

[Obsolete("Moved to client.Indices.AnalyzeAsync(), please update this usage.")]
public static Task<AnalyzeResponse> AnalyzeAsync(this IElasticClient client, Func<AnalyzeDescriptor, IAnalyzeRequest> selector,
CancellationToken ct = default
)
=> client.Indices.AnalyzeAsync(selector, ct);

[Obsolete("Moved to client.Indices.AnalyzeAsync(), please update this usage.")]
public static Task<AnalyzeResponse> AnalyzeAsync(this IElasticClient client, IAnalyzeRequest request, CancellationToken ct = default)
=> client.Indices.AnalyzeAsync(request, ct);
}
}
31 changes: 31 additions & 0 deletions src/Nest.7xUpgradeAssistant/ElasticClient-Authenticate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Nest
{
public static partial class ElasticClientExtensions
{
[Obsolete("Moved to client.Security.Authenticate(), please update this usage.")]
public static AuthenticateResponse Authenticate(this IElasticClient client, Func<AuthenticateDescriptor, IAuthenticateRequest> selector = null
)
=> client.Security.Authenticate(selector);

[Obsolete("Moved to client.Security.Authenticate(), please update this usage.")]
public static AuthenticateResponse Authenticate(this IElasticClient client, IAuthenticateRequest request)
=> client.Security.Authenticate(request);

[Obsolete("Moved to client.Security.AuthenticateAsync(), please update this usage.")]
public static Task<AuthenticateResponse> AuthenticateAsync(this IElasticClient client,
Func<AuthenticateDescriptor, IAuthenticateRequest> selector = null,
CancellationToken ct = default
)
=> client.Security.AuthenticateAsync(selector, ct);

[Obsolete("Moved to client.Security.AuthenticateAsync(), please update this usage.")]
public static Task<AuthenticateResponse> AuthenticateAsync(this IElasticClient client, IAuthenticateRequest request,
CancellationToken ct = default
)
=> client.Security.AuthenticateAsync(request, ct);
}
}
Loading