Skip to content

Commit cb23c2b

Browse files
authored
Feature/7.x/upgrade helper (#3822)
* stage commit * patched all methods through and started on obsolete attrs * remove stale comments and run code cleanup * made sure is cancellation token is passed along everywhere * Added upgrade helper to release * Fix linux sn quirks and path issues * introduce canary handling for the upgrade helper package * rename UpgradeHelper to UpgradeAssistant * Update nuspec files * remove migration helpers from assistance * On public CI integrate test a random .NET framework on windows * fix failing codestandard tests due to dynamicdictionary not exposing readonly collection, added as exception * don't need versioned CI builds for the upgrade helper' * allow nugetPackVersioned to skip certain projects, we don't need a version specific build for `Nest.7xUpgradeAssistant` its already version specific * remove upgrade/upgradestatus from upgrade assistant * constrain upgrade assistant package to < 8 * We introduced picking one framework at random when specifying -one which canary does but it sometimes selects netstandard2.0 which for tests is not a configured framework updated * remove double namespace inclussion * move previewdatafeed to TDOcument: class
1 parent 2585b20 commit cb23c2b

File tree

199 files changed

+6009
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+6009
-9
lines changed

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
es71:
3636
esVersion: '7.1.0'
3737
steps:
38-
- script: 'build.bat integrate $(esVersion) "readonly,writable,bool,xpack" skipdocs'
38+
- script: 'build.bat integrate-one $(esVersion) "readonly,writable,bool,xpack" skipdocs'
3939
displayName: '$(esVersion) windows integration tests'
4040
- task: PublishTestResults@2
4141
condition: succeededOrFailed()
@@ -54,7 +54,7 @@ jobs:
5454
es7:
5555
esVersion: '7.0.0'
5656
steps:
57-
- script: './build.sh integrate $(esVersion) "readonly,writable" skipdocs'
57+
- script: './build.sh integrate-one $(esVersion) "readonly,writable" skipdocs'
5858
displayName: '$(esVersion) linux integration tests'
5959
- task: PublishTestResults@2
6060
condition: succeededOrFailed()

build/NEST.7xUpgradeAssistant.nuspec

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
3+
<metadata>
4+
<id>NEST.7xUpgradeAssistant</id>
5+
<version>$version$</version>
6+
<title>NEST - 7.x upgrade helper</title>
7+
<authors>Elastic and contributors</authors>
8+
<owners>Elastic</owners>
9+
<copyright>2014-$year$ Elasticsearch BV</copyright>
10+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
11+
<license type="file">license.txt</license>
12+
<projectUrl>https://github.com/elastic/elasticsearch-net</projectUrl>
13+
<iconUrl>https://raw.githubusercontent.com/elastic/elasticsearch-net/master/build/nuget-icon.png</iconUrl>
14+
<description>NEST 7.0 introduces namespaces on the client, this temporarily reintroduces removed methods on the client with instructions on how to upgrade</description>
15+
<summary>NEST 7.0 introduces namespaces on the client, this temporarily reintroduces removed methods on the client with instructions on how to upgrade</summary>
16+
<releaseNotes>https://github.com/elastic/elasticsearch-net/releases/tag/$version$</releaseNotes>
17+
<tags>elasticsearch,elastic,search,lucene,nest</tags>
18+
<dependencies>
19+
<group targetFramework=".NETStandard2.0">
20+
<dependency id="NEST" version="[$version$, $nextMajorVersion$)" />
21+
</group>
22+
</dependencies>
23+
</metadata>
24+
<files>
25+
<file src="..\license.txt" target="" />
26+
<file src="output\Nest.7xUpgradeAssistant\netstandard2.0\Nest.7xUpgradeAssistant.dll" target="lib\netstandard2.0"/>
27+
<file src="output\Nest.7xUpgradeAssistant\netstandard2.0\Nest.7xUpgradeAssistant.xml" target="lib\netstandard2.0"/>
28+
</files>
29+
</package>

build/scripts/Projects.fs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ module Projects =
88
| NetStandard2_0
99
| Net461
1010
| NetCoreApp2_1
11-
static member All = [NetStandard2_0; Net461]
11+
static member All = [NetStandard2_0; Net461]
12+
static member AllTests = [NetCoreApp2_1; Net461]
1213
member this.Identifier =
1314
match this with
1415
| NetStandard2_0 -> { MSBuild = "netstandard2.0"; Nuget = "netstandard2.0"; DefineConstants = ""; }
@@ -19,6 +20,7 @@ module Projects =
1920
| Nest
2021
| ElasticsearchNet
2122
| NestJsonNetSerializer
23+
| NestUpgradeAssistant
2224

2325
type PrivateProject =
2426
| Tests
@@ -38,6 +40,7 @@ module Projects =
3840
Project Project.ElasticsearchNet;
3941
Project Project.Nest;
4042
Project Project.NestJsonNetSerializer;
43+
Project Project.NestUpgradeAssistant;
4144
PrivateProject PrivateProject.Tests
4245
]
4346

