Skip to content

Commit 7365e17

Browse files
committed
fix: resolve all build errors in CI/CD pipeline
- Change AspNetCore.HealthChecks.UI.Client to HealthChecks.UI.Client in all services - Add Dapr.Client and Dapr.Extensions.Configuration usings to SysMLStore - Fix AddCustomHealthChecks to return IHealthChecksBuilder instead of IServiceCollection - Update AddMongoDb health check to use IMongoClient factory (v9.0.0 API change) - Add MongoClient singleton registration in SysMLStore All projects now build successfully in Release configuration
1 parent f1976ad commit 7365e17

4 files changed

Lines changed: 14 additions & 8 deletions

File tree

src/BuildingBlocks/Healthchecks/Extensions/HealthCheckExtensions.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ namespace SysArx.BuildingBlocks.Healthchecks.Extensions;
88

99
public static class HealthCheckExtensions
1010
{
11-
public static IServiceCollection AddCustomHealthChecks(this IServiceCollection services)
11+
public static IHealthChecksBuilder AddCustomHealthChecks(this IServiceCollection services)
1212
{
13-
services.AddHealthChecks()
13+
return services.AddHealthChecks()
1414
.AddCheck("self", () => HealthCheckResult.Healthy());
15-
16-
return services;
1715
}
1816

1917
public static void MapCustomHealthChecks(

src/Services/Auth/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using Serilog;
22
using SysArx.BuildingBlocks.Authentication.Extensions;
33
using SysArx.BuildingBlocks.Healthchecks.Extensions;
4-
using AspNetCore.HealthChecks.UI.Client;
54
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
5+
using HealthChecks.UI.Client;
66

77
var appName = "Auth API";
88
var builder = WebApplication.CreateBuilder(args);

src/Services/SysMLDiagram/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
using SysArx.BuildingBlocks.Healthchecks.Extensions;
44
using SysArx.BuildingBlocks.Authentication.Extensions;
55
using SysArx.Services.SysMLDiagram.Services;
6-
using AspNetCore.HealthChecks.UI.Client;
6+
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
7+
using HealthChecks.UI.Client;
78

89
var appName = "SysMLDiagram API";
910
var builder = WebApplication.CreateBuilder(args);

src/Services/SysMLStore/Program.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
using Serilog;
2+
using Dapr.Client;
3+
using Dapr.Extensions.Configuration;
24
using SysArx.BuildingBlocks.EventBus.Extensions;
35
using SysArx.BuildingBlocks.Healthchecks.Extensions;
46
using SysArx.BuildingBlocks.Authentication.Extensions;
57
using SysArx.Services.SysMLStore.Services;
68
using SysArx.Services.SysMLStore.Settings;
79
using SysArx.Services.SysMLStore.Storage;
8-
using AspNetCore.HealthChecks.UI.Client;
10+
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
11+
using HealthChecks.UI.Client;
912

1013
var appName = "SysMLStore API";
1114
var builder = WebApplication.CreateBuilder(args);
@@ -65,9 +68,13 @@
6568
});
6669

6770
// Add health checks
71+
var mongoConnectionString = builder.Configuration.GetValue<string>("MongoDbSettings:ConnectionString") ?? "mongodb://localhost:27017";
72+
builder.Services.AddSingleton<MongoDB.Driver.IMongoClient>(sp =>
73+
new MongoDB.Driver.MongoClient(mongoConnectionString));
74+
6875
builder.Services.AddCustomHealthChecks()
6976
.AddMongoDb(
70-
builder.Configuration.GetValue<string>("MongoDbSettings:ConnectionString") ?? "mongodb://localhost:27017",
77+
sp => sp.GetRequiredService<MongoDB.Driver.IMongoClient>(),
7178
name: "mongodb",
7279
tags: new[] { "ready" });
7380

0 commit comments

Comments
 (0)