Skip to content

Commit 538c15e

Browse files
committed
Search: Fixed TeamCity script generation.
1 parent 99e4897 commit 538c15e

3 files changed

Lines changed: 10 additions & 30 deletions

File tree

src/PostSharp.Engineering.BuildTools/Search/Crawlers/PlainDocumentParser.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public override Task<IReadOnlyCollection<Snippet>> GetSnippetsFromDocument(
2828
{
2929
throw new ArgumentException( nameof(document) );
3030
}
31-
31+
3232
var snippets = new List<Snippet>();
3333

3434
var title = document.DocumentNode.SelectSingleNode( "/html/head/meta[@name=\"title\"]" )?.Attributes["content"]?.Value ??
@@ -47,9 +47,9 @@ public override Task<IReadOnlyCollection<Snippet>> GetSnippetsFromDocument(
4747

4848
var keywordsNode = document.DocumentNode?.SelectSingleNode( "/html/head/meta[@name=\"keywords\"]" );
4949
var keywords = keywordsNode?.Attributes["content"]?.Value?.Trim() ?? "";
50-
50+
5151
var breadcrumbLinks = document.DocumentNode
52-
.SelectSingleNode( "//nav[@itemtype=\"https://schema.org/BreadcrumbList\"]" )
52+
!.SelectSingleNode( "//nav[@itemtype=\"https://schema.org/BreadcrumbList\"]" )
5353
?
5454
.SelectNodes( ".//span[@itemprop=\"name\"]" )
5555
.Select( node => node.GetText() )

src/PostSharp.Engineering.BuildTools/Search/UpdateSearchProductExtension.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ public class UpdateSearchProductExtension : ProductExtension
2626

2727
public DocumentParserFactory DocumentParserFactory { get; }
2828

29-
public bool IgnoreTls { get; }
30-
3129
public BuildConfiguration[] BuildConfigurations { get; }
3230

3331
public TimeSpan TimeOutThreshold { get; }
@@ -44,7 +42,6 @@ public UpdateSearchProductExtension(
4442
string sourceUrl,
4543
Func<DocumentParser> createParser,
4644
ImmutableArray<string> products,
47-
bool ignoreTls = false,
4845
BuildConfiguration[]? buildConfigurations = null,
4946
TimeSpan? timeOutThreshold = null,
5047
string? customBuildConfigurationName = null,
@@ -55,7 +52,6 @@ public UpdateSearchProductExtension(
5552
this.SourceUrl = sourceUrl;
5653
this.DocumentParserFactory = new DocumentParserFactory( createParser );
5754
this.Products = products;
58-
this.IgnoreTls = ignoreTls;
5955
this.BuildConfigurations = buildConfigurations ?? [BuildConfiguration.Public];
6056
this.TimeOutThreshold = timeOutThreshold ?? TimeSpan.FromMinutes( 5 );
6157
this.CustomBuildConfigurationName = customBuildConfigurationName;
@@ -66,14 +62,7 @@ internal override bool AddTeamcityBuildConfiguration( BuildContext context, List
6662
{
6763
TeamCityBuildStep CreateBuildStep()
6864
{
69-
var arguments = new List<string> { this.TypesenseUri, this.Source, this.SourceUrl };
70-
71-
if ( this.IgnoreTls )
72-
{
73-
arguments.Add( "--ignore-tls" );
74-
}
75-
76-
return new TeamCityEngineeringCommandBuildStep( "UpdateSearch", "Update search", "tools search update", string.Join( " ", arguments ), true );
65+
return new TeamCityEngineeringCommandBuildStep( "UpdateSearch", "Update search", "search update", null, true );
7766
}
7867

7968
foreach ( var configuration in this.BuildConfigurations )

src/PostSharp.Engineering.BuildTools/Search/Updaters/DocumentationUpdater.cs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,13 @@ public override async Task<bool> UpdateAsync( BuildContext context, UpdateSearch
2626
{
2727
var productExtension = context.Product.Extensions.OfType<UpdateSearchProductExtension>().Single();
2828

29-
HttpClient web;
29+
var handler = new HttpClientHandler();
30+
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
31+
32+
handler.ServerCertificateCustomValidationCallback =
33+
( _, _, _, _ ) => true;
3034

31-
if ( productExtension.IgnoreTls )
32-
{
33-
var handler = new HttpClientHandler();
34-
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
35-
36-
handler.ServerCertificateCustomValidationCallback =
37-
( _, _, _, _ ) => true;
38-
39-
web = new HttpClient( handler );
40-
}
41-
else
42-
{
43-
web = new HttpClient();
44-
}
35+
var web = new HttpClient( handler );
4536

4637
using ( web )
4738
{

0 commit comments

Comments
 (0)