@@ -46,6 +49,7 @@ module Projects =
4649
Project Project.ElasticsearchNet;
4750
Project Project.Nest;
4851
Project Project.NestJsonNetSerializer;
52+
Project Project.NestUpgradeAssistant;
4953
]
5054
static member Tests = seq [PrivateProject PrivateProject.Tests]
5155

@@ -66,6 +70,7 @@ module Projects =
6670
| Project Nest -> "Nest"
6771
| Project ElasticsearchNet -> "Elasticsearch.Net"
6872
| Project NestJsonNetSerializer -> "Nest.JsonNetSerializer"
73+
| Project NestUpgradeAssistant -> "Nest.7xUpgradeAssistant"
6974
| PrivateProject Tests -> "Tests"
7075
| PrivateProject DocGenerator -> "DocGenerator"
7176
| PrivateProject ApiGenerator -> "ApiGenerator"
@@ -75,6 +80,7 @@ module Projects =
7580
match this with
7681
| Project Nest -> "NEST"
7782
| Project NestJsonNetSerializer -> "NEST.JsonNetSerializer"
83+
| Project NestUpgradeAssistant -> "NEST.7xUpgradeAssistant"
7884
| _ -> this.Name
7985

8086
member this.NeedsMerge = match this with | Project NestJsonNetSerializer -> false | _ -> true

build/scripts/Releasing.fs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ module Release =
6464
let private nugetPackMain (_:DotNetProject) nugetId nuspec properties version =
6565
pack nuspec nugetId properties version
6666

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

141142
callback p nugetId nuspec properties version
142143
)
144+
145+
let private nugetPackVersioned (p:DotNetProject) nugetId nuspec properties version =
146+
match p with
147+
| Project NestUpgradeAssistant ->
148+
printfn "Skipping %s from building a versioned nightly" p.Name
149+
ignore()
150+
| _ -> nugetPackVersionedUnfiltered p nugetId nuspec properties version
143151

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

build/scripts/Testing.fs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ module Tests =
4040
let p = ["test"; "."; "-c"; "RELEASE"]
4141
//make sure we only test netcoreapp on linux or requested on the command line to only test-one
4242
match (target, Environment.isLinux) with
43-
| (_, true)
44-
| (Commandline.MultiTarget.One, _) -> ["--framework"; "netcoreapp2.1"] |> List.append p
43+
| (_, true) -> ["--framework"; "netcoreapp2.1"] |> List.append p
44+
| (Commandline.MultiTarget.One, _) ->
45+
let random = new Random()
46+
let fw = DotNetFramework.AllTests |> List.sortBy (fun _ -> random.Next()) |> List.head
47+
["--framework"; fw.Identifier.MSBuild] |> List.append p
4548
| _ -> p
4649
let commandWithCodeCoverage =
4750
// TODO /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura

build/scripts/Versioning.fs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,20 @@ module Versioning =
109109
let sn = sn ()
110110
let out = Tooling.read sn ["-v"; dll;]
111111

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

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

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

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

123127
let valid = (out.ExitCode, token)
124128
match valid with

src/Elasticsearch.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ ProjectSection(SolutionItems) = preProject
6565
..\build\NEST.nuspec = ..\build\NEST.nuspec
6666
..\NuGet.config = ..\NuGet.config
6767
..\build\Elasticsearch.Net.nuspec = ..\build\Elasticsearch.Net.nuspec
68+
..\build\NEST.7xUpgradeAssistant.nuspec = ..\build\NEST.7xUpgradeAssistant.nuspec
6869
EndProjectSection
6970
EndProject
7071
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Markdown", "Markdown", "{2FABB663-F4DB-499A-89F8-3A08828D1D91}"
@@ -74,6 +75,8 @@ ProjectSection(SolutionItems) = preProject
7475
..\readme.md = ..\readme.md
7576
EndProjectSection
7677
EndProject
78+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nest.7xUpgradeAssistant", "Nest.7xUpgradeAssistant\Nest.7xUpgradeAssistant.csproj", "{B8B8C45A-22D3-4D1E-9A3A-C030997D5BF7}"
79+
EndProject
7780
Global
7881
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7982
Debug|Any CPU = Debug|Any CPU
@@ -158,5 +161,9 @@ Global
158161
{D6997ADC-E933-418E-831C-DE1A78897493}.Release|Any CPU.ActiveCfg = Release|Any CPU
159162
{D6997ADC-E933-418E-831C-DE1A78897493}.Debug|Any CPU.Build.0 = Debug|Any CPU
160163
{D6997ADC-E933-418E-831C-DE1A78897493}.Release|Any CPU.Build.0 = Release|Any CPU
164+
{B8B8C45A-22D3-4D1E-9A3A-C030997D5BF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
165+
{B8B8C45A-22D3-4D1E-9A3A-C030997D5BF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
166+
{B8B8C45A-22D3-4D1E-9A3A-C030997D5BF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
167+
{B8B8C45A-22D3-4D1E-9A3A-C030997D5BF7}.Release|Any CPU.Build.0 = Release|Any CPU
161168
EndGlobalSection
162169
EndGlobal
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
5+
namespace Nest
6+
{
7+
public static partial class ElasticClientExtensions
8+
{
9+
[Obsolete("Moved to client.Watcher.Acknowledge(), please update this usage.")]
10+
public static AcknowledgeWatchResponse AcknowledgeWatch(this IElasticClient client, Id id,
11+
Func<AcknowledgeWatchDescriptor, IAcknowledgeWatchRequest> selector = null
12+
)
13+
=> client.Watcher.Acknowledge(id, selector);
14+
15+
[Obsolete("Moved to client.Watcher.Acknowledge(), please update this usage.")]
16+
public static AcknowledgeWatchResponse AcknowledgeWatch(this IElasticClient client, IAcknowledgeWatchRequest request)
17+
=> client.Watcher.Acknowledge(request);
18+
19+
[Obsolete("Moved to client.Watcher.AcknowledgeAsync(), please update this usage.")]
20+
public static Task<AcknowledgeWatchResponse> AcknowledgeWatchAsync(this IElasticClient client, Id id,
21+
Func<AcknowledgeWatchDescriptor, IAcknowledgeWatchRequest> selector = null,
22+
CancellationToken ct = default
23+
)
24+
=> client.Watcher.AcknowledgeAsync(id, selector, ct);
25+
26+
[Obsolete("Moved to client.Watcher.AcknowledgeAsync(), please update this usage.")]
27+
public static Task<AcknowledgeWatchResponse> AcknowledgeWatchAsync(this IElasticClient client, IAcknowledgeWatchRequest request,
28+
CancellationToken ct = default
29+
)
30+
=> client.Watcher.AcknowledgeAsync(request, ct);
31+
}
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
5+
namespace Nest
6+
{
7+
public static partial class ElasticClientExtensions
8+
{
9+
[Obsolete("Moved to client.Watcher.Activate(), please update this usage.")]
10+
public static ActivateWatchResponse ActivateWatch(this IElasticClient client, Id id,
11+
Func<ActivateWatchDescriptor, IActivateWatchRequest> selector = null
12+
)
13+
=> client.Watcher.Activate(id, selector);
14+
15+
[Obsolete("Moved to client.Watcher.Activate(), please update this usage.")]
16+
public static ActivateWatchResponse ActivateWatch(this IElasticClient client, IActivateWatchRequest request)
17+
=> client.Watcher.Activate(request);
18+
19+
[Obsolete("Moved to client.Watcher.ActivateAsync(), please update this usage.")]
20+
public static Task<ActivateWatchResponse> ActivateWatchAsync(this IElasticClient client, Id id,
21+
Func<ActivateWatchDescriptor, IActivateWatchRequest> selector = null,
22+
CancellationToken ct = default
23+
)
24+
=> client.Watcher.ActivateAsync(id, selector, ct);
25+
26+
[Obsolete("Moved to client.Watcher.ActivateAsync(), please update this usage.")]
27+
public static Task<ActivateWatchResponse> ActivateWatchAsync(this IElasticClient client, IActivateWatchRequest request,
28+
CancellationToken ct = default
29+
)
30+
=> client.Watcher.ActivateAsync(request, ct);
31+
}
32+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
5+
namespace Nest
6+
{
7+
public static partial class ElasticClientExtensions
8+
{
9+
[Obsolete("Moved to client.Indices.BulkAlias(), please update this usage.")]
10+
public static BulkAliasResponse Alias(this IElasticClient client, Func<BulkAliasDescriptor, IBulkAliasRequest> selector)
11+
=> client.Indices.BulkAlias(selector);
12+
13+
[Obsolete("Moved to client.Indices.BulkAlias(), please update this usage.")]
14+
public static BulkAliasResponse Alias(this IElasticClient client, IBulkAliasRequest request)
15+
=> client.Indices.BulkAlias(request);
16+
17+
[Obsolete("Moved to client.Indices.BulkAliasAsync(), please update this usage.")]
18+
public static Task<BulkAliasResponse> AliasAsync(this IElasticClient client, Func<BulkAliasDescriptor, IBulkAliasRequest> selector,
19+
CancellationToken ct = default
20+
)
21+
=> client.Indices.BulkAliasAsync(selector, ct);
22+
23+
[Obsolete("Moved to client.Indices.BulkAliasAsync(), please update this usage.")]
24+
public static Task<BulkAliasResponse> AliasAsync(this IElasticClient client, IBulkAliasRequest request, CancellationToken ct = default)
25+
=> client.Indices.BulkAliasAsync(request, ct);
26+
}
27+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using System.IO;
3+
using System.Threading;
4+
using System.Threading.Tasks;
5+
using Elasticsearch.Net;
6+
7+
namespace Nest
8+
{
9+
using AliasExistConverter = Func<IApiCallDetails, Stream, ExistsResponse>;
10+
11+
public static partial class ElasticClientExtensions
12+
{
13+
[Obsolete("Moved to client.Indices.AliasExists(), please update this usage.")]
14+
public static ExistsResponse AliasExists(this IElasticClient client, Names name,
15+
Func<AliasExistsDescriptor, IAliasExistsRequest> selector = null
16+
)
17+
=> client.Indices.AliasExists(name, selector);
18+
19+
[Obsolete("Moved to client.Indices.AliasExists(), please update this usage.")]
20+
public static ExistsResponse AliasExists(this IElasticClient client, IAliasExistsRequest request)
21+
=> client.Indices.AliasExists(request);
22+
23+
[Obsolete("Moved to client.Indices.AliasExistsAsync(), please update this usage.")]
24+
public static Task<ExistsResponse> AliasExistsAsync(this IElasticClient client, Names name,
25+
Func<AliasExistsDescriptor, IAliasExistsRequest> selector = null,
26+
CancellationToken ct = default
27+
)
28+
=> client.Indices.AliasExistsAsync(name, selector, ct);
29+
30+
[Obsolete("Moved to client.Indices.AliasExistsAsync(), please update this usage.")]
31+
public static Task<ExistsResponse> AliasExistsAsync(this IElasticClient client, IAliasExistsRequest request, CancellationToken ct = default)
32+
=> client.Indices.AliasExistsAsync(request, ct);
33+
}
34+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
5+
namespace Nest
6+
{
7+
public static partial class ElasticClientExtensions
8+
{
9+
[Obsolete("Moved to client.Indices.Analyze(), please update this usage.")]
10+
public static AnalyzeResponse Analyze(this IElasticClient client, Func<AnalyzeDescriptor, IAnalyzeRequest> selector)
11+
=> client.Indices.Analyze(selector);
12+
13+
[Obsolete("Moved to client.Indices.Analyze(), please update this usage.")]
14+
public static AnalyzeResponse Analyze(this IElasticClient client, IAnalyzeRequest request)
15+
=> client.Indices.Analyze(request);
16+
17+
[Obsolete("Moved to client.Indices.AnalyzeAsync(), please update this usage.")]
18+
public static Task<AnalyzeResponse> AnalyzeAsync(this IElasticClient client, Func<AnalyzeDescriptor, IAnalyzeRequest> selector,
19+
CancellationToken ct = default
20+
)
21+
=> client.Indices.AnalyzeAsync(selector, ct);
22+
23+
[Obsolete("Moved to client.Indices.AnalyzeAsync(), please update this usage.")]
24+
public static Task<AnalyzeResponse> AnalyzeAsync(this IElasticClient client, IAnalyzeRequest request, CancellationToken ct = default)
25+
=> client.Indices.AnalyzeAsync(request, ct);
26+
}
27+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
5+
namespace Nest
6+
{
7+
public static partial class ElasticClientExtensions
8+
{
9+
[Obsolete("Moved to client.Security.Authenticate(), please update this usage.")]
10+
public static AuthenticateResponse Authenticate(this IElasticClient client, Func<AuthenticateDescriptor, IAuthenticateRequest> selector = null
11+
)
12+
=> client.Security.Authenticate(selector);
13+
14+
[Obsolete("Moved to client.Security.Authenticate(), please update this usage.")]
15+
public static AuthenticateResponse Authenticate(this IElasticClient client, IAuthenticateRequest request)
16+
=> client.Security.Authenticate(request);
17+
18+
[Obsolete("Moved to client.Security.AuthenticateAsync(), please update this usage.")]
19+
public static Task<AuthenticateResponse> AuthenticateAsync(this IElasticClient client,
20+
Func<AuthenticateDescriptor, IAuthenticateRequest> selector = null,
21+
CancellationToken ct = default
22+
)
23+
=> client.Security.AuthenticateAsync(selector, ct);
24+
25+
[Obsolete("Moved to client.Security.AuthenticateAsync(), please update this usage.")]
26+
public static Task<AuthenticateResponse> AuthenticateAsync(this IElasticClient client, IAuthenticateRequest request,
27+
CancellationToken ct = default
28+
)
29+
=> client.Security.AuthenticateAsync(request, ct);
30+
}
31+
}

0 commit comments

Comments
 (0)