From 371207d75ccaf6a5de06d8a929b61d62a3d90107 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Fri, 24 Apr 2026 17:52:25 +0200 Subject: [PATCH 01/34] Add SamlTokenClaimEnricher sample --- samples/SamlTokenClaimEnricher/Program.cs | 20 +++++ .../Properties/launchSettings.json | 9 +++ samples/SamlTokenClaimEnricher/README.md | 40 ++++++++++ .../SamlTokenClaimEnricher.csproj | 21 +++++ .../TokenClaimsEnricher.cs | 79 +++++++++++++++++++ samples/SamlTokenClaimEnricher/host.json | 12 +++ .../local.settings.json | 7 ++ samples/SamlTokenClaimEnricher/test.http | 21 +++++ 8 files changed, 209 insertions(+) create mode 100644 samples/SamlTokenClaimEnricher/Program.cs create mode 100644 samples/SamlTokenClaimEnricher/Properties/launchSettings.json create mode 100644 samples/SamlTokenClaimEnricher/README.md create mode 100644 samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj create mode 100644 samples/SamlTokenClaimEnricher/TokenClaimsEnricher.cs create mode 100644 samples/SamlTokenClaimEnricher/host.json create mode 100644 samples/SamlTokenClaimEnricher/local.settings.json create mode 100644 samples/SamlTokenClaimEnricher/test.http diff --git a/samples/SamlTokenClaimEnricher/Program.cs b/samples/SamlTokenClaimEnricher/Program.cs new file mode 100644 index 0000000..3257b33 --- /dev/null +++ b/samples/SamlTokenClaimEnricher/Program.cs @@ -0,0 +1,20 @@ +using System.Text.Json; +using Microsoft.Azure.Functions.Worker.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +var builder = FunctionsApplication.CreateBuilder(args); + +builder.ConfigureFunctionsWebApplication(); + +// builder.Services +// .AddApplicationInsightsTelemetryWorkerService() +// .ConfigureFunctionsApplicationInsights(); + +// FORCE JSON to respect the property names exactly as defined +builder.Services.Configure(options => +{ + options.PropertyNamingPolicy = null; // This stops "type" from replacing "@odata.type" +}); + +builder.Build().Run(); diff --git a/samples/SamlTokenClaimEnricher/Properties/launchSettings.json b/samples/SamlTokenClaimEnricher/Properties/launchSettings.json new file mode 100644 index 0000000..0d93bfb --- /dev/null +++ b/samples/SamlTokenClaimEnricher/Properties/launchSettings.json @@ -0,0 +1,9 @@ +{ + "profiles": { + "SamlTokenClaimEnricher": { + "commandName": "Project", + "commandLineArgs": "--port 7106", + "launchBrowser": false + } + } +} \ No newline at end of file diff --git a/samples/SamlTokenClaimEnricher/README.md b/samples/SamlTokenClaimEnricher/README.md new file mode 100644 index 0000000..4ecd9e0 --- /dev/null +++ b/samples/SamlTokenClaimEnricher/README.md @@ -0,0 +1,40 @@ +# Demo + +Install Azurite + +[Use the Azurite emulator for local Azure Storage development](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite) + +Install Azurite + +[Install and run Azurite emulator](https://learn.microsoft.com/en-us/azure/storage/common/storage-install-azurite) + +```bash +npm install -g azurite +``` + +The goal is to return this kind of response: + +```json +{ + "data": { + "@odata.type": "microsoft.graph.onTokenIssuanceStartResponseData", + "actions": [ + { + "@odata.type": "microsoft.graph.tokenIssuanceStartCustomExtensionHandlerStep", + "stepModifier": { + "@odata.type": "microsoft.graph.customExtensionOverwriteAllowedCustomClaimsUpdateStepModifier", + "claims": [ + { + "claimType": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/githubteams", + "values": [ + "Engineering", + "Security-Ops" + ] + } + ] + } + } + ] + } +} +``` diff --git a/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj b/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj new file mode 100644 index 0000000..b7a6c83 --- /dev/null +++ b/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj @@ -0,0 +1,21 @@ + + + + net10.0 + V4 + Exe + enable + enable + + + + + + + + + + + + + diff --git a/samples/SamlTokenClaimEnricher/TokenClaimsEnricher.cs b/samples/SamlTokenClaimEnricher/TokenClaimsEnricher.cs new file mode 100644 index 0000000..33a787b --- /dev/null +++ b/samples/SamlTokenClaimEnricher/TokenClaimsEnricher.cs @@ -0,0 +1,79 @@ +using System.Net; +using System.Text.Json.Serialization; +using Microsoft.Azure.Functions.Worker; +using Microsoft.Azure.Functions.Worker.Http; +using Microsoft.Extensions.Logging; + +namespace SamlTokenClaimEnricher; + +public class TokenClaimsEnricher(ILoggerFactory loggerFactory) +{ + private readonly ILogger _logger = loggerFactory.CreateLogger(); + + [Function("TokenClaimsEnricher")] + public async Task Run( + [HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestData req) + { + _logger.LogInformation("Entra ID called the Token Enrichment API."); + + var response = req.CreateResponse(HttpStatusCode.OK); + response.Headers.Add("Content-Type", "application/json; charset=utf-8"); + + // Hard-coded string to prevent .NET from stripping the @odata.type keys + string json = @" +{ + ""data"": { + ""@odata.type"": ""microsoft.graph.onTokenIssuanceStartResponseData"", + ""actions"": [ + { + ""@odata.type"": ""microsoft.graph.tokenIssuanceStart.provideClaimsForToken"", + ""claims"": { + ""UserRole"": ""SecurityAuditor"", + ""ProjectCode"": ""Alpha-Sandbox"", + ""IsDemoUser"": ""true"", + ""CustomGroup"": [ + ""PS_EMEA"", + ""CS_EMEA"", + ""Revenue"" + ] + } + } + ] + } +}"; + + await response.WriteStringAsync(json); + return response; + } +} + +public class RootResponse +{ + [JsonPropertyName("data")] + public ResponseData Data { get; set; } +} + +public class ResponseData +{ + [JsonPropertyName("@odata.type")] + public string OdataType { get; set; } + + [JsonPropertyName("actions")] + public ActionData[] Actions { get; set; } +} + +public class ActionData +{ + [JsonPropertyName("@odata.type")] + public string OdataType { get; set; } + + [JsonPropertyName("claims")] + public AdditionalClaims Claims { get; set; } +} + +public class AdditionalClaims +{ + public string UserRole { get; set; } + public string ProjectCode { get; set; } + public string IsDemoUser { get; set; } +} diff --git a/samples/SamlTokenClaimEnricher/host.json b/samples/SamlTokenClaimEnricher/host.json new file mode 100644 index 0000000..d4f2d41 --- /dev/null +++ b/samples/SamlTokenClaimEnricher/host.json @@ -0,0 +1,12 @@ +{ + "version": "2.0", + "logging": { + "applicationInsights": { + "samplingSettings": { + "isEnabled": true, + "excludedTypes": "Request" + }, + "enableLiveMetricsFilters": true + } + } +} \ No newline at end of file diff --git a/samples/SamlTokenClaimEnricher/local.settings.json b/samples/SamlTokenClaimEnricher/local.settings.json new file mode 100644 index 0000000..ccfbf12 --- /dev/null +++ b/samples/SamlTokenClaimEnricher/local.settings.json @@ -0,0 +1,7 @@ +{ + "IsEncrypted": false, + "Values": { + "AzureWebJobsStorage": "UseDevelopmentStorage=true", + "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated" + } +} diff --git a/samples/SamlTokenClaimEnricher/test.http b/samples/SamlTokenClaimEnricher/test.http new file mode 100644 index 0000000..48e5bab --- /dev/null +++ b/samples/SamlTokenClaimEnricher/test.http @@ -0,0 +1,21 @@ +### Test the SSO Enrichment Function +# This simulates the call Entra ID makes to your API +POST http://localhost:7106/api/TokenClaimsEnricher +Content-Type: application/json + +{ + "type": "microsoft.graph.onTokenIssuanceStartCalloutData", + "data": { + "@type": "microsoft.graph.onTokenIssuanceStartCalloutData", + "tenantId": "00000000-0000-0000-0000-000000000000", + "authenticationContext": { + "correlationId": "58659d89-9e8c-44e2-9d29-c89b25129c54", + "clientAppId": "your-app-id", + "user": { + "id": "user-guid", + "userPrincipalName": "admin@yourcompany.com", + "displayName": "Demo User" + } + } + } +} From 3cb7ee3f8e7fbe59b782455d7423a86ab6d05071 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Mon, 27 Apr 2026 11:06:01 +0200 Subject: [PATCH 02/34] Migrate solution file to slnx format --- AlmOps.sln | 125 ---------------------------------------------------- AlmOps.slnx | 28 ++++++++++++ 2 files changed, 28 insertions(+), 125 deletions(-) delete mode 100644 AlmOps.sln create mode 100644 AlmOps.slnx diff --git a/AlmOps.sln b/AlmOps.sln deleted file mode 100644 index fe39658..0000000 --- a/AlmOps.sln +++ /dev/null @@ -1,125 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.6.33829.357 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp", "src\ConsoleApp\ConsoleApp.csproj", "{9E18DEA5-68DD-4268-85FD-62E1574F7A30}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0 - Solution Items", "0 - Solution Items", "{87B20B9D-F974-40EA-B444-2DC02F9066DC}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - .gitignore = .gitignore - CONTRIBUTING.md = CONTRIBUTING.md - Directory.Build.props = Directory.Build.props - Local.runsettings = Local.runsettings - README.md = README.md - .gitlab-ci.yml = .gitlab-ci.yml - .dockerignore = .dockerignore - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2 - Components", "2 - Components", "{D254B3EA-CAFB-4564-A1A5-2D0E37DE29B8}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3 - Applications", "3 - Applications", "{842A49CD-7DBE-4E99-8244-57FCAA8E9901}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureDevOpsComponent.Domain", "src\AzureDevOpsComponent.Domain\AzureDevOpsComponent.Domain.csproj", "{4CD575DE-CFBE-42A5-87A2-ED0BAA52033C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureDevOpsComponent.Infrastructure.RestApi", "src\AzureDevOpsComponent.Infrastructure.RestApi\AzureDevOpsComponent.Infrastructure.RestApi.csproj", "{163DE105-7EB7-43D5-98D6-69967ECCB87D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AzureDevOps", "AzureDevOps", "{74FF6EA7-6764-4B7B-970F-29E0763B0A04}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureDevOpsComponent.Infrastructure.RestApi.UnitTests", "test\AzureDevOpsComponent.Infrastructure.RestApi.UnitTests\AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.csproj", "{889EF283-E155-490B-B85A-6FD98F73927D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp.UnitTests", "test\ConsoleApp.UnitTests\ConsoleApp.UnitTests.csproj", "{933E5B0A-BA55-4768-8380-91DE2A253D53}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests", "test\AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests\AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.csproj", "{ED040615-CB13-4DF5-9D0B-33BF464F8F36}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitLab", "GitLab", "{4A98AFE3-F966-4916-8BA2-B07C138E1DD8}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub", "GitHub", "{360EE467-B8AE-41CB-9405-8166E8F61D62}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp.IntegrationTests", "test\ConsoleApp.IntegrationTests\ConsoleApp.IntegrationTests.csproj", "{90677288-AAA3-4C4C-8F06-794BEA93A34E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1 - Framework", "1 - Framework", "{5A8D2CEE-3519-4FE9-877A-4D32F5AE3757}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Net.Http", "src\Common.Net.Http\Common.Net.Http.csproj", "{3B092C77-33CD-458C-9C18-0FDF6B59F52B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitLabComponent.Infrastructure.RestApi", "src\GitLabComponent.Infrastructure.RestApi\GitLabComponent.Infrastructure.RestApi.csproj", "{FD2E768B-BA3E-47A8-99B4-D28DE2B98C1D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitLabComponent.Infrastructure.RestApi.IntegrationTests", "test\GitLabComponent.Infrastructure.RestApi.IntegrationTests\GitLabComponent.Infrastructure.RestApi.IntegrationTests.csproj", "{46B16FFF-214B-4544-83D5-D83C0621C8D6}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.System", "src\Common.System\Common.System.csproj", "{6DC7E1C1-6531-4EC3-84CC-8939F6D9E4E6}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9E18DEA5-68DD-4268-85FD-62E1574F7A30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9E18DEA5-68DD-4268-85FD-62E1574F7A30}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9E18DEA5-68DD-4268-85FD-62E1574F7A30}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9E18DEA5-68DD-4268-85FD-62E1574F7A30}.Release|Any CPU.Build.0 = Release|Any CPU - {4CD575DE-CFBE-42A5-87A2-ED0BAA52033C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4CD575DE-CFBE-42A5-87A2-ED0BAA52033C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4CD575DE-CFBE-42A5-87A2-ED0BAA52033C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4CD575DE-CFBE-42A5-87A2-ED0BAA52033C}.Release|Any CPU.Build.0 = Release|Any CPU - {163DE105-7EB7-43D5-98D6-69967ECCB87D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {163DE105-7EB7-43D5-98D6-69967ECCB87D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {163DE105-7EB7-43D5-98D6-69967ECCB87D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {163DE105-7EB7-43D5-98D6-69967ECCB87D}.Release|Any CPU.Build.0 = Release|Any CPU - {889EF283-E155-490B-B85A-6FD98F73927D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {889EF283-E155-490B-B85A-6FD98F73927D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {889EF283-E155-490B-B85A-6FD98F73927D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {889EF283-E155-490B-B85A-6FD98F73927D}.Release|Any CPU.Build.0 = Release|Any CPU - {933E5B0A-BA55-4768-8380-91DE2A253D53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {933E5B0A-BA55-4768-8380-91DE2A253D53}.Debug|Any CPU.Build.0 = Debug|Any CPU - {933E5B0A-BA55-4768-8380-91DE2A253D53}.Release|Any CPU.ActiveCfg = Release|Any CPU - {933E5B0A-BA55-4768-8380-91DE2A253D53}.Release|Any CPU.Build.0 = Release|Any CPU - {ED040615-CB13-4DF5-9D0B-33BF464F8F36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ED040615-CB13-4DF5-9D0B-33BF464F8F36}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ED040615-CB13-4DF5-9D0B-33BF464F8F36}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ED040615-CB13-4DF5-9D0B-33BF464F8F36}.Release|Any CPU.Build.0 = Release|Any CPU - {90677288-AAA3-4C4C-8F06-794BEA93A34E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {90677288-AAA3-4C4C-8F06-794BEA93A34E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {90677288-AAA3-4C4C-8F06-794BEA93A34E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {90677288-AAA3-4C4C-8F06-794BEA93A34E}.Release|Any CPU.Build.0 = Release|Any CPU - {3B092C77-33CD-458C-9C18-0FDF6B59F52B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3B092C77-33CD-458C-9C18-0FDF6B59F52B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B092C77-33CD-458C-9C18-0FDF6B59F52B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3B092C77-33CD-458C-9C18-0FDF6B59F52B}.Release|Any CPU.Build.0 = Release|Any CPU - {FD2E768B-BA3E-47A8-99B4-D28DE2B98C1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FD2E768B-BA3E-47A8-99B4-D28DE2B98C1D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FD2E768B-BA3E-47A8-99B4-D28DE2B98C1D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FD2E768B-BA3E-47A8-99B4-D28DE2B98C1D}.Release|Any CPU.Build.0 = Release|Any CPU - {46B16FFF-214B-4544-83D5-D83C0621C8D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {46B16FFF-214B-4544-83D5-D83C0621C8D6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {46B16FFF-214B-4544-83D5-D83C0621C8D6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {46B16FFF-214B-4544-83D5-D83C0621C8D6}.Release|Any CPU.Build.0 = Release|Any CPU - {6DC7E1C1-6531-4EC3-84CC-8939F6D9E4E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6DC7E1C1-6531-4EC3-84CC-8939F6D9E4E6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6DC7E1C1-6531-4EC3-84CC-8939F6D9E4E6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6DC7E1C1-6531-4EC3-84CC-8939F6D9E4E6}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {9E18DEA5-68DD-4268-85FD-62E1574F7A30} = {842A49CD-7DBE-4E99-8244-57FCAA8E9901} - {4CD575DE-CFBE-42A5-87A2-ED0BAA52033C} = {74FF6EA7-6764-4B7B-970F-29E0763B0A04} - {163DE105-7EB7-43D5-98D6-69967ECCB87D} = {74FF6EA7-6764-4B7B-970F-29E0763B0A04} - {74FF6EA7-6764-4B7B-970F-29E0763B0A04} = {D254B3EA-CAFB-4564-A1A5-2D0E37DE29B8} - {889EF283-E155-490B-B85A-6FD98F73927D} = {74FF6EA7-6764-4B7B-970F-29E0763B0A04} - {933E5B0A-BA55-4768-8380-91DE2A253D53} = {842A49CD-7DBE-4E99-8244-57FCAA8E9901} - {ED040615-CB13-4DF5-9D0B-33BF464F8F36} = {74FF6EA7-6764-4B7B-970F-29E0763B0A04} - {4A98AFE3-F966-4916-8BA2-B07C138E1DD8} = {D254B3EA-CAFB-4564-A1A5-2D0E37DE29B8} - {360EE467-B8AE-41CB-9405-8166E8F61D62} = {D254B3EA-CAFB-4564-A1A5-2D0E37DE29B8} - {90677288-AAA3-4C4C-8F06-794BEA93A34E} = {842A49CD-7DBE-4E99-8244-57FCAA8E9901} - {3B092C77-33CD-458C-9C18-0FDF6B59F52B} = {5A8D2CEE-3519-4FE9-877A-4D32F5AE3757} - {FD2E768B-BA3E-47A8-99B4-D28DE2B98C1D} = {4A98AFE3-F966-4916-8BA2-B07C138E1DD8} - {46B16FFF-214B-4544-83D5-D83C0621C8D6} = {4A98AFE3-F966-4916-8BA2-B07C138E1DD8} - {6DC7E1C1-6531-4EC3-84CC-8939F6D9E4E6} = {5A8D2CEE-3519-4FE9-877A-4D32F5AE3757} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {3CE55893-1DA3-4B50-BE62-9713F1859BF2} - EndGlobalSection -EndGlobal diff --git a/AlmOps.slnx b/AlmOps.slnx new file mode 100644 index 0000000..ab380ad --- /dev/null +++ b/AlmOps.slnx @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 3fd3e73d79f9bb15b29a0057da7bbc75835e2021 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Mon, 27 Apr 2026 11:36:12 +0200 Subject: [PATCH 03/34] Move to .NET 10 --- .editorconfig | 212 ++---------------- AlmOps.slnx | 15 +- CONTRIBUTING.md | 12 +- Directory.Build.props | 2 +- samples/SamlTokenClaimEnricher/Program.cs | 40 ++-- .../Properties/launchSettings.json | 18 +- samples/SamlTokenClaimEnricher/README.md | 22 +- .../SamlTokenClaimEnricher.csproj | 32 +-- samples/SamlTokenClaimEnricher/host.json | 24 +- .../local.settings.json | 14 +- .../AzureDevOpsComponent.Domain.csproj | 9 +- .../Models/BuildArtifactModel.cs | 25 +-- .../Models/BuildDefinitionModel.cs | 25 +-- .../Models/BuildModel.cs | 47 ++-- .../Models/EnvironmentModel.cs | 33 ++- .../Models/PersonModel.cs | 19 +- .../Models/PoolModel.cs | 13 +- .../Models/ProjectModel.cs | 21 +- .../Models/QueueModel.cs | 13 +- .../Models/ReleaseArtifactModel.cs | 19 +- .../Models/ReleaseDefinitionModel.cs | 39 ++-- .../Models/ReleaseModel.cs | 49 ++-- .../Models/VariableGroupModel.cs | 17 +- .../Repositories/IBuildArtifactRepository.cs | 9 +- .../Repositories/IBuildRepository.cs | 13 +- .../Repositories/IBuildTagRepository.cs | 9 +- .../Repositories/IProjectRepository.cs | 9 +- .../IReleaseDefinitionRepository.cs | 11 +- .../Repositories/IReleaseRepository.cs | 9 +- .../Repositories/IVariableGroupRepository.cs | 11 +- ...OpsComponent.Infrastructure.RestApi.csproj | 9 +- .../AzureDevOpsRestApiConfiguration.cs | 53 +++-- .../Dto/ApprovalDto.cs | 17 +- .../Dto/ApprovalOptionsDto.cs | 17 +- .../Dto/ApprovalsSnapshotDto.cs | 11 +- .../Dto/BuildArtifactDto.cs | 15 +- .../Dto/BuildDefinitionDto.cs | 27 ++- .../Dto/BuildDto.cs | 77 ++++--- .../Dto/ConditionDto.cs | 15 +- .../MappingProfiles/GenericMappingProfile.cs | 191 ++++++++-------- .../Repositories/ProjectRepository.cs | 39 ++-- src/Common.Net.Http/Common.Net.Http.csproj | 13 -- src/Common.System/Common.System.csproj | 13 -- src/ConsoleApp/ConsoleApp.csproj | 28 +-- src/ConsoleApp/Dockerfile | 6 +- src/ConsoleApp/Tasks/TaskBase.cs | 2 +- .../Dto/AuditEventDto.cs | 3 +- ...LabComponent.Infrastructure.RestApi.csproj | 4 +- .../GitLabRestApiConfiguration.cs | 31 ++- .../Repositories/AuditEventRepository.cs | 5 +- .../Repositories/RepositoryBase.cs | 3 +- ...astructure.RestApi.IntegrationTests.csproj | 4 +- .../RepositoryIntegrationTestBase.cs | 75 +++---- ...nt.Infrastructure.RestApi.UnitTests.csproj | 15 +- .../ConsoleApp.IntegrationTests.csproj | 12 +- test/ConsoleApp.IntegrationTests/SmokeTest.cs | 12 +- .../ConsoleApp.UnitTests.csproj | 15 +- .../Tasks/ConsoleTaskFactoryTest.cs | 93 ++++---- .../Tasks/TaskBaseTest.cs | 73 +++--- .../AuditEventRepositoryTest.cs | 2 +- .../EnvironmentExtensions.cs | 11 +- ...astructure.RestApi.IntegrationTests.csproj | 13 +- .../RepositoryIntegrationTestBase.cs | 30 ++- 63 files changed, 719 insertions(+), 1006 deletions(-) delete mode 100644 src/Common.Net.Http/Common.Net.Http.csproj delete mode 100644 src/Common.System/Common.System.csproj rename {src/Common.System => test/GitLabComponent.Infrastructure.RestApi.IntegrationTests}/EnvironmentExtensions.cs (54%) diff --git a/.editorconfig b/.editorconfig index fc9d63f..7bc41cd 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,183 +1,98 @@ -# Inspired by https://github.com/dotnet/roslyn/blob/main/.editorconfig -# EditorConfig is awesome: https://EditorConfig.org +root = true +# inspired by https://github.com/dotnet/roslyn/blob/master/.editorconfig -# top-most EditorConfig file -root = true - -# Don't use tabs for indentation. [*] -## custom config start end_of_line = lf insert_final_newline = true -## custom config end -indent_style = space -# (Please don't specify an indent_size here; that has too many unintended consequences.) -spelling_exclusion_path = SpellingExclusions.dic +max_line_length = 180 -## custom config start -# XML files -[*.{xml,runsettings}] -indent_size = 2 -## custom config end - -# Code files -[*.{cs,csx,vb,vbx}] +[*.{cs,sln}] indent_size = 4 -charset = utf-8-bom - -# XML project files -[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] -indent_size = 2 - -# XML config files -[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] -indent_size = 2 - -# JSON files -[*.json] -indent_size = 2 +indent_style = space +trim_trailing_whitespace = true -# Powershell files -[*.ps1] +[*.{config,csproj,json,props,runsettings,sh,tf,xml,yml,yaml}] indent_size = 2 +indent_style = space +trim_trailing_whitespace = true -# Shell script files -[*.sh] +[*.md] indent_size = 2 +indent_style = space +trim_trailing_whitespace = false -# Dotnet code style settings: -[*.{cs,vb}] - -# Sort using and Import directives with System.* appearing first +[*.cs] dotnet_sort_system_directives_first = true -dotnet_separate_import_directive_groups = false # Avoid "this." and "Me." if not necessary -dotnet_style_qualification_for_field = false:refactoring -dotnet_style_qualification_for_property = false:refactoring -dotnet_style_qualification_for_method = false:refactoring -dotnet_style_qualification_for_event = false:refactoring - +dotnet_style_qualification_for_field = false:warning +dotnet_style_qualification_for_property = false:warning +dotnet_style_qualification_for_method = false:warning +dotnet_style_qualification_for_event = false:warning # Use language keywords instead of framework type names for type references dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion dotnet_style_predefined_type_for_member_access = true:suggestion - # Suggest more modern language features when available dotnet_style_object_initializer = true:suggestion dotnet_style_collection_initializer = true:suggestion dotnet_style_coalesce_expression = true:suggestion dotnet_style_null_propagation = true:suggestion dotnet_style_explicit_tuple_names = true:suggestion - -# Whitespace options -dotnet_style_allow_multiple_blank_lines_experimental = false - # Non-private static fields are PascalCase -dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = unset dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style - dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected dotnet_naming_symbols.non_private_static_fields.required_modifiers = static - dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case - # Non-private readonly fields are PascalCase -dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = unset dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style - dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly - dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case - # Constants are PascalCase dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style - dotnet_naming_symbols.constants.applicable_kinds = field, local dotnet_naming_symbols.constants.required_modifiers = const - dotnet_naming_style.constant_style.capitalization = pascal_case - # Static fields are camelCase and start with s_ dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style - dotnet_naming_symbols.static_fields.applicable_kinds = field dotnet_naming_symbols.static_fields.required_modifiers = static - dotnet_naming_style.static_field_style.capitalization = camel_case dotnet_naming_style.static_field_style.required_prefix = s_ - # Instance fields are camelCase and start with _ dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style - dotnet_naming_symbols.instance_fields.applicable_kinds = field - dotnet_naming_style.instance_field_style.capitalization = camel_case dotnet_naming_style.instance_field_style.required_prefix = _ - # Locals and parameters are camelCase dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style - dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local - dotnet_naming_style.camel_case_style.capitalization = camel_case - # Local functions are PascalCase dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style - dotnet_naming_symbols.local_functions.applicable_kinds = local_function - dotnet_naming_style.local_function_style.capitalization = pascal_case - # By default, name items with PascalCase dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style - dotnet_naming_symbols.all_members.applicable_kinds = * - dotnet_naming_style.pascal_case_style.capitalization = pascal_case - -file_header_template = Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.\nSee the LICENSE file in the project root for more information. - -# RS0016: Only enable if API files are present -dotnet_public_api_analyzer.require_api_files = true - -# IDE0055: Fix formatting -# Workaround for https://github.com/dotnet/roslyn/issues/70570 -dotnet_diagnostic.IDE0055.severity = warning - -# https://github.com/dotnet/roslyn-analyzers/issues/7436 - False positives from valid GetDeclaredSymbol calls -dotnet_diagnostic.RS1039.severity = none - -# These xUnit analyzers were disabled temporarily to let us move to the -# new xUnit and get past several component governance issues. The -# following issue tracks enabling them -# -# https://github.com/dotnet/roslyn/issues/75093 -dotnet_diagnostic.xUnit1012.severity = none -dotnet_diagnostic.xUnit1030.severity = none -dotnet_diagnostic.xUnit1031.severity = none -dotnet_diagnostic.xUnit2005.severity = none -dotnet_diagnostic.xUnit2020.severity = none -dotnet_diagnostic.xUnit2023.severity = none -dotnet_diagnostic.xUnit2029.severity = none - -# CSharp code style settings: -[*.cs] # Newline settings csharp_new_line_before_open_brace = all csharp_new_line_before_else = true @@ -186,7 +101,6 @@ csharp_new_line_before_finally = true csharp_new_line_before_members_in_object_initializers = true csharp_new_line_before_members_in_anonymous_types = true csharp_new_line_between_query_expression_clauses = true - # Indentation preferences csharp_indent_block_contents = true csharp_indent_braces = false @@ -194,37 +108,24 @@ csharp_indent_case_contents = true csharp_indent_case_contents_when_block = true csharp_indent_switch_labels = true csharp_indent_labels = flush_left - -# Whitespace options -csharp_style_allow_embedded_statements_on_same_line_experimental = false -csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false -csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false -csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false -csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false - # Prefer "var" everywhere csharp_style_var_for_built_in_types = true:suggestion csharp_style_var_when_type_is_apparent = true:suggestion csharp_style_var_elsewhere = true:suggestion - # Prefer method-like constructs to have a block body csharp_style_expression_bodied_methods = false:none csharp_style_expression_bodied_constructors = false:none csharp_style_expression_bodied_operators = false:none - # Prefer property-like constructs to have an expression-body csharp_style_expression_bodied_properties = true:none csharp_style_expression_bodied_indexers = true:none csharp_style_expression_bodied_accessors = true:none - # Suggest more modern language features when available csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion csharp_style_pattern_matching_over_as_with_null_check = true:suggestion csharp_style_inlined_variable_declaration = true:suggestion csharp_style_throw_expression = true:suggestion csharp_style_conditional_delegate_call = true:suggestion -csharp_style_prefer_extended_property_pattern = true:suggestion - # Space preferences csharp_space_after_cast = false csharp_space_after_colon_in_inheritance_clause = true @@ -233,7 +134,6 @@ csharp_space_after_dot = false csharp_space_after_keywords_in_control_flow_statements = true csharp_space_after_semicolon_in_for_statement = true csharp_space_around_binary_operators = before_and_after -csharp_space_around_declaration_statements = do_not_ignore csharp_space_before_colon_in_inheritance_clause = true csharp_space_before_comma = false csharp_space_before_dot = false @@ -248,81 +148,7 @@ csharp_space_between_method_declaration_name_and_open_parenthesis = false csharp_space_between_method_declaration_parameter_list_parentheses = false csharp_space_between_parentheses = false csharp_space_between_square_brackets = false - # Blocks are allowed csharp_prefer_braces = true:silent csharp_preserve_single_line_blocks = true csharp_preserve_single_line_statements = true - -# IDE0060: Remove unused parameter -dotnet_diagnostic.IDE0060.severity = warning - -[src/{Compilers,ExpressionEvaluator,Scripting}/**Test**/*.{cs,vb}] - -# IDE0060: Remove unused parameter -dotnet_diagnostic.IDE0060.severity = none - -[src/{Analyzers,CodeStyle,Features,Workspaces,EditorFeatures,VisualStudio}/**/*.{cs,vb}] - -# IDE0011: Add braces -csharp_prefer_braces = when_multiline:warning -# NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201 -dotnet_diagnostic.IDE0011.severity = warning - -# IDE0040: Add accessibility modifiers -dotnet_diagnostic.IDE0040.severity = warning - -# IDE0052: Remove unread private member -dotnet_diagnostic.IDE0052.severity = warning - -# IDE0059: Unnecessary assignment to a value -dotnet_diagnostic.IDE0059.severity = warning - -# CA1012: Abstract types should not have public constructors -dotnet_diagnostic.CA1012.severity = warning - -# CA1822: Make member static -dotnet_diagnostic.CA1822.severity = warning - -# Prefer "var" everywhere -dotnet_diagnostic.IDE0007.severity = warning -csharp_style_var_for_built_in_types = true:warning -csharp_style_var_when_type_is_apparent = true:warning -csharp_style_var_elsewhere = true:warning - -# csharp_style_allow_embedded_statements_on_same_line_experimental -dotnet_diagnostic.IDE2001.severity = warning - -# csharp_style_allow_blank_lines_between_consecutive_braces_experimental -dotnet_diagnostic.IDE2002.severity = warning - -# csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental -dotnet_diagnostic.IDE2004.severity = warning - -# csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental -dotnet_diagnostic.IDE2005.severity = warning - -# csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental -dotnet_diagnostic.IDE2006.severity = warning - -[src/{VisualStudio}/**/*.{cs,vb}] -# CA1822: Make member static -# There is a risk of accidentally breaking an internal API that partners rely on though IVT. -dotnet_code_quality.CA1822.api_surface = private - -[**/{ExternalAccess}/**/*.{cs,vb}] - -# RS0016: Only enable if API files are present -dotnet_public_api_analyzer.require_api_files = true - -dotnet_diagnostic.RS0051.severity = error -dotnet_diagnostic.RS0052.severity = error -dotnet_diagnostic.RS0053.severity = error -dotnet_diagnostic.RS0054.severity = error -dotnet_diagnostic.RS0055.severity = error -dotnet_diagnostic.RS0056.severity = error -dotnet_diagnostic.RS0057.severity = error -dotnet_diagnostic.RS0058.severity = error -dotnet_diagnostic.RS0059.severity = error -dotnet_diagnostic.RS0060.severity = error -dotnet_diagnostic.RS0061.severity = error diff --git a/AlmOps.slnx b/AlmOps.slnx index ab380ad..c06da3b 100644 --- a/AlmOps.slnx +++ b/AlmOps.slnx @@ -8,11 +8,7 @@ - - - - - + @@ -20,9 +16,10 @@ - - - - + + + + + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1e915ae..dcfaebd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ ## Requirements -* [.NET SDK](https://dotnet.microsoft.com/download) must be installed, either directly or from an IDE (Visual Studio 2022, Rider) +* [.NET SDK](https://dotnet.microsoft.com/download) must be installed, either directly or from an IDE (Visual Studio 2022/2026, Rider) ## Run the dll @@ -74,13 +74,3 @@ docker run -it --rm --name almops \ * [Azure DevOps Services REST API Reference](https://learn.microsoft.com/en-us/rest/api/azure/devops/) * [microsoft/azure-devops-auth-samples](https://github.com/microsoft/azure-devops-auth-samples) * [microsoft/azure-devops-node-api](https://github.com/microsoft/azure-devops-node-api) - -## Tips - -### Rider shortcuts - - Key combination | Action -----------------------|------------------------------ - `F4` | Open project definition file - `Ctrl`+`Enter` | Open context menu - `Ctrl`+`Alt`+`Enter` | Format file diff --git a/Directory.Build.props b/Directory.Build.props index 5129db9..604f5b6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,7 +5,7 @@ - 1.3.3 + 1.4.0 diff --git a/samples/SamlTokenClaimEnricher/Program.cs b/samples/SamlTokenClaimEnricher/Program.cs index 3257b33..d7969fb 100644 --- a/samples/SamlTokenClaimEnricher/Program.cs +++ b/samples/SamlTokenClaimEnricher/Program.cs @@ -1,20 +1,20 @@ -using System.Text.Json; -using Microsoft.Azure.Functions.Worker.Builder; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - -var builder = FunctionsApplication.CreateBuilder(args); - -builder.ConfigureFunctionsWebApplication(); - -// builder.Services -// .AddApplicationInsightsTelemetryWorkerService() -// .ConfigureFunctionsApplicationInsights(); - -// FORCE JSON to respect the property names exactly as defined -builder.Services.Configure(options => -{ - options.PropertyNamingPolicy = null; // This stops "type" from replacing "@odata.type" -}); - -builder.Build().Run(); +using System.Text.Json; +using Microsoft.Azure.Functions.Worker.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +var builder = FunctionsApplication.CreateBuilder(args); + +builder.ConfigureFunctionsWebApplication(); + +// builder.Services +// .AddApplicationInsightsTelemetryWorkerService() +// .ConfigureFunctionsApplicationInsights(); + +// FORCE JSON to respect the property names exactly as defined +builder.Services.Configure(options => +{ + options.PropertyNamingPolicy = null; // This stops "type" from replacing "@odata.type" +}); + +builder.Build().Run(); diff --git a/samples/SamlTokenClaimEnricher/Properties/launchSettings.json b/samples/SamlTokenClaimEnricher/Properties/launchSettings.json index 0d93bfb..70eb93f 100644 --- a/samples/SamlTokenClaimEnricher/Properties/launchSettings.json +++ b/samples/SamlTokenClaimEnricher/Properties/launchSettings.json @@ -1,9 +1,9 @@ -{ - "profiles": { - "SamlTokenClaimEnricher": { - "commandName": "Project", - "commandLineArgs": "--port 7106", - "launchBrowser": false - } - } -} \ No newline at end of file +{ + "profiles": { + "SamlTokenClaimEnricher": { + "commandName": "Project", + "commandLineArgs": "--port 7106", + "launchBrowser": false + } + } +} diff --git a/samples/SamlTokenClaimEnricher/README.md b/samples/SamlTokenClaimEnricher/README.md index 4ecd9e0..69e0312 100644 --- a/samples/SamlTokenClaimEnricher/README.md +++ b/samples/SamlTokenClaimEnricher/README.md @@ -4,8 +4,6 @@ Install Azurite [Use the Azurite emulator for local Azure Storage development](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite) -Install Azurite - [Install and run Azurite emulator](https://learn.microsoft.com/en-us/azure/storage/common/storage-install-azurite) ```bash @@ -20,17 +18,15 @@ The goal is to return this kind of response: "@odata.type": "microsoft.graph.onTokenIssuanceStartResponseData", "actions": [ { - "@odata.type": "microsoft.graph.tokenIssuanceStartCustomExtensionHandlerStep", - "stepModifier": { - "@odata.type": "microsoft.graph.customExtensionOverwriteAllowedCustomClaimsUpdateStepModifier", - "claims": [ - { - "claimType": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/githubteams", - "values": [ - "Engineering", - "Security-Ops" - ] - } + "@odata.type": "microsoft.graph.tokenIssuanceStart.provideClaimsForToken", + "claims": { + "UserRole": "SecurityAuditor", + "ProjectCode": "Alpha-Sandbox", + "IsDemoUser": "true", + "CustomGroup": [ + "PS_EMEA", + "CS_EMEA", + "Revenue" ] } } diff --git a/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj b/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj index b7a6c83..03d3437 100644 --- a/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj +++ b/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj @@ -1,21 +1,21 @@  - - net10.0 - V4 - Exe - enable - enable - + + net10.0 + V4 + Exe + enable + enable + - - - - - - - - - + + + + + + + + + diff --git a/samples/SamlTokenClaimEnricher/host.json b/samples/SamlTokenClaimEnricher/host.json index d4f2d41..2babc58 100644 --- a/samples/SamlTokenClaimEnricher/host.json +++ b/samples/SamlTokenClaimEnricher/host.json @@ -1,12 +1,12 @@ -{ - "version": "2.0", - "logging": { - "applicationInsights": { - "samplingSettings": { - "isEnabled": true, - "excludedTypes": "Request" - }, - "enableLiveMetricsFilters": true - } - } -} \ No newline at end of file +{ + "version": "2.0", + "logging": { + "applicationInsights": { + "samplingSettings": { + "isEnabled": true, + "excludedTypes": "Request" + }, + "enableLiveMetricsFilters": true + } + } +} diff --git a/samples/SamlTokenClaimEnricher/local.settings.json b/samples/SamlTokenClaimEnricher/local.settings.json index ccfbf12..8eea88f 100644 --- a/samples/SamlTokenClaimEnricher/local.settings.json +++ b/samples/SamlTokenClaimEnricher/local.settings.json @@ -1,7 +1,7 @@ -{ - "IsEncrypted": false, - "Values": { - "AzureWebJobsStorage": "UseDevelopmentStorage=true", - "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated" - } -} +{ + "IsEncrypted": false, + "Values": { + "AzureWebJobsStorage": "UseDevelopmentStorage=true", + "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated" + } +} diff --git a/src/AzureDevOpsComponent.Domain/AzureDevOpsComponent.Domain.csproj b/src/AzureDevOpsComponent.Domain/AzureDevOpsComponent.Domain.csproj index fe6983d..9b7242b 100644 --- a/src/AzureDevOpsComponent.Domain/AzureDevOpsComponent.Domain.csproj +++ b/src/AzureDevOpsComponent.Domain/AzureDevOpsComponent.Domain.csproj @@ -1,15 +1,10 @@  - netstandard2.1 + net10.0 AlmOps.AzureDevOpsComponent.Domain AlmOps.AzureDevOpsComponent.Domain - {4CD575DE-CFBE-42A5-87A2-ED0BAA52033C} - - - - full - true + enable diff --git a/src/AzureDevOpsComponent.Domain/Models/BuildArtifactModel.cs b/src/AzureDevOpsComponent.Domain/Models/BuildArtifactModel.cs index e272763..ea9962e 100644 --- a/src/AzureDevOpsComponent.Domain/Models/BuildArtifactModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/BuildArtifactModel.cs @@ -1,23 +1,22 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models +namespace AlmOps.AzureDevOpsComponent.Domain.Models; + +public class BuildArtifactModel { - public class BuildArtifactModel - { - public int Id { get; set; } + public int Id { get; set; } - public string Name { get; set; } + public string Name { get; set; } - public string Source { get; set; } + public string Source { get; set; } - public string ResourceType { get; set; } + public string ResourceType { get; set; } - public string ResourceData { get; set; } + public string ResourceData { get; set; } - public string ResourceUrl { get; set; } + public string ResourceUrl { get; set; } - public string ResourceDownloadUrl { get; set; } + public string ResourceDownloadUrl { get; set; } - public string ResourceLocalPath { get; set; } + public string ResourceLocalPath { get; set; } - public string ResourceArtifactSize { get; set; } - } + public string ResourceArtifactSize { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/BuildDefinitionModel.cs b/src/AzureDevOpsComponent.Domain/Models/BuildDefinitionModel.cs index 0d7fb5b..24b8c55 100644 --- a/src/AzureDevOpsComponent.Domain/Models/BuildDefinitionModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/BuildDefinitionModel.cs @@ -1,23 +1,22 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models +namespace AlmOps.AzureDevOpsComponent.Domain.Models; + +public class BuildDefinitionModel { - public class BuildDefinitionModel - { - public string Id { get; set; } + public string Id { get; set; } - public string Name { get; set; } + public string Name { get; set; } - public string Url { get; set; } + public string Url { get; set; } - public string Uri { get; set; } + public string Uri { get; set; } - public string Path { get; set; } + public string Path { get; set; } - public string Type { get; set; } + public string Type { get; set; } - public string QueueStatus { get; set; } + public string QueueStatus { get; set; } - public int Revision { get; set; } + public int Revision { get; set; } - public ProjectModel Project { get; set; } - } + public ProjectModel Project { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/BuildModel.cs b/src/AzureDevOpsComponent.Domain/Models/BuildModel.cs index 2c906d8..7a2799f 100644 --- a/src/AzureDevOpsComponent.Domain/Models/BuildModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/BuildModel.cs @@ -1,47 +1,46 @@ using System; -namespace AlmOps.AzureDevOpsComponent.Domain.Models +namespace AlmOps.AzureDevOpsComponent.Domain.Models; + +public class BuildModel { - public class BuildModel - { - public string Id { get; set; } + public string Id { get; set; } - public string BuildNumber { get; set; } + public string BuildNumber { get; set; } - public string Status { get; set; } + public string Status { get; set; } - public string Result { get; set; } + public string Result { get; set; } - public DateTime QueueTime { get; set; } + public DateTime QueueTime { get; set; } - public DateTime StartTime { get; set; } + public DateTime StartTime { get; set; } - public DateTime FinishTime { get; set; } + public DateTime FinishTime { get; set; } - public string Url { get; set; } + public string Url { get; set; } - public BuildDefinitionModel Definition { get; set; } + public BuildDefinitionModel Definition { get; set; } - public ProjectModel Project { get; set; } + public ProjectModel Project { get; set; } - public string Uri { get; set; } + public string Uri { get; set; } - public string SourceBranch { get; set; } + public string SourceBranch { get; set; } - public string SourceVersion { get; set; } + public string SourceVersion { get; set; } - public QueueModel Queue { get; set; } + public QueueModel Queue { get; set; } - public string Priority { get; set; } + public string Priority { get; set; } - public string Reason { get; set; } + public string Reason { get; set; } - public PersonModel RequestedFor { get; set; } + public PersonModel RequestedFor { get; set; } - public PersonModel RequestedBy { get; set; } + public PersonModel RequestedBy { get; set; } - public DateTime LastChangedDate { get; set; } + public DateTime LastChangedDate { get; set; } - public PersonModel LastChangedBy { get; set; } - } + public PersonModel LastChangedBy { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/EnvironmentModel.cs b/src/AzureDevOpsComponent.Domain/Models/EnvironmentModel.cs index 8e4458c..204e8fa 100644 --- a/src/AzureDevOpsComponent.Domain/Models/EnvironmentModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/EnvironmentModel.cs @@ -1,33 +1,32 @@ using System.Collections.Generic; -namespace AlmOps.AzureDevOpsComponent.Domain.Models +namespace AlmOps.AzureDevOpsComponent.Domain.Models; + +public class EnvironmentModel { - public class EnvironmentModel - { - public int Id { get; set; } + public int Id { get; set; } - public int ReleaseId { get; set; } + public int ReleaseId { get; set; } - public string Name { get; set; } + public string Name { get; set; } - public string Status { get; set; } + public string Status { get; set; } - public object Variables { get; set; } + public object Variables { get; set; } - public int Rank { get; set; } + public int Rank { get; set; } - public int DefinitionEnvironmentId { get; set; } + public int DefinitionEnvironmentId { get; set; } - public PersonModel Owner { get; set; } + public PersonModel Owner { get; set; } - public List Schedules { get; set; } + public List Schedules { get; set; } - public ReleaseModel Release { get; set; } + public ReleaseModel Release { get; set; } - public ReleaseDefinitionModel ReleaseDefinition { get; set; } + public ReleaseDefinitionModel ReleaseDefinition { get; set; } - public PersonModel ReleaseCreatedBy { get; set; } + public PersonModel ReleaseCreatedBy { get; set; } - public string TriggerReason { get; set; } - } + public string TriggerReason { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/PersonModel.cs b/src/AzureDevOpsComponent.Domain/Models/PersonModel.cs index 434ece9..c5870a7 100644 --- a/src/AzureDevOpsComponent.Domain/Models/PersonModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/PersonModel.cs @@ -1,17 +1,16 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models +namespace AlmOps.AzureDevOpsComponent.Domain.Models; + +public class PersonModel { - public class PersonModel - { - public string DisplayName { get; set; } + public string DisplayName { get; set; } - public string Url { get; set; } + public string Url { get; set; } - public string Id { get; set; } + public string Id { get; set; } - public string UniqueName { get; set; } + public string UniqueName { get; set; } - public string ImageUrl { get; set; } + public string ImageUrl { get; set; } - public string Descriptor { get; set; } - } + public string Descriptor { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/PoolModel.cs b/src/AzureDevOpsComponent.Domain/Models/PoolModel.cs index 5c6366f..ab337f8 100644 --- a/src/AzureDevOpsComponent.Domain/Models/PoolModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/PoolModel.cs @@ -1,11 +1,10 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models +namespace AlmOps.AzureDevOpsComponent.Domain.Models; + +public class PoolModel { - public class PoolModel - { - public int Id { get; set; } + public int Id { get; set; } - public string Name { get; set; } + public string Name { get; set; } - public bool IsHosted { get; set; } - } + public bool IsHosted { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/ProjectModel.cs b/src/AzureDevOpsComponent.Domain/Models/ProjectModel.cs index 4ec821f..ae0fc63 100644 --- a/src/AzureDevOpsComponent.Domain/Models/ProjectModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/ProjectModel.cs @@ -1,19 +1,18 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models +namespace AlmOps.AzureDevOpsComponent.Domain.Models; + +public class ProjectModel { - public class ProjectModel - { - public string Id { get; set; } + public string Id { get; set; } - public string Name { get; set; } + public string Name { get; set; } - public string Description { get; set; } + public string Description { get; set; } - public string Url { get; set; } + public string Url { get; set; } - public string State { get; set; } + public string State { get; set; } - public int Revision { get; set; } + public int Revision { get; set; } - public string Visibility { get; set; } - } + public string Visibility { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/QueueModel.cs b/src/AzureDevOpsComponent.Domain/Models/QueueModel.cs index e2e770e..9852168 100644 --- a/src/AzureDevOpsComponent.Domain/Models/QueueModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/QueueModel.cs @@ -1,11 +1,10 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models +namespace AlmOps.AzureDevOpsComponent.Domain.Models; + +public class QueueModel { - public class QueueModel - { - public int Id { get; set; } + public int Id { get; set; } - public string Name { get; set; } + public string Name { get; set; } - public PoolModel Pool { get; set; } - } + public PoolModel Pool { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/ReleaseArtifactModel.cs b/src/AzureDevOpsComponent.Domain/Models/ReleaseArtifactModel.cs index e9395bd..f83c5b0 100644 --- a/src/AzureDevOpsComponent.Domain/Models/ReleaseArtifactModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/ReleaseArtifactModel.cs @@ -1,17 +1,16 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models +namespace AlmOps.AzureDevOpsComponent.Domain.Models; + +public class ReleaseArtifactModel { - public class ReleaseArtifactModel - { - public string SourceId { get; set; } + public string SourceId { get; set; } - public string Type { get; set; } + public string Type { get; set; } - public string Alias { get; set; } + public string Alias { get; set; } - public string BuildDefinitionId { get; set; } + public string BuildDefinitionId { get; set; } - public string BuildDefinitionName { get; set; } + public string BuildDefinitionName { get; set; } - public bool IsPrimary { get; set; } - } + public bool IsPrimary { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/ReleaseDefinitionModel.cs b/src/AzureDevOpsComponent.Domain/Models/ReleaseDefinitionModel.cs index 89f811e..e6ed5ac 100644 --- a/src/AzureDevOpsComponent.Domain/Models/ReleaseDefinitionModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/ReleaseDefinitionModel.cs @@ -1,40 +1,39 @@ using System; using System.Collections.Generic; -namespace AlmOps.AzureDevOpsComponent.Domain.Models +namespace AlmOps.AzureDevOpsComponent.Domain.Models; + +public class ReleaseDefinitionModel { - public class ReleaseDefinitionModel - { - public int Id { get; set; } + public int Id { get; set; } - public string Name { get; set; } + public string Name { get; set; } - public string Url { get; set; } + public string Url { get; set; } - public string Source { get; set; } + public string Source { get; set; } - public int Revision { get; set; } + public int Revision { get; set; } - public object Description { get; set; } + public object Description { get; set; } - public PersonModel CreatedBy { get; set; } + public PersonModel CreatedBy { get; set; } - public DateTime CreatedOn { get; set; } + public DateTime CreatedOn { get; set; } - public PersonModel ModifiedBy { get; set; } + public PersonModel ModifiedBy { get; set; } - public DateTime ModifiedOn { get; set; } + public DateTime ModifiedOn { get; set; } - public bool IsDeleted { get; set; } + public bool IsDeleted { get; set; } - public ReleaseModel LastRelease { get; set; } + public ReleaseModel LastRelease { get; set; } - public List Environments { get; set; } + public List Environments { get; set; } - public List Artifacts { get; set; } + public List Artifacts { get; set; } - public string ReleaseNameFormat { get; set; } + public string ReleaseNameFormat { get; set; } - public string Path { get; set; } - } + public string Path { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/ReleaseModel.cs b/src/AzureDevOpsComponent.Domain/Models/ReleaseModel.cs index 1013d07..aecdd55 100644 --- a/src/AzureDevOpsComponent.Domain/Models/ReleaseModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/ReleaseModel.cs @@ -1,50 +1,49 @@ using System; using System.Collections.Generic; -namespace AlmOps.AzureDevOpsComponent.Domain.Models +namespace AlmOps.AzureDevOpsComponent.Domain.Models; + +public class ReleaseModel { - public class ReleaseModel - { - public string Id { get; set; } + public string Id { get; set; } - public string Name { get; set; } + public string Name { get; set; } - public string Status { get; set; } + public string Status { get; set; } - public DateTime CreatedOn { get; set; } + public DateTime CreatedOn { get; set; } - public DateTime ModifiedOn { get; set; } + public DateTime ModifiedOn { get; set; } - public PersonModel ModifiedBy { get; set; } + public PersonModel ModifiedBy { get; set; } - public PersonModel CreatedBy { get; set; } + public PersonModel CreatedBy { get; set; } - public List Environments { get; set; } + public List Environments { get; set; } - public object Variables { get; set; } + public object Variables { get; set; } - public List VariableGroups { get; set; } + public List VariableGroups { get; set; } - public ReleaseDefinitionModel ReleaseDefinition { get; set; } + public ReleaseDefinitionModel ReleaseDefinition { get; set; } - public string Description { get; set; } + public string Description { get; set; } - public string Reason { get; set; } + public string Reason { get; set; } - public string ReleaseNameFormat { get; set; } + public string ReleaseNameFormat { get; set; } - public bool KeepForever { get; set; } + public bool KeepForever { get; set; } - public int DefinitionSnapshotRevision { get; set; } + public int DefinitionSnapshotRevision { get; set; } - public string LogsContainerUrl { get; set; } + public string LogsContainerUrl { get; set; } - public string Url { get; set; } + public string Url { get; set; } - public List Tags { get; set; } + public List Tags { get; set; } - public ProjectModel ProjectReference { get; set; } + public ProjectModel ProjectReference { get; set; } - public object Properties { get; set; } - } + public object Properties { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/VariableGroupModel.cs b/src/AzureDevOpsComponent.Domain/Models/VariableGroupModel.cs index cfc2ab7..16d66cf 100644 --- a/src/AzureDevOpsComponent.Domain/Models/VariableGroupModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/VariableGroupModel.cs @@ -1,15 +1,14 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models +namespace AlmOps.AzureDevOpsComponent.Domain.Models; + +public class VariableGroupModel { - public class VariableGroupModel - { - public long Id { get; set; } + public long Id { get; set; } - public string Type { get; set; } + public string Type { get; set; } - public string Name { get; set; } + public string Name { get; set; } - public string Description { get; set; } + public string Description { get; set; } - public object Variables { get; set; } - } + public object Variables { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IBuildArtifactRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IBuildArtifactRepository.cs index 2a90246..cdb5f35 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IBuildArtifactRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IBuildArtifactRepository.cs @@ -2,10 +2,9 @@ using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; -namespace AlmOps.AzureDevOpsComponent.Domain.Repositories +namespace AlmOps.AzureDevOpsComponent.Domain.Repositories; + +public interface IBuildArtifactRepository { - public interface IBuildArtifactRepository - { - Task> FindAllAsync(string projectName, string buildId); - } + Task> FindAllAsync(string projectName, string buildId); } diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IBuildRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IBuildRepository.cs index 9d6f191..7200093 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IBuildRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IBuildRepository.cs @@ -2,14 +2,13 @@ using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; -namespace AlmOps.AzureDevOpsComponent.Domain.Repositories +namespace AlmOps.AzureDevOpsComponent.Domain.Repositories; + +public interface IBuildRepository { - public interface IBuildRepository - { - Task> FindAllAsync(string projectName, string branchName = null, string buildDefinitionsId = null); + Task> FindAllAsync(string projectName, string branchName = null, string buildDefinitionsId = null); - Task FindOneByIdAsync(string projectName, string id); + Task FindOneByIdAsync(string projectName, string id); - Task CreateAsync(string projectName, string buildDefinitionId, string sourceBranchName, Dictionary variables); - } + Task CreateAsync(string projectName, string buildDefinitionId, string sourceBranchName, Dictionary variables); } diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IBuildTagRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IBuildTagRepository.cs index 5dffa52..cc91bf3 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IBuildTagRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IBuildTagRepository.cs @@ -1,9 +1,8 @@ using System.Threading.Tasks; -namespace AlmOps.AzureDevOpsComponent.Domain.Repositories +namespace AlmOps.AzureDevOpsComponent.Domain.Repositories; + +public interface IBuildTagRepository { - public interface IBuildTagRepository - { - Task AddOneAsync(string projectName, string buildId, string tag); - } + Task AddOneAsync(string projectName, string buildId, string tag); } diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IProjectRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IProjectRepository.cs index 455796a..b111214 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IProjectRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IProjectRepository.cs @@ -2,10 +2,9 @@ using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; -namespace AlmOps.AzureDevOpsComponent.Domain.Repositories +namespace AlmOps.AzureDevOpsComponent.Domain.Repositories; + +public interface IProjectRepository { - public interface IProjectRepository - { - Task> FindAllAsync(); - } + Task> FindAllAsync(); } diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IReleaseDefinitionRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IReleaseDefinitionRepository.cs index 803f8dd..4d4c581 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IReleaseDefinitionRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IReleaseDefinitionRepository.cs @@ -2,11 +2,10 @@ using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; -namespace AlmOps.AzureDevOpsComponent.Domain.Repositories +namespace AlmOps.AzureDevOpsComponent.Domain.Repositories; + +public interface IReleaseDefinitionRepository { - public interface IReleaseDefinitionRepository - { - Task> FindAllAsync(string projectName, string searchText); - Task FindOneByIdAsync(string projectName, string id); - } + Task> FindAllAsync(string projectName, string searchText); + Task FindOneByIdAsync(string projectName, string id); } diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IReleaseRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IReleaseRepository.cs index 207ee56..32fd201 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IReleaseRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IReleaseRepository.cs @@ -1,10 +1,9 @@ using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; -namespace AlmOps.AzureDevOpsComponent.Domain.Repositories +namespace AlmOps.AzureDevOpsComponent.Domain.Repositories; + +public interface IReleaseRepository { - public interface IReleaseRepository - { - Task CreateAsync(string projectName, string releaseDefinitionId, string buildId, string alias); - } + Task CreateAsync(string projectName, string releaseDefinitionId, string buildId, string alias); } diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IVariableGroupRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IVariableGroupRepository.cs index 8f8ed58..990317d 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IVariableGroupRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IVariableGroupRepository.cs @@ -2,12 +2,11 @@ using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; -namespace AlmOps.AzureDevOpsComponent.Domain.Repositories +namespace AlmOps.AzureDevOpsComponent.Domain.Repositories; + +public interface IVariableGroupRepository { - public interface IVariableGroupRepository - { - Task FindOneByIdAsync(string projectName, string id); + Task FindOneByIdAsync(string projectName, string id); - Task UpdateAsync(string projectName, string id, Dictionary input, bool isReplaceAll = false); - } + Task UpdateAsync(string projectName, string id, Dictionary input, bool isReplaceAll = false); } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj index 0c80019..51401fa 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj @@ -1,15 +1,10 @@  - net9.0 + net10.0 AlmOps.AzureDevOpsComponent.Infrastructure.RestApi AlmOps.AzureDevOpsComponent.Infrastructure.RestApi - {163DE105-7EB7-43D5-98D6-69967ECCB87D} - - - - full - true + enable diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsRestApiConfiguration.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsRestApiConfiguration.cs index f4ff81f..694f468 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsRestApiConfiguration.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsRestApiConfiguration.cs @@ -1,33 +1,32 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi; + +public class AzureDevOpsRestApiConfiguration { - public class AzureDevOpsRestApiConfiguration - { - /// - /// Base URL - /// - /// https://dev.azure.com/myorganization - public string BaseUrl { get; init; } + /// + /// Base URL + /// + /// https://dev.azure.com/myorganization + public string BaseUrl { get; init; } - /// - /// API version - /// - /// 5.1 - public string ApiVersion { get; set; } = "7.1"; + /// + /// API version + /// + /// 5.1 + public string ApiVersion { get; set; } = "7.1"; - /// - /// Username - /// - public string Username { get; init; } + /// + /// Username + /// + public string Username { get; init; } - /// - /// Authentication token. - /// This is a Personal Access Token (PAT) that can be generated from the web interface of Azure DevOps. - /// - public string Token { get; init; } + /// + /// Authentication token. + /// This is a Personal Access Token (PAT) that can be generated from the web interface of Azure DevOps. + /// + public string Token { get; init; } - /// - /// HTTP Client name - /// - public string HttpClientName { get; } = "AzureDevOpsRestApiClient"; - } + /// + /// HTTP Client name + /// + public string HttpClientName { get; } = "AzureDevOpsRestApiClient"; } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalDto.cs index 97a13bc..3019d03 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalDto.cs @@ -1,11 +1,10 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; + +public class ApprovalDto { - public class ApprovalDto - { - public int Id { get; set; } - public int Rank { get; set; } - public bool IsAutomated { get; set; } - public bool IsNotificationOn { get; set; } - public PersonDto Approver { get; set; } - } + public int Id { get; set; } + public int Rank { get; set; } + public bool IsAutomated { get; set; } + public bool IsNotificationOn { get; set; } + public PersonDto Approver { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalOptionsDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalOptionsDto.cs index 8e6dce3..4cc4114 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalOptionsDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalOptionsDto.cs @@ -1,11 +1,10 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; + +public class ApprovalOptionsDto { - public class ApprovalOptionsDto - { - public int? RequiredApproverCount { get; set; } - public bool ReleaseCreatorCanBeApprover { get; set; } - public bool AutoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped { get; set; } - public bool EnforceIdentityRevalidation { get; set; } - public int? TimeoutInMintues { get; set; } - } + public int? RequiredApproverCount { get; set; } + public bool ReleaseCreatorCanBeApprover { get; set; } + public bool AutoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped { get; set; } + public bool EnforceIdentityRevalidation { get; set; } + public int? TimeoutInMintues { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalsSnapshotDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalsSnapshotDto.cs index d667a4b..7de25c8 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalsSnapshotDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalsSnapshotDto.cs @@ -1,10 +1,9 @@ using System.Collections.Generic; -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; + +public class ApprovalsSnapshotDto { - public class ApprovalsSnapshotDto - { - public List Approvals { get; set; } - public ApprovalOptionsDto ApprovalOptions { get; set; } - } + public List Approvals { get; set; } + public ApprovalOptionsDto ApprovalOptions { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildArtifactDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildArtifactDto.cs index f007e81..5d10a24 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildArtifactDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildArtifactDto.cs @@ -1,10 +1,9 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; + +public class BuildArtifactDto { - public class BuildArtifactDto - { - public int Id { get; set; } - public string Name { get; set; } - public string Source { get; set; } - public ResourceDto Resource { get; set; } - } + public int Id { get; set; } + public string Name { get; set; } + public string Source { get; set; } + public ResourceDto Resource { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDefinitionDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDefinitionDto.cs index 797d2d0..33191c7 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDefinitionDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDefinitionDto.cs @@ -1,18 +1,17 @@ using System.Collections.Generic; -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; + +public class BuildDefinitionDto { - public class BuildDefinitionDto - { - public string Id { get; set; } - public string Name { get; set; } - public string Url { get; set; } - public string Uri { get; set; } - public string Path { get; set; } - public string Type { get; set; } - public string QueueStatus { get; set; } - public int Revision { get; set; } - public ProjectDto Project { get; set; } - public List Drafts { get; set; } - } + public string Id { get; set; } + public string Name { get; set; } + public string Url { get; set; } + public string Uri { get; set; } + public string Path { get; set; } + public string Type { get; set; } + public string QueueStatus { get; set; } + public int Revision { get; set; } + public ProjectDto Project { get; set; } + public List Drafts { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs index ea86cb9..0ef4873 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs @@ -2,44 +2,43 @@ using System.Collections.Generic; using Newtonsoft.Json; -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; + +public class BuildDto { - public class BuildDto - { - public string Id { get; set; } - public string BuildNumber { get; set; } - public string Status { get; set; } - public string Result { get; set; } - public DateTime QueueTime { get; set; } - public DateTime StartTime { get; set; } - public DateTime FinishTime { get; set; } - public string Url { get; set; } - public List Tags { get; set; } - public BuildDefinitionDto Definition { get; set; } - public ProjectDto Project { get; set; } - public RepositoryDto Repository { get; set; } - [JsonProperty("_links")] - public LinksDto Links { get; set; } - public object Properties { get; set; } - public List ValidationResults { get; set; } - public List Plans { get; set; } - public TriggerInfoDto TriggerInfo { get; set; } - public int BuildNumberRevision { get; set; } - public string Uri { get; set; } - public string SourceBranch { get; set; } - public string SourceVersion { get; set; } - public QueueDto Queue { get; set; } - public string Priority { get; set; } - public string Reason { get; set; } - public PersonDto RequestedFor { get; set; } - public PersonDto RequestedBy { get; set; } - public DateTime LastChangedDate { get; set; } - public PersonDto LastChangedBy { get; set; } - public string Parameters { get; set; } - public OrchestrationPlanDto OrchestrationPlan { get; set; } - public LogsDto Logs { get; set; } - public bool KeepForever { get; set; } - public bool RetainedByRelease { get; set; } - public object TriggeredByBuild { get; set; } - } + public string Id { get; set; } + public string BuildNumber { get; set; } + public string Status { get; set; } + public string Result { get; set; } + public DateTime QueueTime { get; set; } + public DateTime StartTime { get; set; } + public DateTime FinishTime { get; set; } + public string Url { get; set; } + public List Tags { get; set; } + public BuildDefinitionDto Definition { get; set; } + public ProjectDto Project { get; set; } + public RepositoryDto Repository { get; set; } + [JsonProperty("_links")] + public LinksDto Links { get; set; } + public object Properties { get; set; } + public List ValidationResults { get; set; } + public List Plans { get; set; } + public TriggerInfoDto TriggerInfo { get; set; } + public int BuildNumberRevision { get; set; } + public string Uri { get; set; } + public string SourceBranch { get; set; } + public string SourceVersion { get; set; } + public QueueDto Queue { get; set; } + public string Priority { get; set; } + public string Reason { get; set; } + public PersonDto RequestedFor { get; set; } + public PersonDto RequestedBy { get; set; } + public DateTime LastChangedDate { get; set; } + public PersonDto LastChangedBy { get; set; } + public string Parameters { get; set; } + public OrchestrationPlanDto OrchestrationPlan { get; set; } + public LogsDto Logs { get; set; } + public bool KeepForever { get; set; } + public bool RetainedByRelease { get; set; } + public object TriggeredByBuild { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ConditionDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ConditionDto.cs index f73544a..c170531 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ConditionDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ConditionDto.cs @@ -1,10 +1,9 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; + +public class ConditionDto { - public class ConditionDto - { - public bool Result { get; set; } - public string Name { get; set; } - public string ConditionType { get; set; } - public string Value { get; set; } - } + public bool Result { get; set; } + public string Name { get; set; } + public string ConditionType { get; set; } + public string Value { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/MappingProfiles/GenericMappingProfile.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/MappingProfiles/GenericMappingProfile.cs index cd96b3d..0c798ce 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/MappingProfiles/GenericMappingProfile.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/MappingProfiles/GenericMappingProfile.cs @@ -1,114 +1,113 @@ using AutoMapper; -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.MappingProfiles +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.MappingProfiles; + +public class GenericMappingProfile : Profile { - public class GenericMappingProfile : Profile + public override string ProfileName { - public override string ProfileName - { - get { return "AzureDevOpsRestApiGenericMappingProfile"; } - } + get { return "AzureDevOpsRestApiGenericMappingProfile"; } + } - public GenericMappingProfile() - { - CreateMap(); - CreateMap() - .ForMember(x => x.Drafts, opt => opt.Ignore()); + public GenericMappingProfile() + { + CreateMap(); + CreateMap() + .ForMember(x => x.Drafts, opt => opt.Ignore()); - CreateMap() - .ForMember(x => x.ResourceArtifactSize, opt => opt.MapFrom(x => x.Resource.Properties.ArtifactSize)) - .ForMember(x => x.ResourceData, opt => opt.MapFrom(x => x.Resource.Data)) - .ForMember(x => x.ResourceDownloadUrl, opt => opt.MapFrom(x => x.Resource.DownloadUrl)) - .ForMember(x => x.ResourceLocalPath, opt => opt.MapFrom(x => x.Resource.Properties.LocalPath)) - .ForMember(x => x.ResourceType, opt => opt.MapFrom(x => x.Resource.Type)) - .ForMember(x => x.ResourceUrl, opt => opt.MapFrom(x => x.Resource.Url)); - CreateMap() - .ForMember(x => x.Resource, opt => opt.MapFrom(x => x)); - CreateMap() - .ForMember(x => x.Data, opt => opt.MapFrom(x => x.ResourceData)) - .ForMember(x => x.DownloadUrl, opt => opt.MapFrom(x => x.ResourceDownloadUrl)) - .ForMember(x => x.Properties, opt => opt.MapFrom(x => x)) - .ForMember(x => x.Type, opt => opt.MapFrom(x => x.ResourceType)) - .ForMember(x => x.Url, opt => opt.MapFrom(x => x.ResourceUrl)); - CreateMap() - .ForMember(x => x.ArtifactSize, opt => opt.MapFrom(x => x.ResourceArtifactSize)) - .ForMember(x => x.LocalPath, opt => opt.MapFrom(x => x.ResourceLocalPath)); + CreateMap() + .ForMember(x => x.ResourceArtifactSize, opt => opt.MapFrom(x => x.Resource.Properties.ArtifactSize)) + .ForMember(x => x.ResourceData, opt => opt.MapFrom(x => x.Resource.Data)) + .ForMember(x => x.ResourceDownloadUrl, opt => opt.MapFrom(x => x.Resource.DownloadUrl)) + .ForMember(x => x.ResourceLocalPath, opt => opt.MapFrom(x => x.Resource.Properties.LocalPath)) + .ForMember(x => x.ResourceType, opt => opt.MapFrom(x => x.Resource.Type)) + .ForMember(x => x.ResourceUrl, opt => opt.MapFrom(x => x.Resource.Url)); + CreateMap() + .ForMember(x => x.Resource, opt => opt.MapFrom(x => x)); + CreateMap() + .ForMember(x => x.Data, opt => opt.MapFrom(x => x.ResourceData)) + .ForMember(x => x.DownloadUrl, opt => opt.MapFrom(x => x.ResourceDownloadUrl)) + .ForMember(x => x.Properties, opt => opt.MapFrom(x => x)) + .ForMember(x => x.Type, opt => opt.MapFrom(x => x.ResourceType)) + .ForMember(x => x.Url, opt => opt.MapFrom(x => x.ResourceUrl)); + CreateMap() + .ForMember(x => x.ArtifactSize, opt => opt.MapFrom(x => x.ResourceArtifactSize)) + .ForMember(x => x.LocalPath, opt => opt.MapFrom(x => x.ResourceLocalPath)); - CreateMap(); - CreateMap() - .ForMember(x => x.Tags, opt => opt.Ignore()) - .ForMember(x => x.Repository, opt => opt.Ignore()) - .ForMember(x => x.Links, opt => opt.Ignore()) - .ForMember(x => x.Properties, opt => opt.Ignore()) - .ForMember(x => x.ValidationResults, opt => opt.Ignore()) - .ForMember(x => x.Plans, opt => opt.Ignore()) - .ForMember(x => x.TriggerInfo, opt => opt.Ignore()) - .ForMember(x => x.BuildNumberRevision, opt => opt.Ignore()) - .ForMember(x => x.Parameters, opt => opt.Ignore()) - .ForMember(x => x.OrchestrationPlan, opt => opt.Ignore()) - .ForMember(x => x.Logs, opt => opt.Ignore()) - .ForMember(x => x.KeepForever, opt => opt.Ignore()) - .ForMember(x => x.RetainedByRelease, opt => opt.Ignore()) - .ForMember(x => x.TriggeredByBuild, opt => opt.Ignore()); + CreateMap(); + CreateMap() + .ForMember(x => x.Tags, opt => opt.Ignore()) + .ForMember(x => x.Repository, opt => opt.Ignore()) + .ForMember(x => x.Links, opt => opt.Ignore()) + .ForMember(x => x.Properties, opt => opt.Ignore()) + .ForMember(x => x.ValidationResults, opt => opt.Ignore()) + .ForMember(x => x.Plans, opt => opt.Ignore()) + .ForMember(x => x.TriggerInfo, opt => opt.Ignore()) + .ForMember(x => x.BuildNumberRevision, opt => opt.Ignore()) + .ForMember(x => x.Parameters, opt => opt.Ignore()) + .ForMember(x => x.OrchestrationPlan, opt => opt.Ignore()) + .ForMember(x => x.Logs, opt => opt.Ignore()) + .ForMember(x => x.KeepForever, opt => opt.Ignore()) + .ForMember(x => x.RetainedByRelease, opt => opt.Ignore()) + .ForMember(x => x.TriggeredByBuild, opt => opt.Ignore()); - CreateMap(); - CreateMap(); + CreateMap(); + CreateMap(); - CreateMap(); - CreateMap(); + CreateMap(); + CreateMap(); - CreateMap(); - CreateMap() - .ForMember(x => x.LastUpdateTime, opt => opt.Ignore()); + CreateMap(); + CreateMap() + .ForMember(x => x.LastUpdateTime, opt => opt.Ignore()); - CreateMap(); - CreateMap(); + CreateMap(); + CreateMap(); - CreateMap(); - CreateMap() - .ForMember(x => x.Artifacts, opt => opt.Ignore()) - .ForMember(x => x.Links, opt => opt.Ignore()); + CreateMap(); + CreateMap() + .ForMember(x => x.Artifacts, opt => opt.Ignore()) + .ForMember(x => x.Links, opt => opt.Ignore()); - CreateMap(); - CreateMap() - .ForMember(x => x.Links, opt => opt.Ignore()) - .ForMember(x => x.ProjectReference, opt => opt.Ignore()) - .ForMember(x => x.Properties, opt => opt.Ignore()) - .ForMember(x => x.Triggers, opt => opt.Ignore()) - .ForMember(x => x.Tags, opt => opt.Ignore()) - .ForMember(x => x.VariableGroups, opt => opt.Ignore()) - .ForMember(x => x.Variables, opt => opt.Ignore()); + CreateMap(); + CreateMap() + .ForMember(x => x.Links, opt => opt.Ignore()) + .ForMember(x => x.ProjectReference, opt => opt.Ignore()) + .ForMember(x => x.Properties, opt => opt.Ignore()) + .ForMember(x => x.Triggers, opt => opt.Ignore()) + .ForMember(x => x.Tags, opt => opt.Ignore()) + .ForMember(x => x.VariableGroups, opt => opt.Ignore()) + .ForMember(x => x.Variables, opt => opt.Ignore()); - CreateMap(); - CreateMap() - .ForMember(x => x.DeploySteps, opt => opt.Ignore()) - .ForMember(x => x.DeployPhasesSnapshot, opt => opt.Ignore()) - .ForMember(x => x.WorkflowTasks, opt => opt.Ignore()) - .ForMember(x => x.Conditions, opt => opt.Ignore()) - .ForMember(x => x.Demands, opt => opt.Ignore()) - .ForMember(x => x.EnvironmentOptions, opt => opt.Ignore()) - .ForMember(x => x.PostApprovalsSnapshot, opt => opt.Ignore()) - .ForMember(x => x.PreApprovalsSnapshot, opt => opt.Ignore()) - .ForMember(x => x.PreDeployApprovals, opt => opt.Ignore()) - .ForMember(x => x.PostDeployApprovals, opt => opt.Ignore()); + CreateMap(); + CreateMap() + .ForMember(x => x.DeploySteps, opt => opt.Ignore()) + .ForMember(x => x.DeployPhasesSnapshot, opt => opt.Ignore()) + .ForMember(x => x.WorkflowTasks, opt => opt.Ignore()) + .ForMember(x => x.Conditions, opt => opt.Ignore()) + .ForMember(x => x.Demands, opt => opt.Ignore()) + .ForMember(x => x.EnvironmentOptions, opt => opt.Ignore()) + .ForMember(x => x.PostApprovalsSnapshot, opt => opt.Ignore()) + .ForMember(x => x.PreApprovalsSnapshot, opt => opt.Ignore()) + .ForMember(x => x.PreDeployApprovals, opt => opt.Ignore()) + .ForMember(x => x.PostDeployApprovals, opt => opt.Ignore()); - CreateMap() - .ForMember(x => x.BuildDefinitionId, opt => opt.MapFrom(x => x.DefinitionReference.Definition.Id)) - .ForMember(x => x.BuildDefinitionName, opt => opt.MapFrom(x => x.DefinitionReference.Definition.Name)); - CreateMap() - .ForMember(x => x.DefinitionReference, opt => opt.MapFrom(x => x)); - CreateMap() - .ForMember(x => x.ArtifactSourceDefinitionUrl, opt => opt.Ignore()) - .ForMember(x => x.ArtifactSourceVersionUrl, opt => opt.Ignore()) - .ForMember(x => x.DefaultVersionBranch, opt => opt.Ignore()) - .ForMember(x => x.DefaultVersionSpecific, opt => opt.Ignore()) - .ForMember(x => x.DefaultVersionTags, opt => opt.Ignore()) - .ForMember(x => x.DefaultVersionType, opt => opt.Ignore()) - .ForMember(x => x.Definition, opt => opt.MapFrom(x => new Dto.NameValueDto { Id = x.BuildDefinitionId, Name = x.BuildDefinitionName })) - .ForMember(x => x.Project, opt => opt.Ignore()) - .ForMember(x => x.Version, opt => opt.Ignore()); + CreateMap() + .ForMember(x => x.BuildDefinitionId, opt => opt.MapFrom(x => x.DefinitionReference.Definition.Id)) + .ForMember(x => x.BuildDefinitionName, opt => opt.MapFrom(x => x.DefinitionReference.Definition.Name)); + CreateMap() + .ForMember(x => x.DefinitionReference, opt => opt.MapFrom(x => x)); + CreateMap() + .ForMember(x => x.ArtifactSourceDefinitionUrl, opt => opt.Ignore()) + .ForMember(x => x.ArtifactSourceVersionUrl, opt => opt.Ignore()) + .ForMember(x => x.DefaultVersionBranch, opt => opt.Ignore()) + .ForMember(x => x.DefaultVersionSpecific, opt => opt.Ignore()) + .ForMember(x => x.DefaultVersionTags, opt => opt.Ignore()) + .ForMember(x => x.DefaultVersionType, opt => opt.Ignore()) + .ForMember(x => x.Definition, opt => opt.MapFrom(x => new Dto.NameValueDto { Id = x.BuildDefinitionId, Name = x.BuildDefinitionName })) + .ForMember(x => x.Project, opt => opt.Ignore()) + .ForMember(x => x.Version, opt => opt.Ignore()); - CreateMap(); - } + CreateMap(); } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ProjectRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ProjectRepository.cs index 61a69e7..a6aad2d 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ProjectRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ProjectRepository.cs @@ -7,27 +7,26 @@ using AutoMapper; using Microsoft.Extensions.Logging; -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Repositories +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Repositories; + +/// +/// Project repository. +/// +/// +/// https://learn.microsoft.com/en-us/rest/api/azure/devops/core/projects +/// +public class ProjectRepository( + AzureDevOpsRestApiConfiguration configuration, + ILogger logger, + IHttpClientFactory httpClientFactory, + IMapper mapper) + : RepositoryBase(configuration, logger, httpClientFactory, mapper), IProjectRepository { - /// - /// Project repository. - /// - /// - /// https://learn.microsoft.com/en-us/rest/api/azure/devops/core/projects - /// - public class ProjectRepository( - AzureDevOpsRestApiConfiguration configuration, - ILogger logger, - IHttpClientFactory httpClientFactory, - IMapper mapper) - : RepositoryBase(configuration, logger, httpClientFactory, mapper), IProjectRepository - { - protected override string ResourceName => "_apis/projects"; + protected override string ResourceName => "_apis/projects"; - public async Task> FindAllAsync() - { - var resultList = await GetAsync>(GenerateUrl()); - return Mapper.Map>(resultList.Value); - } + public async Task> FindAllAsync() + { + var resultList = await GetAsync>(GenerateUrl()); + return Mapper.Map>(resultList.Value); } } diff --git a/src/Common.Net.Http/Common.Net.Http.csproj b/src/Common.Net.Http/Common.Net.Http.csproj deleted file mode 100644 index da325b2..0000000 --- a/src/Common.Net.Http/Common.Net.Http.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net9.0 - AlmOps.Common.Net.Http - AlmOps.Common.Net.Http - {137D8171-A4D7-486A-9AA6-BC5A5F5E4895} - enable - enable - false - - - diff --git a/src/Common.System/Common.System.csproj b/src/Common.System/Common.System.csproj deleted file mode 100644 index 4dbcadf..0000000 --- a/src/Common.System/Common.System.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net9.0 - AlmOps.Common.System - AlmOps.Common.System - {68AFEBEE-BBBF-45A2-BCB5-B4B8A7BE39A8} - enable - enable - false - - - diff --git a/src/ConsoleApp/ConsoleApp.csproj b/src/ConsoleApp/ConsoleApp.csproj index 054d0c7..5ecf232 100644 --- a/src/ConsoleApp/ConsoleApp.csproj +++ b/src/ConsoleApp/ConsoleApp.csproj @@ -2,17 +2,16 @@ Exe - net9.0 + net10.0 almops enable enable AlmOps.ConsoleApp - {9E18DEA5-68DD-4268-85FD-62E1574F7A30} true true almops ./nupkg - 13.0 + 14.0 true Command line tool to administrate ALM (Application lifecycle management) solutions like Azure DevOps or GitLab Bertrand THOMAS @@ -23,19 +22,9 @@ Linux - - full - true - - - - - - - - - + + @@ -52,8 +41,13 @@ - - + + + + + + + diff --git a/src/ConsoleApp/Dockerfile b/src/ConsoleApp/Dockerfile index c3f2792..6cd5930 100644 --- a/src/ConsoleApp/Dockerfile +++ b/src/ConsoleApp/Dockerfile @@ -1,10 +1,8 @@ -#FROM mcr.microsoft.com/dotnet/runtime:9.0 AS base -FROM registry.suse.com/bci/dotnet-aspnet:9.0 AS base +FROM registry.suse.com/bci/dotnet-aspnet:10.0 AS base USER app WORKDIR /app -#FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build -FROM registry.suse.com/bci/dotnet-sdk:9.0 AS build +FROM registry.suse.com/bci/dotnet-sdk:10.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["src/", "./"] diff --git a/src/ConsoleApp/Tasks/TaskBase.cs b/src/ConsoleApp/Tasks/TaskBase.cs index 100f41f..30b7858 100644 --- a/src/ConsoleApp/Tasks/TaskBase.cs +++ b/src/ConsoleApp/Tasks/TaskBase.cs @@ -2,7 +2,7 @@ public abstract class TaskBase : IConsoleTask { - public abstract Task ExecuteAsync(CommandLineOptions options); + public abstract Task ExecuteAsync(CommandLineOptions options); protected static Dictionary GetVariables(List inputVariables, string separator) { diff --git a/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs b/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs index 0267e06..a9eee78 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System; +using Newtonsoft.Json; namespace AlmOps.GitLabComponent.Infrastructure.RestApi.Dto; diff --git a/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj b/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj index e356b27..2a4d9d8 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj +++ b/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj @@ -1,11 +1,9 @@  - net9.0 + net10.0 AlmOps.GitLabComponent.Infrastructure.RestApi AlmOps.GitLabComponent.Infrastructure.RestApi - {AED4FA90-92D9-4DC4-ADC1-A0F1D47389F2} - enable enable diff --git a/src/GitLabComponent.Infrastructure.RestApi/GitLabRestApiConfiguration.cs b/src/GitLabComponent.Infrastructure.RestApi/GitLabRestApiConfiguration.cs index e177164..6454e55 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/GitLabRestApiConfiguration.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/GitLabRestApiConfiguration.cs @@ -1,20 +1,19 @@ -namespace AlmOps.GitLabComponent.Infrastructure.RestApi +namespace AlmOps.GitLabComponent.Infrastructure.RestApi; + +public class GitLabRestApiConfiguration { - public class GitLabRestApiConfiguration - { - /// - /// Base URL of GitLab instance. - /// Default to "https://gitlab.com". - /// - public string BaseUrl { get; init; } = "https://gitlab.com"; + /// + /// Base URL of GitLab instance. + /// Default to "https://gitlab.com". + /// + public string BaseUrl { get; init; } = "https://gitlab.com"; - /// - /// Access token. - /// Can be a User (Personal) Access Token, a Group Access Token, a Project Access Token, a Service Account Token. - /// - /// glpat-xxxxxx - public required string Token { get; init; } + /// + /// Access token. + /// Can be a User (Personal) Access Token, a Group Access Token, a Project Access Token, a Service Account Token. + /// + /// glpat-xxxxxx + public required string Token { get; init; } - public static string HttpClientName { get => "GitLabRestApiClient"; } - } + public static string HttpClientName { get => "GitLabRestApiClient"; } } diff --git a/src/GitLabComponent.Infrastructure.RestApi/Repositories/AuditEventRepository.cs b/src/GitLabComponent.Infrastructure.RestApi/Repositories/AuditEventRepository.cs index 42c6824..8e806cc 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/Repositories/AuditEventRepository.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/Repositories/AuditEventRepository.cs @@ -1,4 +1,7 @@ -using AlmOps.GitLabComponent.Infrastructure.RestApi.Dto; +using System.Collections.Generic; +using System.Net.Http; +using System.Threading.Tasks; +using AlmOps.GitLabComponent.Infrastructure.RestApi.Dto; using Microsoft.Extensions.Logging; namespace AlmOps.GitLabComponent.Infrastructure.RestApi.Repositories; diff --git a/src/GitLabComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs b/src/GitLabComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs index 519a3cf..63e366b 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Logging; +using System.Net.Http; +using Microsoft.Extensions.Logging; using Withywoods.Net.Http; namespace AlmOps.GitLabComponent.Infrastructure.RestApi.Repositories; diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.csproj b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.csproj index 7cfe6bd..713cf57 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.csproj +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.csproj @@ -1,10 +1,10 @@ - net9.0 + net10.0 AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests - {ED040615-CB13-4DF5-9D0B-33BF464F8F36} + enable false diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs index cdaa9d2..e4f5515 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs @@ -3,57 +3,56 @@ using AutoMapper; using Microsoft.Extensions.DependencyInjection; -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests; + +public abstract class RepositoryIntegrationTestBase { - public abstract class RepositoryIntegrationTestBase - { - private readonly string _environmentName; + private readonly string _environmentName; + + protected ServiceProvider ServiceProvider { get; private set; } - protected ServiceProvider ServiceProvider { get; private set; } + protected AzureDevOpsRestApiConfiguration Configuration { get; } - protected AzureDevOpsRestApiConfiguration Configuration { get; } + protected string ProjectName { get; private set; } - protected string ProjectName { get; private set; } + protected RepositoryIntegrationTestBase(string environmentName) + { + _environmentName = environmentName; - protected RepositoryIntegrationTestBase(string environmentName) + Configuration = new AzureDevOpsRestApiConfiguration { - _environmentName = environmentName; + BaseUrl = "https://dev.azure.com/" + GetEnvironmentVariable("Organization"), + Username = GetEnvironmentVariable("Username"), + Token = GetEnvironmentVariable("Token") + }; - Configuration = new AzureDevOpsRestApiConfiguration - { - BaseUrl = "https://dev.azure.com/" + GetEnvironmentVariable("Organization"), - Username = GetEnvironmentVariable("Username"), - Token = GetEnvironmentVariable("Token") - }; + ProjectName = GetEnvironmentVariable("Project"); - ProjectName = GetEnvironmentVariable("Project"); + var mappingConfig = new MapperConfiguration(x => + { + x.AddProfile(new MappingProfiles.GenericMappingProfile()); + x.AllowNullCollections = true; + }); - var mappingConfig = new MapperConfiguration(x => - { - x.AddProfile(new MappingProfiles.GenericMappingProfile()); - x.AllowNullCollections = true; - }); + var services = new ServiceCollection() + .AddLogging() + .AddSingleton(mappingConfig.CreateMapper()) + .AddAzureDevOpsRestApi(Configuration); - var services = new ServiceCollection() - .AddLogging() - .AddSingleton(mappingConfig.CreateMapper()) - .AddAzureDevOpsRestApi(Configuration); + ServiceProvider = services.BuildServiceProvider(); + } - ServiceProvider = services.BuildServiceProvider(); - } + protected string GetEnvironmentVariable(string key) + { + ArgumentNullException.ThrowIfNull(key); - protected string GetEnvironmentVariable(string key) + var name = $"AlmOps__{_environmentName}__{key}"; + var output = Environment.GetEnvironmentVariable(name); + if (string.IsNullOrEmpty(output)) { - ArgumentNullException.ThrowIfNull(key); - - var name = $"AlmOps__{_environmentName}__{key}"; - var output = Environment.GetEnvironmentVariable(name); - if (string.IsNullOrEmpty(output)) - { - throw new ArgumentException($"Environment variable \"{name}\" is not defined or empty"); - } - - return output; + throw new ArgumentException($"Environment variable \"{name}\" is not defined or empty"); } + + return output; } } diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.csproj b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.csproj index 06f462a..1b79c40 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.csproj +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.csproj @@ -1,17 +1,16 @@  - net9.0 + net10.0 AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.UnitTests AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.UnitTests - {889EF283-E155-490B-B85A-6FD98F73927D} + enable false - - full - true - + + + @@ -33,8 +32,4 @@ - - - - diff --git a/test/ConsoleApp.IntegrationTests/ConsoleApp.IntegrationTests.csproj b/test/ConsoleApp.IntegrationTests/ConsoleApp.IntegrationTests.csproj index 3035f28..b5fef40 100644 --- a/test/ConsoleApp.IntegrationTests/ConsoleApp.IntegrationTests.csproj +++ b/test/ConsoleApp.IntegrationTests/ConsoleApp.IntegrationTests.csproj @@ -1,15 +1,17 @@  - net9.0 + net10.0 AlmOps.ConsoleApp.IntegrationTests AlmOps.ConsoleApp.IntegrationTests - {169FC181-09AE-414D-8607-07F472EB8C44} - enable enable false + + + + @@ -33,8 +35,4 @@ - - - - diff --git a/test/ConsoleApp.IntegrationTests/SmokeTest.cs b/test/ConsoleApp.IntegrationTests/SmokeTest.cs index 865e84d..56a7443 100644 --- a/test/ConsoleApp.IntegrationTests/SmokeTest.cs +++ b/test/ConsoleApp.IntegrationTests/SmokeTest.cs @@ -1,4 +1,7 @@ -using FluentAssertions; +using System; +using System.Linq; +using System.Threading.Tasks; +using FluentAssertions; namespace AlmOps.ConsoleApp.IntegrationTests; @@ -25,11 +28,6 @@ private static string GetEnvironmentVariable(string key) var name = $"AlmOps__Sandbox__{key}"; var output = Environment.GetEnvironmentVariable(name); - if (string.IsNullOrEmpty(output)) - { - throw new ArgumentException($"Environment variable \"{name}\" is not defined or empty"); - } - - return output; + return string.IsNullOrEmpty(output) ? throw new ArgumentException($"Environment variable \"{name}\" is not defined or empty") : output; } } diff --git a/test/ConsoleApp.UnitTests/ConsoleApp.UnitTests.csproj b/test/ConsoleApp.UnitTests/ConsoleApp.UnitTests.csproj index a94b48c..59285a0 100644 --- a/test/ConsoleApp.UnitTests/ConsoleApp.UnitTests.csproj +++ b/test/ConsoleApp.UnitTests/ConsoleApp.UnitTests.csproj @@ -1,17 +1,16 @@  - net9.0 + net10.0 AlmOps.ConsoleApp.UnitTests AlmOps.ConsoleApp.UnitTests - {933E5B0A-BA55-4768-8380-91DE2A253D53} + enable false - - full - true - + + + @@ -32,10 +31,6 @@ - - - - PreserveNewest diff --git a/test/ConsoleApp.UnitTests/Tasks/ConsoleTaskFactoryTest.cs b/test/ConsoleApp.UnitTests/Tasks/ConsoleTaskFactoryTest.cs index 3a0e2c3..eba2d2f 100644 --- a/test/ConsoleApp.UnitTests/Tasks/ConsoleTaskFactoryTest.cs +++ b/test/ConsoleApp.UnitTests/Tasks/ConsoleTaskFactoryTest.cs @@ -6,61 +6,60 @@ using Microsoft.Extensions.DependencyInjection; using Xunit; -namespace AlmOps.ConsoleApp.UnitTests.Tasks +namespace AlmOps.ConsoleApp.UnitTests.Tasks; + +[Trait("Category", "UnitTests")] +public class ConsoleTaskFactoryTest { - [Trait("Category", "UnitTests")] - public class ConsoleTaskFactoryTest - { - private readonly ServiceProvider _serviceProvider; + private readonly ServiceProvider _serviceProvider; - public ConsoleTaskFactoryTest() - { - var services = new ServiceCollection() - .AddLogging() - .AddAzureDevOpsRestApi(new AzureDevOpsRestApiConfiguration()) - .AddSingleton(new MapperConfiguration(x => { }).CreateMapper()); + public ConsoleTaskFactoryTest() + { + var services = new ServiceCollection() + .AddLogging() + .AddAzureDevOpsRestApi(new AzureDevOpsRestApiConfiguration()) + .AddSingleton(new MapperConfiguration(x => { }).CreateMapper()); - _serviceProvider = services.BuildServiceProvider(); - } + _serviceProvider = services.BuildServiceProvider(); + } - [Theory] - [InlineData("list", "projects", "ListProjectTask")] - [InlineData("show", "build", "ShowBuildTask")] - [InlineData("queue", "build", "QueueBuildTask")] - [InlineData("list", "builds", "ListBuildTask")] - [InlineData("list", "artifacts", "ListArtifactTask")] - [InlineData("create", "release", "CreateReleaseTask")] - [InlineData("update", "variables", "UpdateVariableTask")] - public void ConsoleTaskFactoryCreate_ShouldCoverAllOptions(string action, string resource, string taskClassName) - { - // Arrange - var factory = new ConsoleTaskFactory(_serviceProvider); + [Theory] + [InlineData("list", "projects", "ListProjectTask")] + [InlineData("show", "build", "ShowBuildTask")] + [InlineData("queue", "build", "QueueBuildTask")] + [InlineData("list", "builds", "ListBuildTask")] + [InlineData("list", "artifacts", "ListArtifactTask")] + [InlineData("create", "release", "CreateReleaseTask")] + [InlineData("update", "variables", "UpdateVariableTask")] + public void ConsoleTaskFactoryCreate_ShouldCoverAllOptions(string action, string resource, string taskClassName) + { + // Arrange + var factory = new ConsoleTaskFactory(_serviceProvider); - // Act - var task = factory.Create(action, resource, out var errorMessage); + // Act + var task = factory.Create(action, resource, out var errorMessage); - // Assert - errorMessage.Should().BeNull(); - task.Should().NotBeNull(); - task.GetType().Name.Should().Be(taskClassName); - } + // Assert + errorMessage.Should().BeNull(); + task.Should().NotBeNull(); + task.GetType().Name.Should().Be(taskClassName); + } - [Theory] - [InlineData("list", null, "Unknown resource \"\". Available resources: \"projects\", \"build\", \"builds\", \"artifacts\", \"release\", \"variables\"")] - [InlineData("list", "", "Unknown resource \"\". Available resources: \"projects\", \"build\", \"builds\", \"artifacts\", \"release\", \"variables\"")] - [InlineData("edit", "projects", "Unknown action \"edit\" for resource \"projects\"")] - public void ConsoleTaskFactoryCreate_ShouldSetErrorMessageOnInvalidOptions(string action, string resource, string expected) - { - // Arrange - var factory = new ConsoleTaskFactory(_serviceProvider); + [Theory] + [InlineData("list", null, "Unknown resource \"\". Available resources: \"projects\", \"build\", \"builds\", \"artifacts\", \"release\", \"variables\"")] + [InlineData("list", "", "Unknown resource \"\". Available resources: \"projects\", \"build\", \"builds\", \"artifacts\", \"release\", \"variables\"")] + [InlineData("edit", "projects", "Unknown action \"edit\" for resource \"projects\"")] + public void ConsoleTaskFactoryCreate_ShouldSetErrorMessageOnInvalidOptions(string action, string resource, string expected) + { + // Arrange + var factory = new ConsoleTaskFactory(_serviceProvider); - // Act - var task = factory.Create(action, resource, out var actual); + // Act + var task = factory.Create(action, resource, out var actual); - // Assert - task.Should().BeNull(); - actual.Should().NotBeNull(); - actual.Should().Be(expected); - } + // Assert + task.Should().BeNull(); + actual.Should().NotBeNull(); + actual.Should().Be(expected); } } diff --git a/test/ConsoleApp.UnitTests/Tasks/TaskBaseTest.cs b/test/ConsoleApp.UnitTests/Tasks/TaskBaseTest.cs index 68e3849..5dca59b 100644 --- a/test/ConsoleApp.UnitTests/Tasks/TaskBaseTest.cs +++ b/test/ConsoleApp.UnitTests/Tasks/TaskBaseTest.cs @@ -4,50 +4,49 @@ using FluentAssertions; using Xunit; -namespace AlmOps.ConsoleApp.UnitTests.Tasks +namespace AlmOps.ConsoleApp.UnitTests.Tasks; + +[Trait("Category", "UnitTests")] +public class TaskBaseTest { - [Trait("Category", "UnitTests")] - public class TaskBaseTest + private class DummyTask : TaskBase { - private class DummyTask : TaskBase + public override Task ExecuteAsync(CommandLineOptions options) { - public override Task ExecuteAsync(CommandLineOptions options) - { - return null; - } - - public new static Dictionary GetVariables(List inputVariables, string separator) - { - return TaskBase.GetVariables(inputVariables, separator); - } + return null; } - [Fact] - public void TaskBaseGetVariables_ShouldReturnDictionary() + public new static Dictionary GetVariables(List inputVariables, string separator) { - var task = new DummyTask(); - var output = DummyTask.GetVariables(["toto:titi", "tutu:tyty"], ":"); - output.Should().NotBeNull(); - output.Should().NotBeEmpty(); - output.Count.Should().Be(2); - output.Should().ContainKey("toto"); - output["toto"].Should().Be("titi"); - output.Should().ContainKey("tutu"); - output["tutu"].Should().Be("tyty"); + return TaskBase.GetVariables(inputVariables, separator); } + } - [Fact] - public void TaskBaseGetVariables_WithSeparatorCharacter_ShouldReturnDictionary() - { - var task = new DummyTask(); - var output = DummyTask.GetVariables(["connectionString:https://www.google.com", "complexPassword:Pass:Word:123"], ":"); - output.Should().NotBeNull(); - output.Should().NotBeEmpty(); - output.Count.Should().Be(2); - output.Should().ContainKey("connectionString"); - output["connectionString"].Should().Be("https://www.google.com"); - output.Should().ContainKey("complexPassword"); - output["complexPassword"].Should().Be("Pass:Word:123"); - } + [Fact] + public void TaskBaseGetVariables_ShouldReturnDictionary() + { + var task = new DummyTask(); + var output = DummyTask.GetVariables(["toto:titi", "tutu:tyty"], ":"); + output.Should().NotBeNull(); + output.Should().NotBeEmpty(); + output.Count.Should().Be(2); + output.Should().ContainKey("toto"); + output["toto"].Should().Be("titi"); + output.Should().ContainKey("tutu"); + output["tutu"].Should().Be("tyty"); + } + + [Fact] + public void TaskBaseGetVariables_WithSeparatorCharacter_ShouldReturnDictionary() + { + var task = new DummyTask(); + var output = DummyTask.GetVariables(["connectionString:https://www.google.com", "complexPassword:Pass:Word:123"], ":"); + output.Should().NotBeNull(); + output.Should().NotBeEmpty(); + output.Count.Should().Be(2); + output.Should().ContainKey("connectionString"); + output["connectionString"].Should().Be("https://www.google.com"); + output.Should().ContainKey("complexPassword"); + output["complexPassword"].Should().Be("Pass:Word:123"); } } diff --git a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/AuditEventRepositoryTest.cs b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/AuditEventRepositoryTest.cs index dfdf5b7..1915021 100644 --- a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/AuditEventRepositoryTest.cs +++ b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/AuditEventRepositoryTest.cs @@ -1,4 +1,4 @@ -using AlmOps.Common.System; +using System.Threading.Tasks; using AlmOps.GitLabComponent.Infrastructure.RestApi.Repositories; using FluentAssertions; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Common.System/EnvironmentExtensions.cs b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/EnvironmentExtensions.cs similarity index 54% rename from src/Common.System/EnvironmentExtensions.cs rename to test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/EnvironmentExtensions.cs index 21fbd53..fcfa958 100644 --- a/src/Common.System/EnvironmentExtensions.cs +++ b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/EnvironmentExtensions.cs @@ -1,4 +1,6 @@ -namespace AlmOps.Common.System; +using System; + +namespace AlmOps.GitLabComponent.Infrastructure.RestApi.IntegrationTests; public static class EnvironmentExtensions { @@ -6,11 +8,6 @@ public static string GetEnvironmentVariable(string environment, string provider, { var name = $"AlmOps__{environment}__{provider}__{key}"; var output = Environment.GetEnvironmentVariable(name); - if (string.IsNullOrEmpty(output)) - { - throw new ArgumentException($"Environment variable \"{name}\" is not defined or empty"); - } - - return output; + return string.IsNullOrEmpty(output) ? throw new ArgumentException($"Environment variable \"{name}\" is not defined or empty") : output; } } diff --git a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/GitLabComponent.Infrastructure.RestApi.IntegrationTests.csproj b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/GitLabComponent.Infrastructure.RestApi.IntegrationTests.csproj index 8463b25..ee6c61d 100644 --- a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/GitLabComponent.Infrastructure.RestApi.IntegrationTests.csproj +++ b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/GitLabComponent.Infrastructure.RestApi.IntegrationTests.csproj @@ -1,15 +1,17 @@  - net9.0 + net10.0 AlmOps.GitLabComponent.Infrastructure.RestApi.IntegrationTests AlmOps.GitLabComponent.Infrastructure.RestApi.IntegrationTests - {E58DF28F-2EA0-4D30-9882-0524D7D7CC0F} - enable enable false + + + + all @@ -31,9 +33,4 @@ - - - - - diff --git a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs index 22e5273..6eaae19 100644 --- a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs +++ b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs @@ -1,25 +1,23 @@ -using AlmOps.Common.System; -using AlmOps.GitLabComponent.Infrastructure.RestApi.DependencyInjection; +using AlmOps.GitLabComponent.Infrastructure.RestApi.DependencyInjection; using Microsoft.Extensions.DependencyInjection; -namespace AlmOps.GitLabComponent.Infrastructure.RestApi.IntegrationTests +namespace AlmOps.GitLabComponent.Infrastructure.RestApi.IntegrationTests; + +public abstract class RepositoryIntegrationTestBase { - public abstract class RepositoryIntegrationTestBase - { - protected ServiceProvider ServiceProvider { get; private set; } + protected ServiceProvider ServiceProvider { get; private set; } - protected RepositoryIntegrationTestBase(string environmentName) + protected RepositoryIntegrationTestBase(string environmentName) + { + var configuration = new GitLabRestApiConfiguration { - var configuration = new GitLabRestApiConfiguration - { - Token = EnvironmentExtensions.GetEnvironmentVariable(environmentName, "GitLab", "Token") - }; + Token = EnvironmentExtensions.GetEnvironmentVariable(environmentName, "GitLab", "Token") + }; - var services = new ServiceCollection() - .AddLogging() - .AddGitLabRestApi(configuration); + var services = new ServiceCollection() + .AddLogging() + .AddGitLabRestApi(configuration); - ServiceProvider = services.BuildServiceProvider(); - } + ServiceProvider = services.BuildServiceProvider(); } } From 2817cfb284976779b0a6d8e2decf736ac91c648b Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Mon, 12 Oct 2026 22:41:26 +0200 Subject: [PATCH 04/34] Mention IstarCI in the contributing guide Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01112KFMMQPYUFHrwHm3zKBd --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dcfaebd..4dac351 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,6 +67,11 @@ docker run -it --rm --name almops \ devprofr/almops list projects ``` +## Run the pipeline locally + +[IstarCI](https://github.com/devpro/istarci) runs the GitLab CI pipeline in Docker before the push. +`istarci add` and `istarci install-hook` set it up for this repository. + ## References ### Azure DevOps documentation From 79e2dfc38104502f34dc74feb28634779132dd39 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Mon, 12 Oct 2026 22:51:00 +0200 Subject: [PATCH 05/34] Run the GitLab pipeline on every commit through IstarCI Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01112KFMMQPYUFHrwHm3zKBd --- .istarci.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .istarci.yml diff --git a/.istarci.yml b/.istarci.yml new file mode 100644 index 0000000..5ce67ee --- /dev/null +++ b/.istarci.yml @@ -0,0 +1,5 @@ +# IstarCI configuration, read from the root of the repository. + +workflow: + # The pipeline runs on a merge request or on the default branch only, so a local run on a feature branch skips the rules instead of evaluating them. + respectTriggers: false From 6dc3b7f9c87a2535024553b2ff5ed0e47f8bb93d Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Mon, 12 Oct 2026 23:26:11 +0200 Subject: [PATCH 06/34] Build with the .NET 10 SDK, and keep the images of the jobs in a local run Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01112KFMMQPYUFHrwHm3zKBd --- .gitlab-ci.yml | 2 +- .istarci.yml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ea2714a..f989bb6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,7 +20,7 @@ variables: IMAGE_LATEST: $IMAGE_REPOSITORY:latest .dotnet: - image: mcr.microsoft.com/dotnet/sdk:9.0 + image: mcr.microsoft.com/dotnet/sdk:10.0 variables: DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 diff --git a/.istarci.yml b/.istarci.yml index 5ce67ee..838c060 100644 --- a/.istarci.yml +++ b/.istarci.yml @@ -1,5 +1,11 @@ # IstarCI configuration, read from the root of the repository. +runner: + # The global default image would replace the one each job of the pipeline declares, and these are the ones it declares. + image: ghcr.io/devpro/ubuntu-dotnet:latest + images: + "podman-*": quay.io/podman/stable:latest + workflow: # The pipeline runs on a merge request or on the default branch only, so a local run on a feature branch skips the rules instead of evaluating them. respectTriggers: false From 0f5def321227f5f72934a579ef539742fba13020 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 13 Oct 2026 00:40:29 +0200 Subject: [PATCH 07/34] Let the jobs run in the images the pipeline declares, which IstarCI now keeps Co-Authored-By: Claude Opus 5.5 --- .istarci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.istarci.yml b/.istarci.yml index 838c060..5ce67ee 100644 --- a/.istarci.yml +++ b/.istarci.yml @@ -1,11 +1,5 @@ # IstarCI configuration, read from the root of the repository. -runner: - # The global default image would replace the one each job of the pipeline declares, and these are the ones it declares. - image: ghcr.io/devpro/ubuntu-dotnet:latest - images: - "podman-*": quay.io/podman/stable:latest - workflow: # The pipeline runs on a merge request or on the default branch only, so a local run on a feature branch skips the rules instead of evaluating them. respectTriggers: false From 69b81e16b232847955a5643a5e02f864f58e46db Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 13 Oct 2026 02:00:23 +0200 Subject: [PATCH 08/34] Run the podman jobs privileged, as a GitLab runner does Co-Authored-By: Claude Opus 5.5 --- .istarci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.istarci.yml b/.istarci.yml index 5ce67ee..d139396 100644 --- a/.istarci.yml +++ b/.istarci.yml @@ -1,5 +1,10 @@ # IstarCI configuration, read from the root of the repository. +runner: + # podman builds and loads images, which needs the privileged container a GitLab runner gives it. + privileged: + - "podman-*" + workflow: # The pipeline runs on a merge request or on the default branch only, so a local run on a feature branch skips the rules instead of evaluating them. respectTriggers: false From 4d20d1dae6445f956e0400ef785235af0f1bbf73 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 13 Oct 2026 02:09:29 +0200 Subject: [PATCH 09/34] Name the image locally, as the registry variables live in the GitLab project settings Co-Authored-By: Claude Opus 5.5 --- .istarci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.istarci.yml b/.istarci.yml index d139396..da63f0f 100644 --- a/.istarci.yml +++ b/.istarci.yml @@ -8,3 +8,8 @@ runner: workflow: # The pipeline runs on a merge request or on the default branch only, so a local run on a feature branch skips the rules instead of evaluating them. respectTriggers: false + +# The project CI/CD variables of GitLab, with local values: the image is built and scanned here, and pushed only from main on GitLab. +vars: + CONTAINER_REGISTRY_DOMAIN: localhost + CONTAINER_REGISTRY_USER: local From 360aae4cb2a9edc29464f6ae9f3eebcf60fde51d Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 13 Oct 2026 02:34:17 +0200 Subject: [PATCH 10/34] Run the NeuVector scan privileged, for its docker:dind service Co-Authored-By: Claude Opus 5.5 --- .istarci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.istarci.yml b/.istarci.yml index da63f0f..e4e0f74 100644 --- a/.istarci.yml +++ b/.istarci.yml @@ -1,9 +1,10 @@ # IstarCI configuration, read from the root of the repository. runner: - # podman builds and loads images, which needs the privileged container a GitLab runner gives it. + # podman builds and loads images, and docker:dind serves the scan, which need the privileged containers a GitLab runner gives them. privileged: - "podman-*" + - neuvector_scan workflow: # The pipeline runs on a merge request or on the default branch only, so a local run on a feature branch skips the rules instead of evaluating them. From bd48645b295771720e6ccfd9a44cbd1730e4b389 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 13 Oct 2026 13:36:40 +0200 Subject: [PATCH 11/34] Leave out of a local run the jobs that need real credentials Co-Authored-By: Claude Opus 5.5 --- .istarci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.istarci.yml b/.istarci.yml index e4e0f74..8bc0f56 100644 --- a/.istarci.yml +++ b/.istarci.yml @@ -7,6 +7,10 @@ runner: - neuvector_scan workflow: + # IstarCI holds no external credential: the scan logs in to Docker Hub, and the tests run against live Azure DevOps and GitLab sandboxes. + skipJobs: + - neuvector_scan + - dotnet-test # The pipeline runs on a merge request or on the default branch only, so a local run on a feature branch skips the rules instead of evaluating them. respectTriggers: false From 49b94001f476049756eecca61005a2f20ad33b8e Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 13 Oct 2026 14:00:25 +0200 Subject: [PATCH 12/34] Run the unit tests and the analysis locally, against the local SonarQube and without the sandbox tests Co-Authored-By: Claude Opus 5.5 --- .gitlab-ci.yml | 4 +++- .istarci.yml | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f989bb6..97a4757 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,6 +44,8 @@ dotnet-test: DOTNET_TEST_REPORT_FOLDER: report # other options available: /d:sonar.coverage.exclusions=... /d:sonar.cpd.exclusions=**/Models/*.cs,**/Dto/*.cs SONAR_EXTRA_PARAMETERS: /d:sonar.cpd.exclusions=**/*Generated*.cs,report/** /d:sonar.coverageReportPaths=report/SonarQube.xml + # empty runs every test, and a local run filters out the ones against live sandboxes + DOTNET_TEST_EXTRA_PARAMETERS: "" AlmOps__Sandbox__Organization: $AZUREDEVOPS_TEST_ORG AlmOps__Sandbox__Username: $AZUREDEVOPS_TEST_USERNAME AlmOps__Sandbox__Token: $AZUREDEVOPS_TEST_TOKEN @@ -65,7 +67,7 @@ dotnet-test: - export PATH="$PATH:/root/.dotnet/tools" script: - dotnet sonarscanner begin /o:$SONAR_ORGANIZATION /k:$SONAR_PROJECTKEY /n:AlmOps /d:sonar.host.url=$SONAR_HOSTURL /d:sonar.token=$SONAR_TOKEN $SONAR_EXTRA_PARAMETERS - - dotnet test --configuration Debug --logger:"junit;LogFilePath=..\..\artifacts\{assembly}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage" + - dotnet test --configuration Debug --logger:"junit;LogFilePath=..\..\artifacts\{assembly}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage" $DOTNET_TEST_EXTRA_PARAMETERS - reportgenerator "-reports:$DOTNET_TEST_COVERAGE_XMLFILES" -targetdir:$DOTNET_TEST_REPORT_FOLDER "-reporttypes:Cobertura;Html;TextSummary;SonarQube" - dotnet sonarscanner end /d:sonar.token=$SONAR_TOKEN - cat $DOTNET_TEST_REPORT_FOLDER/Summary.txt diff --git a/.istarci.yml b/.istarci.yml index 8bc0f56..707024b 100644 --- a/.istarci.yml +++ b/.istarci.yml @@ -5,12 +5,13 @@ runner: privileged: - "podman-*" - neuvector_scan + # The analysis of dotnet-test runs against the SonarQube IstarCI starts on this machine, with a token made there. + sonarqube: true workflow: - # IstarCI holds no external credential: the scan logs in to Docker Hub, and the tests run against live Azure DevOps and GitLab sandboxes. + # IstarCI holds no external credential, and the scan logs in to Docker Hub. skipJobs: - neuvector_scan - - dotnet-test # The pipeline runs on a merge request or on the default branch only, so a local run on a feature branch skips the rules instead of evaluating them. respectTriggers: false @@ -18,3 +19,9 @@ workflow: vars: CONTAINER_REGISTRY_DOMAIN: localhost CONTAINER_REGISTRY_USER: local + # The local SonarQube, under the names dotnet-test reads. + SONAR_HOSTURL: $SONAR_HOST_URL + SONAR_ORGANIZATION: local + SONAR_PROJECTKEY: almops + # The tests against live Azure DevOps and GitLab sandboxes need real credentials, which IstarCI never holds. + DOTNET_TEST_EXTRA_PARAMETERS: --filter Environment!=Sandbox From b3b0f89064c94a835ede422681e523ecc2825b28 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 20 Oct 2026 15:40:24 +0200 Subject: [PATCH 13/34] Remove dependabot file --- .github/dependabot.yml | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 6886161..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,37 +0,0 @@ -version: 2 -updates: -- package-ecosystem: nuget - directory: "/" - schedule: - interval: daily - time: "04:00" - open-pull-requests-limit: 10 - ignore: - - dependency-name: AutoFixture - versions: - - 4.16.0 - - dependency-name: Withywoods.Serialization - versions: - - 1.4.1 - - dependency-name: Withywoods.System - versions: - - 1.4.1 - - dependency-name: Withywoods.Configuration - versions: - - 1.4.1 - - dependency-name: Withywoods.Net.Http - versions: - - 1.4.1 - - dependency-name: Microsoft.NET.Test.Sdk - versions: - - 16.9.1 - - dependency-name: Bogus - versions: - - 32.1.1 - - 33.0.1 - - dependency-name: coverlet.collector - versions: - - 3.0.2 - - dependency-name: Moq - versions: - - 4.16.0 From 15f217beedd8fc116b960487b55cd9a726aa917f Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 20 Oct 2026 15:53:16 +0200 Subject: [PATCH 14/34] Add the agent guidance, merged from the conventions of the other .NET repositories Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 1 + 2 files changed, 76 insertions(+) create mode 100644 AGENTS.md create mode 100644 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..5491171 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,75 @@ +# AGENTS.md + +Guidance for coding agents working in this repository. + +## Project overview + +almops is a command line tool to administrate ALM solutions: Azure DevOps through its REST API, and GitLab audit events. +It is .NET 10 / C#, shipped as the `almops` .NET global tool on NuGet and as the `devprofr/almops` container image. + +Project | Role +------------------------------------------|---------------------------------------------------------------- +`src/ConsoleApp` | Command line parsing, configuration and one task per action +`src/AzureDevOpsComponent.Domain` | Models and repository interfaces +`src/*Component.Infrastructure.RestApi` | REST API clients, DTOs and the Mapperly mapper from DTO to model +`samples/SamlTokenClaimEnricher` | Independent Azure Function sample + +## Working rules + +**Every command runs in the foreground, and the agent waits for it.** +No background command, no subagent, no fork, no parallel task, even for a long command. + +**Linters for Markdown and YAML are never run by an agent, and never imitated by hand.** +An agent that notices text a linter might flag says so in its report and changes nothing. +`dotnet format --verify-no-changes --severity warn`, which CI runs on the C# code, is a check and may be run. + +**Only GitHub Actions published by `github` or `docker` are allowed in workflows.** +Reusable workflows and actions of `devpro/github-workflow-parts` are also allowed. + +**The CI is the GitHub Actions pipeline, which IstarCI runs locally on every commit.** +`istarci status .` shows the last run and `istarci logs . --job ` the log of a job. +`.istarci.yml` gives a local run the repository variables it would otherwise get as placeholders. + +**Test before code when applicable.** +A regression test is seen failing for the stated reason before the fix. + +**The machine is left as it was found, apart from the intended changes.** + +**Preserve existing comments and formatting when editing a file.** +Commit only when asked, and never push. + +**Documentation is as short as possible, and headers stay.** + +## Writing style + +Applies to Markdown, code comments, commit messages and prose in scripts. + +- **A comment says why, not what, and the why is timeless.** + It records the failure it prevents or the constraint that made the obvious shape wrong, never the story of the change. +- **One thought per line.** + Every sentence starts on its own line, and a long one breaks at a clause boundary, never to fit a width. +- **No em dash, no en dash.** + A colon, a comma, or a full stop. +- **No second person.** + "The working tree", not "your working tree"; ``, not ``. + +## Conventions + +- NuGet versions are managed centrally in `Directory.Packages.props`: `PackageReference` entries in csproj files have no `Version` attribute. +- Release version is `VersionPrefix` in `Directory.Build.props`. +- No package with a license issue: Mapperly maps, never AutoMapper; AwesomeAssertions asserts, never FluentAssertions. +- Tests use xunit v3 on the Microsoft Testing Platform (`global.json`), so runner options go after `--` with `dotnet test --project`. +- A test reaching a live Azure DevOps or GitLab sandbox carries `[Trait("Environment", "Sandbox")]` and reads its credentials from `AlmOps__Sandbox__*` environment variables. +- C# style is enforced by `.editorconfig`. +- Shell scripts are named in `snake_case` and committed with the executable bit set (`git update-index --chmod=+x`). +- Target platform is Linux, including WSL2, and `bash`. + +## Commands + +```bash +dotnet build +dotnet test -- --filter-not-trait "Environment=Sandbox" --ignore-exit-code 8 +dotnet run --project src/ConsoleApp -- list projects +``` + +Exit code 8 means a test project ran no test, which every integration project does without the sandbox credentials of [CONTRIBUTING.md](CONTRIBUTING.md). diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md From beaeea8a3d6fb4d6b8aa1f8505e55a46dd61b650 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 20 Oct 2026 15:54:50 +0200 Subject: [PATCH 15/34] Set the NuGet package versions in one place, with central package management Co-Authored-By: Claude Opus 5.5 --- AlmOps.slnx | 3 +- Directory.Packages.props | 38 +++++++++++++++++++ .../SamlTokenClaimEnricher.csproj | 12 +++--- ...OpsComponent.Infrastructure.RestApi.csproj | 10 ++--- src/ConsoleApp/ConsoleApp.csproj | 20 +++++----- ...LabComponent.Infrastructure.RestApi.csproj | 8 ++-- ...astructure.RestApi.IntegrationTests.csproj | 20 +++++----- ...nt.Infrastructure.RestApi.UnitTests.csproj | 22 +++++------ .../ConsoleApp.IntegrationTests.csproj | 20 +++++----- .../ConsoleApp.UnitTests.csproj | 20 +++++----- ...astructure.RestApi.IntegrationTests.csproj | 16 ++++---- 11 files changed, 114 insertions(+), 75 deletions(-) create mode 100644 Directory.Packages.props diff --git a/AlmOps.slnx b/AlmOps.slnx index c06da3b..eec2fe3 100644 --- a/AlmOps.slnx +++ b/AlmOps.slnx @@ -5,7 +5,8 @@ - + + diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000..2b7c488 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,38 @@ + + + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj b/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj index 03d3437..2fa1d50 100644 --- a/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj +++ b/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj @@ -10,12 +10,12 @@ - - - - - - + + + + + + diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj index 51401fa..1a048ac 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj @@ -12,11 +12,11 @@ - - - - - + + + + + diff --git a/src/ConsoleApp/ConsoleApp.csproj b/src/ConsoleApp/ConsoleApp.csproj index 5ecf232..15116cb 100644 --- a/src/ConsoleApp/ConsoleApp.csproj +++ b/src/ConsoleApp/ConsoleApp.csproj @@ -28,16 +28,16 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj b/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj index 2a4d9d8..cbe8a48 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj +++ b/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj @@ -8,10 +8,10 @@ - - - - + + + + diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.csproj b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.csproj index 713cf57..62c89f6 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.csproj +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.csproj @@ -14,19 +14,19 @@ - - - - - - - - - + + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.csproj b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.csproj index 1b79c40..e0880bc 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.csproj +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.csproj @@ -13,20 +13,20 @@ - - - - - - - - - - + + + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/ConsoleApp.IntegrationTests/ConsoleApp.IntegrationTests.csproj b/test/ConsoleApp.IntegrationTests/ConsoleApp.IntegrationTests.csproj index b5fef40..50ad57c 100644 --- a/test/ConsoleApp.IntegrationTests/ConsoleApp.IntegrationTests.csproj +++ b/test/ConsoleApp.IntegrationTests/ConsoleApp.IntegrationTests.csproj @@ -13,19 +13,19 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/ConsoleApp.UnitTests/ConsoleApp.UnitTests.csproj b/test/ConsoleApp.UnitTests/ConsoleApp.UnitTests.csproj index 59285a0..a495cb8 100644 --- a/test/ConsoleApp.UnitTests/ConsoleApp.UnitTests.csproj +++ b/test/ConsoleApp.UnitTests/ConsoleApp.UnitTests.csproj @@ -13,19 +13,19 @@ - - - - - - - - - + + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/GitLabComponent.Infrastructure.RestApi.IntegrationTests.csproj b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/GitLabComponent.Infrastructure.RestApi.IntegrationTests.csproj index ee6c61d..4edb15c 100644 --- a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/GitLabComponent.Infrastructure.RestApi.IntegrationTests.csproj +++ b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/GitLabComponent.Infrastructure.RestApi.IntegrationTests.csproj @@ -13,17 +13,17 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive From fe8badcc4d2e13abbd905fee7fd9f2be48992634 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 20 Oct 2026 15:56:14 +0200 Subject: [PATCH 16/34] Run the CI and the delivery on GitHub Actions, with the shared workflows of the other .NET repositories The GitLab and Azure DevOps pipelines are removed, GitHub being the only host. Co-Authored-By: Claude Opus 5.5 --- .azure/pipelines/ci.yml | 107 ----------- .azure/pipelines/pkg.yml | 59 ------ .fossa.yml | 7 + .github/workflows/ci.yaml | 87 +++++++++ .github/workflows/pkg.yaml | 71 +++++++ .gitlab-ci.yml | 180 ------------------ .istarci.yml | 48 +++-- .markdownlint-cli2.yaml | 10 + .yamllint.yaml | 12 ++ AlmOps.slnx | 5 +- CONTRIBUTING.md | 2 +- README.md | 4 +- .../SamlTokenClaimEnricher.csproj | 3 +- 13 files changed, 225 insertions(+), 370 deletions(-) delete mode 100644 .azure/pipelines/ci.yml delete mode 100644 .azure/pipelines/pkg.yml create mode 100644 .fossa.yml create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/pkg.yaml delete mode 100644 .gitlab-ci.yml create mode 100644 .markdownlint-cli2.yaml create mode 100644 .yamllint.yaml diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml deleted file mode 100644 index cdd78aa..0000000 --- a/.azure/pipelines/ci.yml +++ /dev/null @@ -1,107 +0,0 @@ -# Azure pipeline definition for the integration of the solution (continuous integration) - -trigger: none -# batch: true -# branches: -# include: -# - main -# paths: -# exclude: -# - README.md - -pr: none -# autoCancel: true -# branches: -# include: -# - main -# paths: -# exclude: -# - README.md - -#schedules: -#- cron: "0 0 * * *" -# displayName: 'Daily midnight build' -# branches: -# include: -# - main -# always: true - -variables: -# library variable groups -- group: 'build-tools' -- group: 'integration-testing-sandbox' -# common task variables -- name: 'BuildConfiguration' - value: 'Debug' -- name: 'SolutionFile' - value: 'AlmOps.sln' -- name: 'TestProjects' - value: 'test/*Tests/*.csproj' -# tool variables (Sonar) -- name: 'sonar.project.name' - value: 'AlmOps' -- name: 'sonar.project.key' - value: 'devpro.almops' - -pool: - # code coverage generation only works on Windows for the moment - vmImage: 'windows-latest' - -steps: -- task: UseDotNet@2 - displayName: 'Use .NET Core SDK' - inputs: - packageType: 'sdk' - version: '8.0.x' -- task: DotNetCoreCLI@2 - displayName: 'Restore .NET packages' - inputs: - command: 'restore' - projects: '$(SolutionFile)' - feedsToUse: 'select' - noCache: 'true' - env: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - COREHOST_TRACE: 0 -- task: SonarCloudPrepare@1 - displayName: 'Prepare code analysis' - inputs: - SonarCloud: '$(sonar.instance)' - organization: '$(sonar.organization)' - scannerMode: 'MSBuild' - projectKey: '$(sonar.project.key)' - projectName: '$(sonar.project.name)' - extraProperties: | - sonar.cpd.exclusions=**/Models/*.cs,**/Dto/*.cs -- task: DotNetCoreCLI@2 - displayName: 'Build the .NET solution' - inputs: - command: 'build' - projects: $(SolutionFile) - arguments: '-c $(BuildConfiguration)' - env: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - COREHOST_TRACE: 0 -- task: DotNetCoreCLI@2 - displayName: 'Run the .NET test projects' - inputs: - command: 'test' - projects: $(TestProjects) - arguments: '--configuration $(BuildConfiguration) --collect "Code coverage"' - env: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - COREHOST_TRACE: 0 - AlmOps__Sandbox__Organization: $(almops.azuredevops.organization) - AlmOps__Sandbox__Username: $(almops.azuredevops.username) - AlmOps__Sandbox__Token: $(almops.azuredevops.token) - AlmOps__Sandbox__Project: $(almops.azuredevops.project) - AlmOps__Sandbox__VariableGroup: $(almops.azuredevops.demovariablegroup.id) -- task: SonarCloudAnalyze@1 - displayName: 'Analyze the code with Sonar' -- task: SonarCloudPublish@1 - displayName: 'Publish the code analysis results' - inputs: - pollingTimeoutSec: '300' diff --git a/.azure/pipelines/pkg.yml b/.azure/pipelines/pkg.yml deleted file mode 100644 index 793ecf9..0000000 --- a/.azure/pipelines/pkg.yml +++ /dev/null @@ -1,59 +0,0 @@ -# Azure pipeline definition for the packaging of the solution (continuous delivery) - -trigger: none -# batch: true -# branches: -# include: -# - main -# paths: -# exclude: -# - README.md -# include: -# - Directory.Build.props - -pr: none - -variables: -# library variable groups -- group: 'build-tools' -# environment variables -- name: 'DOTNET_CLI_TELEMETRY_OPTOUT' - value: '1' -- name: 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' - value: '1' -# common task variables -- name: 'BuildConfiguration' - value: 'Release' -- name: 'ProjectsToPackage' - value: '**/ConsoleApp/*.csproj;!**/*Tests.csproj' -- name: 'SolutionFile' - value: 'AlmOps.sln' - -pool: - vmImage: 'ubuntu-latest' - -steps: -- task: UseDotNet@2 - displayName: 'Use latest .NET Core SDK' - inputs: - packageType: 'sdk' - version: '8.0.x' -- task: DotNetCoreCLI@2 - displayName: 'Build the .NET solution' - inputs: - command: 'build' - projects: $(SolutionFile) - arguments: '-c $(BuildConfiguration)' -- task: DotNetCoreCLI@2 - displayName: 'Created packed NuGet files' - inputs: - command: 'pack' - packagesToPack: $(ProjectsToPackage) - versioningScheme: 'off' -- task: NuGetCommand@2 - displayName: 'Push files to NuGet' - inputs: - command: 'push' - packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg' - nuGetFeedType: 'external' - publishFeedCredentials: $(nuget.instance) diff --git a/.fossa.yml b/.fossa.yml new file mode 100644 index 0000000..defbb0f --- /dev/null +++ b/.fossa.yml @@ -0,0 +1,7 @@ +version: 3 +# https://github.com/fossas/fossa-cli/blob/master/docs/references/files/fossa-yml.md + +paths: + exclude: + - .sonar + - samples diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..03a4465 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,87 @@ +name: CI +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +# purpose: Continuous Integration pipeline + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + inputs: + run-code-quality: + description: 'Check code quality?' + required: false + type: boolean + default: false + run-image-scan: + description: 'Scan container image?' + required: false + type: boolean + default: false + +concurrency: + group: "${{ github.ref }}-ci" + cancel-in-progress: true + +permissions: + contents: read + +jobs: + git-check: + name: Git + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + with: + paths: 'src test samples Directory.Build.props Directory.Packages.props *.slnx global.json' + version-file: Directory.Build.props + workflow-parts-version: 86258d301cd7d6d374587a0663ee384b9ccc4515 + + markup-lint: + name: Markup + uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + + code-quality: + name: Code + needs: git-check + if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-code-quality) + uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + with: + dotnet-test-args: "--report-xunit-trx --coverage --coverage-output-format cobertura ${{ vars.DOTNET_TEST_EXTRA_ARGS }}" + fossa-enabled: ${{ vars.FOSSA_ENABLED != 'false' }} + sonar-enabled: true + sonar-host-url: ${{ vars.SONAR_HOST_URL || 'https://sonarcloud.io' }} + sonar-cpd-exclusions: "**/*Generated*.cs,**/src/AzureDevOpsComponent.Domain/Models/*.cs,**/src/*/Dto/*.cs" + sonar-exclusions: "**/samples/**" + sonar-organization: ${{ vars.SONAR_ORG }} + sonar-project-key: ${{ vars.SONAR_PROJECT_KEY }} + sonar-project-name: AlmOps + workflow-parts-version: 86258d301cd7d6d374587a0663ee384b9ccc4515 + secrets: + fossa-api-key: ${{ secrets.FOSSA_API_KEY }} + sonar-token: ${{ secrets.SONAR_TOKEN }} + additional-vars: | + AlmOps__Sandbox__Organization=${{ secrets.AZUREDEVOPS_TEST_ORG }} + AlmOps__Sandbox__Username=${{ secrets.AZUREDEVOPS_TEST_USERNAME }} + AlmOps__Sandbox__Token=${{ secrets.AZUREDEVOPS_TEST_TOKEN }} + AlmOps__Sandbox__Project=${{ secrets.AZUREDEVOPS_TEST_PROJECT }} + AlmOps__Sandbox__VariableGroupId=${{ secrets.AZUREDEVOPS_TEST_VARIABLEGROUPID }} + AlmOps__Sandbox__GitLab__Token=${{ secrets.GITLAB_TEST_TOKEN }} + AlmOps__Sandbox__GitLab__GroupId=${{ secrets.GITLAB_TEST_GROUPID }} + AlmOps__Sandbox__GitLab__ProjectId=${{ secrets.GITLAB_TEST_PROJECTID }} + permissions: + contents: read + pull-requests: write + + image-scan: + name: Image + needs: git-check + if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-image-scan) + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + with: + image-definition: "src/ConsoleApp/Dockerfile" + image-name: ${{ vars.CONTAINER_IMAGE_NAME }} + image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} + image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" + max-high-cves: 0 + max-medium-cves: 0 + workflow-parts-version: 86258d301cd7d6d374587a0663ee384b9ccc4515 diff --git a/.github/workflows/pkg.yaml b/.github/workflows/pkg.yaml new file mode 100644 index 0000000..5c954a3 --- /dev/null +++ b/.github/workflows/pkg.yaml @@ -0,0 +1,71 @@ +name: PKG +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +# purpose: Continuous Delivery (aka Packaging & Shipping) + +on: + push: + branches: [main] + workflow_dispatch: + inputs: + push-enabled: + description: 'Push packages?' + required: false + type: boolean + default: false + +permissions: + contents: read + +jobs: + git-check: + name: Git + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + with: + paths: 'src Directory.Build.props Directory.Packages.props global.json' + version-file: Directory.Build.props + workflow-parts-version: 86258d301cd7d6d374587a0663ee384b9ccc4515 + + # NuGet refuses a version it already holds, so the packages are pushed only when the version changes. + version-check: + name: Version + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + with: + paths: 'Directory.Build.props' + workflow-parts-version: 86258d301cd7d6d374587a0663ee384b9ccc4515 + + package-publication: + name: Package / Publication + needs: version-check + if: github.event_name == 'workflow_dispatch' || needs.version-check.outputs.changed == 'true' + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - name: Clone repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + - name: Pack & push .NET projects + uses: devpro/github-workflow-parts/actions/dotnet/pack-push@86258d301cd7d6d374587a0663ee384b9ccc4515 + with: + registry-token: ${{ secrets.NUGET_API_KEY }} + push-enabled: ${{ github.event_name != 'workflow_dispatch' || inputs.push-enabled }} + + image-publication: + name: Image + needs: git-check + if: github.event_name == 'workflow_dispatch' || needs.git-check.outputs.changed == 'true' + permissions: + id-token: write + contents: read + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + with: + create-latest: ${{ github.ref_name == 'main' }} + image-definition: "src/ConsoleApp/Dockerfile" + image-name: ${{ vars.CONTAINER_IMAGE_NAME }} + image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} + image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" + image-platform: linux/amd64 + workflow-parts-version: 86258d301cd7d6d374587a0663ee384b9ccc4515 + secrets: + container-registry-password: ${{ secrets.DOCKERHUB_TOKEN }} + container-registry-username: ${{ secrets.DOCKERHUB_USERNAME }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 97a4757..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,180 +0,0 @@ -include: - - remote: 'https://gitlab.com/neuvector/gitlab-plugin/-/raw/master/scan.yml' - - template: Jobs/Container-Scanning.gitlab-ci.yml - -stages: - - build - - test - - publish - -workflow: - rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - - if: '$CI_PIPELINE_SOURCE == "web"' - -variables: - IMAGE_REPOSITORY: $CONTAINER_REGISTRY_DOMAIN/$CONTAINER_REGISTRY_USER/almops - IMAGE_TAG: 1.3.$CI_PIPELINE_ID - IMAGE_NAME: $IMAGE_REPOSITORY:$IMAGE_TAG - IMAGE_LATEST: $IMAGE_REPOSITORY:latest - -.dotnet: - image: mcr.microsoft.com/dotnet/sdk:10.0 - variables: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - COREHOST_TRACE: 0 - BUILD_SOURCEBRANCHNAME: $CI_COMMIT_BRANCH - BUILD_BUILDID: $CI_PIPELINE_ID - -dotnet-build: - extends: .dotnet - stage: build - script: - - dotnet restore - - dotnet build --no-restore --configuration Debug - -dotnet-test: - extends: .dotnet - stage: test - variables: - DOTNET_TEST_RESULT_XMLFILES: ./**/*test-result.xml - DOTNET_TEST_COVERAGE_XMLFILES: ./test/*/TestResults/*/coverage.cobertura.xml - DOTNET_TEST_REPORT_FOLDER: report - # other options available: /d:sonar.coverage.exclusions=... /d:sonar.cpd.exclusions=**/Models/*.cs,**/Dto/*.cs - SONAR_EXTRA_PARAMETERS: /d:sonar.cpd.exclusions=**/*Generated*.cs,report/** /d:sonar.coverageReportPaths=report/SonarQube.xml - # empty runs every test, and a local run filters out the ones against live sandboxes - DOTNET_TEST_EXTRA_PARAMETERS: "" - AlmOps__Sandbox__Organization: $AZUREDEVOPS_TEST_ORG - AlmOps__Sandbox__Username: $AZUREDEVOPS_TEST_USERNAME - AlmOps__Sandbox__Token: $AZUREDEVOPS_TEST_TOKEN - AlmOps__Sandbox__Project: $AZUREDEVOPS_TEST_PROJECT - AlmOps__Sandbox__VariableGroupId: $AZUREDEVOPS_TEST_VARIABLEGROUPID - AlmOps__Sandbox__GitLab__Token: $GITLAB_TEST_TOKEN - AlmOps__Sandbox__GitLab__GroupId: $GITLAB_TEST_GROUPID - AlmOps__Sandbox__GitLab__ProjectId: $GITLAB_TEST_PROJECTID - before_script: - # updates system - - cat /etc/issue - - apt-get update - - apt-get install -y gnupg - # installs java runtime, sonar scanner and report generator tool - - apt install -y default-jre - - dotnet tool install --global dotnet-sonarscanner - - dotnet tool install --global dotnet-reportgenerator-globaltool - # adds dotnet global tool in the path - - export PATH="$PATH:/root/.dotnet/tools" - script: - - dotnet sonarscanner begin /o:$SONAR_ORGANIZATION /k:$SONAR_PROJECTKEY /n:AlmOps /d:sonar.host.url=$SONAR_HOSTURL /d:sonar.token=$SONAR_TOKEN $SONAR_EXTRA_PARAMETERS - - dotnet test --configuration Debug --logger:"junit;LogFilePath=..\..\artifacts\{assembly}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage" $DOTNET_TEST_EXTRA_PARAMETERS - - reportgenerator "-reports:$DOTNET_TEST_COVERAGE_XMLFILES" -targetdir:$DOTNET_TEST_REPORT_FOLDER "-reporttypes:Cobertura;Html;TextSummary;SonarQube" - - dotnet sonarscanner end /d:sonar.token=$SONAR_TOKEN - - cat $DOTNET_TEST_REPORT_FOLDER/Summary.txt - artifacts: - when: always - paths: - - $DOTNET_TEST_RESULT_XMLFILES - - $DOTNET_TEST_COVERAGE_XMLFILES - - $DOTNET_TEST_REPORT_FOLDER/Cobertura.xml - - $DOTNET_TEST_REPORT_FOLDER/Summary.txt - reports: - junit: - - $DOTNET_TEST_RESULT_XMLFILES - coverage_report: - coverage_format: cobertura - # should also work and will prevent issue with line limit - # path: $DOTNET_TEST_REPORT_FOLDER/Cobertura.xml - path: $DOTNET_TEST_COVERAGE_XMLFILES - coverage: '/Line coverage: \d+(?:\.\d+)?%/' - -nuget-push: - extends: .dotnet - stage: publish - script: - - dotnet pack --configuration Release -o output - - for f in output/*.nupkg; do dotnet nuget push "$f" --api-key $NUGET_APIKEY --source $NUGET_SOURCE ; done - only: - refs: - - main - changes: - - Directory.Build.props - variables: - - $CI_PIPELINE_SOURCE == "push" - -#.docker: -# image: docker:stable -# services: -# - docker-dind -# tags: -# - gitlab-org-docker - -.podman: - image: quay.io/podman/stable:latest - -podman-build: - extends: .podman - stage: build - script: - - podman build . -t $IMAGE_NAME -f src/ConsoleApp/Dockerfile - - podman save -o image.tar $IMAGE_NAME - timeout: 30 minutes - artifacts: - expire_in: 1 hours - paths: - - image.tar - -neuvector_scan: - #extends: .docker - stage: test - variables: - #image_registry_url: "https://registry-1.docker.io" - #image_registry_user: $CONTAINER_REGISTRY_USER - #image_registry_password: $CONTAINER_REGISTRY_PASSWD - scan_local_image: "true" - image_tar: "image.tar" - image_repo: $IMAGE_REPOSITORY - image_tag: $IMAGE_TAG - #nv_registry_url: "https://registry-1.docker.io" - nv_registry_user: $CONTAINER_REGISTRY_USER - nv_registry_password: $CONTAINER_REGISTRY_PASSWD - scan_layers: "false" - high_vul_to_fail: 0 - medium_vul_to_fail: 0 - vul_names_to_fail: "" - #DOCKER_HOST: tcp://docker:2376 - #DOCKER_TLS_CERTDIR: "/certs" - #DOCKER_TLS_VERIFY: 1 - #DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client" - #before_script: - # - apk add curl - # - apk add jq - # - until docker info; do sleep 1; done - after_script: - - cat ./nvreport/scan-summary.txt - dependencies: - - podman-build - -# https://docs.gitlab.com/user/application_security/container_scanning/ -container_scanning: - variables: - CS_IMAGE: "archive://image.tar" - dependencies: - - podman-build - -#other way to add Trivy: https://trivy.dev/latest/getting-started/installation/, https://trivy.dev/v0.58/tutorials/integrations/gitlab-ci/ - -podman-push: - extends: .podman - stage: publish - before_script: - - echo "$CONTAINER_REGISTRY_PASSWD" | podman login $CONTAINER_REGISTRY_DOMAIN -u "$CONTAINER_REGISTRY_USER" --password-stdin - script: - - podman load -i image.tar - - podman push $IMAGE_NAME - - if [ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]; then podman tag $IMAGE_NAME $IMAGE_LATEST; podman push $IMAGE_LATEST; fi - only: - - main - - web - dependencies: - - podman-build diff --git a/.istarci.yml b/.istarci.yml index 707024b..ae36ac9 100644 --- a/.istarci.yml +++ b/.istarci.yml @@ -1,27 +1,37 @@ # IstarCI configuration, read from the root of the repository. runner: - # podman builds and loads images, and docker:dind serves the scan, which need the privileged containers a GitLab runner gives them. - privileged: - - "podman-*" - - neuvector_scan - # The analysis of dotnet-test runs against the SonarQube IstarCI starts on this machine, with a token made there. + image: ghcr.io/devpro/ubuntu-dotnet:latest + images: + "git-check*": ghcr.io/devpro/debian-node:latest + "markup-lint*": ghcr.io/devpro/debian-node:latest + "image-scan*": ghcr.io/devpro/debian-node:latest + # The scan job builds an image and scans it through the host Docker daemon. + docker: ["image-scan*"] + # The analysis runs against the SonarQube IstarCI starts on this machine, with a token made there. sonarqube: true workflow: - # IstarCI holds no external credential, and the scan logs in to Docker Hub. - skipJobs: - - neuvector_scan - # The pipeline runs on a merge request or on the default branch only, so a local run on a feature branch skips the rules instead of evaluating them. - respectTriggers: false + onDisallowedAction: fail + # Actions published by GitHub or Docker, and the composite replacements for every other one kept in github-workflow-parts. + allowedActions: + - actions/* + - github/* + - docker/* + - devpro/github-workflow-parts/* + # Delivery publishes on a push to the default branch, which a local run must never reach. + exclude: + - pkg.yaml -# The project CI/CD variables of GitLab, with local values: the image is built and scanned here, and pushed only from main on GitLab. +# Repository variables the pipeline reads, which a local run otherwise gets as placeholders, and an image tag refuses the uppercase in one. vars: - CONTAINER_REGISTRY_DOMAIN: localhost - CONTAINER_REGISTRY_USER: local - # The local SonarQube, under the names dotnet-test reads. - SONAR_HOSTURL: $SONAR_HOST_URL - SONAR_ORGANIZATION: local - SONAR_PROJECTKEY: almops - # The tests against live Azure DevOps and GitLab sandboxes need real credentials, which IstarCI never holds. - DOTNET_TEST_EXTRA_PARAMETERS: --filter Environment!=Sandbox + # FOSSA analyses on its own service with an API key, which a local run never holds. + FOSSA_ENABLED: "false" + # The local SonarQube has no organizations, and a non-empty one is what turns the analysis on. + SONAR_ORG: local + SONAR_PROJECT_KEY: almops + CONTAINER_REGISTRY_PATH: devprofr + CONTAINER_IMAGE_NAME: almops + # The tests against live Azure DevOps and GitLab sandboxes need real credentials, which a local run never holds, + # and leaving them out leaves the integration projects with no test, which exit code 8 reports. + DOTNET_TEST_EXTRA_ARGS: --filter-not-trait "Environment=Sandbox" --ignore-exit-code 8 diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 0000000..f4b455b --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,10 @@ +gitignore: true +ignores: + - CLAUDE.md +config: + default: true + # ref. https://github.com/DavidAnson/markdownlint + MD013: + line_length: 240 + MD033: false + MD046: false diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..d63ab95 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,12 @@ +extends: default +# ref. https://yamllint.readthedocs.io/en/stable/configuration.html +ignore-from-file: + - .gitignore +rules: + document-start: disable + line-length: + level: warning + max: 170 + truthy: disable + brackets: + max-spaces-inside: 1 diff --git a/AlmOps.slnx b/AlmOps.slnx index eec2fe3..c6a72e0 100644 --- a/AlmOps.slnx +++ b/AlmOps.slnx @@ -3,7 +3,10 @@ - + + + + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4dac351..19a5ed0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,7 +69,7 @@ docker run -it --rm --name almops \ ## Run the pipeline locally -[IstarCI](https://github.com/devpro/istarci) runs the GitLab CI pipeline in Docker before the push. +[IstarCI](https://github.com/devpro/istarci) runs the GitHub Actions pipeline in Docker on every commit, and gates the push on its result. `istarci add` and `istarci install-hook` set it up for this repository. ## References diff --git a/README.md b/README.md index 2433b79..240730d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # almops - Ops tool for ALM solutions -[![GitLab Pipeline Status](https://gitlab.com/devpro-labs/software/almops/badges/main/pipeline.svg)](https://gitlab.com/devpro-labs/software/almops/-/pipelines) -[![GitLab Coverage Report](https://gitlab.com/devpro-labs/software/almops/badges/main/coverage.svg)](https://gitlab.com/devpro-labs/software/almops/-/commits/main) +[![CI](https://github.com/devpro/almops/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/devpro/almops/actions/workflows/ci.yaml) +[![PKG](https://github.com/devpro/almops/actions/workflows/pkg.yaml/badge.svg?branch=main)](https://github.com/devpro/almops/actions/workflows/pkg.yaml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=devpro.almops&metric=alert_status)](https://sonarcloud.io/dashboard?id=devpro.almops) [![Nuget](https://img.shields.io/nuget/v/almops.svg)](https://www.nuget.org/packages/almops) [![Docker Image Version](https://img.shields.io/docker/v/devprofr/almops?label=Docker)](https://hub.docker.com/r/devprofr/almops) diff --git a/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj b/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj index 2fa1d50..b768564 100644 --- a/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj +++ b/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj @@ -3,7 +3,8 @@ net10.0 V4 - Exe + Exe + false enable enable From 26217e8f86782df0a3933e29f210978fdcf55c4e Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 20 Oct 2026 16:05:27 +0200 Subject: [PATCH 17/34] Update to .NET 10.0.13 packages, map with Mapperly and test on xunit v3 AutoMapper and FluentAssertions, which carry license issues, are replaced by Mapperly and AwesomeAssertions, and the tests run on the Microsoft Testing Platform with coverage and TRX reports. Withywoods.Net.Http stays on 1.x, since 2.x reads the camelCase responses of the APIs case sensitively, which the new repository tests detect. Co-Authored-By: Claude Opus 5.5 --- AlmOps.slnx | 6 +- CONTRIBUTING.md | 14 +- Directory.Packages.props | 48 +++-- global.json | 5 + .../Models/BuildArtifactModel.cs | 16 +- .../Models/BuildDefinitionModel.cs | 16 +- .../Models/BuildModel.cs | 32 ++-- .../Models/EnvironmentModel.cs | 18 +- .../Models/PersonModel.cs | 12 +- .../Models/PoolModel.cs | 2 +- .../Models/ProjectModel.cs | 12 +- .../Models/QueueModel.cs | 4 +- .../Models/ReleaseArtifactModel.cs | 10 +- .../Models/ReleaseDefinitionModel.cs | 22 +-- .../Models/ReleaseModel.cs | 34 ++-- .../Models/VariableGroupModel.cs | 8 +- ...OpsComponent.Infrastructure.RestApi.csproj | 2 +- .../ServiceCollectionExtensions.cs | 1 + .../Dto/ApprovalDto.cs | 2 +- .../Dto/ApprovalsSnapshotDto.cs | 4 +- .../Dto/BuildArtifactDto.cs | 6 +- .../Dto/BuildDefinitionDto.cs | 18 +- .../Dto/BuildDto.cs | 54 +++--- .../Dto/ConditionDto.cs | 6 +- .../Dto/DefinitionReferenceDto.cs | 18 +- .../Dto/DeployPhasesSnapshotDto.cs | 8 +- .../Dto/DeploymentInputDto.cs | 4 +- .../Dto/EnvironmentDto.cs | 38 ++-- .../Dto/EnvironmentOptionsDto.cs | 4 +- .../Dto/HrefDto.cs | 2 +- .../Dto/InputsDto.cs | 12 +- .../Dto/LinksDto.cs | 10 +- .../Dto/LogsDto.cs | 4 +- .../Dto/NameValueDto.cs | 4 +- .../Dto/OrchestrationPlanDto.cs | 2 +- .../Dto/ParallelExecutionDto.cs | 2 +- .../Dto/PersonDto.cs | 12 +- .../Dto/PlanDto.cs | 2 +- .../Dto/PoolDto.cs | 2 +- .../Dto/ProjectDto.cs | 12 +- .../Dto/ProjectReferenceDto.cs | 6 +- .../Dto/QueueDto.cs | 4 +- .../Dto/ReferenceDto.cs | 2 +- .../Dto/ReleaseArtifactDto.cs | 8 +- .../Dto/ReleaseDefinitionDto.cs | 36 ++-- .../Dto/ReleaseDto.cs | 36 ++-- .../Dto/RepositoryDto.cs | 10 +- .../Dto/ResourceDto.cs | 10 +- .../Dto/ResourcePropertiesDto.cs | 4 +- .../Dto/ResultDto.cs | 2 +- .../Dto/TriggerInfoDto.cs | 10 +- .../Dto/ValidationResultDto.cs | 4 +- .../Dto/VariableGroupDto.cs | 16 +- .../Dto/WorkflowTaskDto.cs | 10 +- .../Mappers/AzureDevOpsDtoMapper.cs | 46 +++++ .../MappingProfiles/GenericMappingProfile.cs | 113 ------------ .../Repositories/BuildArtifactRepository.cs | 6 +- .../Repositories/BuildRepository.cs | 10 +- .../Repositories/BuildTagRepository.cs | 4 +- .../Repositories/ProjectRepository.cs | 6 +- .../ReleaseDefinitionRepository.cs | 8 +- .../Repositories/ReleaseRepository.cs | 6 +- .../Repositories/RepositoryBase.cs | 6 +- .../Repositories/VariableGroupRepository.cs | 12 +- src/ConsoleApp/ConsoleApp.csproj | 1 - src/ConsoleApp/Dockerfile | 20 ++- src/ConsoleApp/Program.cs | 15 -- src/ConsoleApp/Tasks/ConsoleTaskFactory.cs | 2 +- .../Dto/AuditEventDto.cs | 24 +-- .../Dto/DetailsDto.cs | 24 +-- .../GitLabRestApiConfiguration.cs | 2 +- .../Repositories/AuditEventRepository.cs | 4 +- ...astructure.RestApi.IntegrationTests.csproj | 30 +--- .../RepositoryIntegrationTestBase.cs | 8 - .../VariableGroupRepositorySandboxTest.cs | 28 ++- ...nt.Infrastructure.RestApi.UnitTests.csproj | 23 +-- .../ServiceCollectionExtensionsTest.cs | 23 ++- .../Mappers/AzureDevOpsDtoMapperTest.cs | 167 ++++++++++++++++++ .../GenericMappingProfileTest.cs | 20 --- .../BuildArtifactRepositoryTest.cs | 47 +++++ .../Repositories/ProjectRepositoryTest.cs | 38 ++++ .../Repositories/RepositoryTestBase.cs | 43 +++++ .../ConsoleApp.IntegrationTests.csproj | 28 +-- test/ConsoleApp.IntegrationTests/SmokeTest.cs | 3 +- .../ConsoleApp.UnitTests.csproj | 29 +-- .../Tasks/ConsoleTaskFactoryTest.cs | 8 +- .../Tasks/TaskBaseTest.cs | 2 +- .../AuditEventRepositoryTest.cs | 3 +- ...astructure.RestApi.IntegrationTests.csproj | 26 +-- ...nt.Infrastructure.RestApi.UnitTests.csproj | 27 +++ .../Repositories/AuditEventRepositoryTest.cs | 101 +++++++++++ 91 files changed, 944 insertions(+), 665 deletions(-) create mode 100644 global.json create mode 100644 src/AzureDevOpsComponent.Infrastructure.RestApi/Mappers/AzureDevOpsDtoMapper.cs delete mode 100644 src/AzureDevOpsComponent.Infrastructure.RestApi/MappingProfiles/GenericMappingProfile.cs create mode 100644 test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Mappers/AzureDevOpsDtoMapperTest.cs delete mode 100644 test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/MappingProfiles/GenericMappingProfileTest.cs create mode 100644 test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/BuildArtifactRepositoryTest.cs create mode 100644 test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/ProjectRepositoryTest.cs create mode 100644 test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/RepositoryTestBase.cs create mode 100644 test/GitLabComponent.Infrastructure.RestApi.UnitTests/GitLabComponent.Infrastructure.RestApi.UnitTests.csproj create mode 100644 test/GitLabComponent.Infrastructure.RestApi.UnitTests/Repositories/AuditEventRepositoryTest.cs diff --git a/AlmOps.slnx b/AlmOps.slnx index c6a72e0..52a8d17 100644 --- a/AlmOps.slnx +++ b/AlmOps.slnx @@ -9,7 +9,8 @@ - + + @@ -18,7 +19,8 @@ - + + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 19a5ed0..a63f80f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,19 @@ dotnet build # runs the console app -dotnet src/ConsoleApp/bin/Debug/net9.0/almops.dll --help +dotnet src/ConsoleApp/bin/Debug/net10.0/almops.dll --help +``` + +## Run the tests + +Tests run on xunit v3 and the Microsoft Testing Platform (`global.json`). + +```bash +# runs the tests that need no credential, exit code 8 meaning a project with no test left to run +dotnet test -- --filter-not-trait "Environment=Sandbox" --ignore-exit-code 8 + +# runs every test, the sandbox ones reading the AlmOps__Sandbox__* variables listed below +dotnet test ``` ## Run from an IDE diff --git a/Directory.Packages.props b/Directory.Packages.props index 2b7c488..e32f206 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,35 +4,33 @@ true - - - + + - - - - + - - - + + + - - - - - - - - - - - - + + + + + + + + + + + + + + - - - + + diff --git a/global.json b/global.json new file mode 100644 index 0000000..3140116 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +} diff --git a/src/AzureDevOpsComponent.Domain/Models/BuildArtifactModel.cs b/src/AzureDevOpsComponent.Domain/Models/BuildArtifactModel.cs index ea9962e..75b0685 100644 --- a/src/AzureDevOpsComponent.Domain/Models/BuildArtifactModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/BuildArtifactModel.cs @@ -4,19 +4,19 @@ public class BuildArtifactModel { public int Id { get; set; } - public string Name { get; set; } + public string? Name { get; set; } - public string Source { get; set; } + public string? Source { get; set; } - public string ResourceType { get; set; } + public string? ResourceType { get; set; } - public string ResourceData { get; set; } + public string? ResourceData { get; set; } - public string ResourceUrl { get; set; } + public string? ResourceUrl { get; set; } - public string ResourceDownloadUrl { get; set; } + public string? ResourceDownloadUrl { get; set; } - public string ResourceLocalPath { get; set; } + public string? ResourceLocalPath { get; set; } - public string ResourceArtifactSize { get; set; } + public string? ResourceArtifactSize { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/BuildDefinitionModel.cs b/src/AzureDevOpsComponent.Domain/Models/BuildDefinitionModel.cs index 24b8c55..81f14b4 100644 --- a/src/AzureDevOpsComponent.Domain/Models/BuildDefinitionModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/BuildDefinitionModel.cs @@ -2,21 +2,21 @@ public class BuildDefinitionModel { - public string Id { get; set; } + public string? Id { get; set; } - public string Name { get; set; } + public string? Name { get; set; } - public string Url { get; set; } + public string? Url { get; set; } - public string Uri { get; set; } + public string? Uri { get; set; } - public string Path { get; set; } + public string? Path { get; set; } - public string Type { get; set; } + public string? Type { get; set; } - public string QueueStatus { get; set; } + public string? QueueStatus { get; set; } public int Revision { get; set; } - public ProjectModel Project { get; set; } + public ProjectModel? Project { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/BuildModel.cs b/src/AzureDevOpsComponent.Domain/Models/BuildModel.cs index 7a2799f..9473299 100644 --- a/src/AzureDevOpsComponent.Domain/Models/BuildModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/BuildModel.cs @@ -4,13 +4,13 @@ namespace AlmOps.AzureDevOpsComponent.Domain.Models; public class BuildModel { - public string Id { get; set; } + public string? Id { get; set; } - public string BuildNumber { get; set; } + public string? BuildNumber { get; set; } - public string Status { get; set; } + public string? Status { get; set; } - public string Result { get; set; } + public string? Result { get; set; } public DateTime QueueTime { get; set; } @@ -18,29 +18,29 @@ public class BuildModel public DateTime FinishTime { get; set; } - public string Url { get; set; } + public string? Url { get; set; } - public BuildDefinitionModel Definition { get; set; } + public BuildDefinitionModel? Definition { get; set; } - public ProjectModel Project { get; set; } + public ProjectModel? Project { get; set; } - public string Uri { get; set; } + public string? Uri { get; set; } - public string SourceBranch { get; set; } + public string? SourceBranch { get; set; } - public string SourceVersion { get; set; } + public string? SourceVersion { get; set; } - public QueueModel Queue { get; set; } + public QueueModel? Queue { get; set; } - public string Priority { get; set; } + public string? Priority { get; set; } - public string Reason { get; set; } + public string? Reason { get; set; } - public PersonModel RequestedFor { get; set; } + public PersonModel? RequestedFor { get; set; } - public PersonModel RequestedBy { get; set; } + public PersonModel? RequestedBy { get; set; } public DateTime LastChangedDate { get; set; } - public PersonModel LastChangedBy { get; set; } + public PersonModel? LastChangedBy { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/EnvironmentModel.cs b/src/AzureDevOpsComponent.Domain/Models/EnvironmentModel.cs index 204e8fa..8146c59 100644 --- a/src/AzureDevOpsComponent.Domain/Models/EnvironmentModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/EnvironmentModel.cs @@ -8,25 +8,25 @@ public class EnvironmentModel public int ReleaseId { get; set; } - public string Name { get; set; } + public string? Name { get; set; } - public string Status { get; set; } + public string? Status { get; set; } - public object Variables { get; set; } + public object? Variables { get; set; } public int Rank { get; set; } public int DefinitionEnvironmentId { get; set; } - public PersonModel Owner { get; set; } + public PersonModel? Owner { get; set; } - public List Schedules { get; set; } + public List? Schedules { get; set; } - public ReleaseModel Release { get; set; } + public ReleaseModel? Release { get; set; } - public ReleaseDefinitionModel ReleaseDefinition { get; set; } + public ReleaseDefinitionModel? ReleaseDefinition { get; set; } - public PersonModel ReleaseCreatedBy { get; set; } + public PersonModel? ReleaseCreatedBy { get; set; } - public string TriggerReason { get; set; } + public string? TriggerReason { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/PersonModel.cs b/src/AzureDevOpsComponent.Domain/Models/PersonModel.cs index c5870a7..a501786 100644 --- a/src/AzureDevOpsComponent.Domain/Models/PersonModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/PersonModel.cs @@ -2,15 +2,15 @@ public class PersonModel { - public string DisplayName { get; set; } + public string? DisplayName { get; set; } - public string Url { get; set; } + public string? Url { get; set; } - public string Id { get; set; } + public string? Id { get; set; } - public string UniqueName { get; set; } + public string? UniqueName { get; set; } - public string ImageUrl { get; set; } + public string? ImageUrl { get; set; } - public string Descriptor { get; set; } + public string? Descriptor { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/PoolModel.cs b/src/AzureDevOpsComponent.Domain/Models/PoolModel.cs index ab337f8..b227e04 100644 --- a/src/AzureDevOpsComponent.Domain/Models/PoolModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/PoolModel.cs @@ -4,7 +4,7 @@ public class PoolModel { public int Id { get; set; } - public string Name { get; set; } + public string? Name { get; set; } public bool IsHosted { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/ProjectModel.cs b/src/AzureDevOpsComponent.Domain/Models/ProjectModel.cs index ae0fc63..15bdff3 100644 --- a/src/AzureDevOpsComponent.Domain/Models/ProjectModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/ProjectModel.cs @@ -2,17 +2,17 @@ public class ProjectModel { - public string Id { get; set; } + public string? Id { get; set; } - public string Name { get; set; } + public string? Name { get; set; } - public string Description { get; set; } + public string? Description { get; set; } - public string Url { get; set; } + public string? Url { get; set; } - public string State { get; set; } + public string? State { get; set; } public int Revision { get; set; } - public string Visibility { get; set; } + public string? Visibility { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/QueueModel.cs b/src/AzureDevOpsComponent.Domain/Models/QueueModel.cs index 9852168..561c185 100644 --- a/src/AzureDevOpsComponent.Domain/Models/QueueModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/QueueModel.cs @@ -4,7 +4,7 @@ public class QueueModel { public int Id { get; set; } - public string Name { get; set; } + public string? Name { get; set; } - public PoolModel Pool { get; set; } + public PoolModel? Pool { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/ReleaseArtifactModel.cs b/src/AzureDevOpsComponent.Domain/Models/ReleaseArtifactModel.cs index f83c5b0..95e187f 100644 --- a/src/AzureDevOpsComponent.Domain/Models/ReleaseArtifactModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/ReleaseArtifactModel.cs @@ -2,15 +2,15 @@ public class ReleaseArtifactModel { - public string SourceId { get; set; } + public string? SourceId { get; set; } - public string Type { get; set; } + public string? Type { get; set; } - public string Alias { get; set; } + public string? Alias { get; set; } - public string BuildDefinitionId { get; set; } + public string? BuildDefinitionId { get; set; } - public string BuildDefinitionName { get; set; } + public string? BuildDefinitionName { get; set; } public bool IsPrimary { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/ReleaseDefinitionModel.cs b/src/AzureDevOpsComponent.Domain/Models/ReleaseDefinitionModel.cs index e6ed5ac..eadeb52 100644 --- a/src/AzureDevOpsComponent.Domain/Models/ReleaseDefinitionModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/ReleaseDefinitionModel.cs @@ -7,33 +7,33 @@ public class ReleaseDefinitionModel { public int Id { get; set; } - public string Name { get; set; } + public string? Name { get; set; } - public string Url { get; set; } + public string? Url { get; set; } - public string Source { get; set; } + public string? Source { get; set; } public int Revision { get; set; } - public object Description { get; set; } + public object? Description { get; set; } - public PersonModel CreatedBy { get; set; } + public PersonModel? CreatedBy { get; set; } public DateTime CreatedOn { get; set; } - public PersonModel ModifiedBy { get; set; } + public PersonModel? ModifiedBy { get; set; } public DateTime ModifiedOn { get; set; } public bool IsDeleted { get; set; } - public ReleaseModel LastRelease { get; set; } + public ReleaseModel? LastRelease { get; set; } - public List Environments { get; set; } + public List? Environments { get; set; } - public List Artifacts { get; set; } + public List? Artifacts { get; set; } - public string ReleaseNameFormat { get; set; } + public string? ReleaseNameFormat { get; set; } - public string Path { get; set; } + public string? Path { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/ReleaseModel.cs b/src/AzureDevOpsComponent.Domain/Models/ReleaseModel.cs index aecdd55..b2c4126 100644 --- a/src/AzureDevOpsComponent.Domain/Models/ReleaseModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/ReleaseModel.cs @@ -5,45 +5,45 @@ namespace AlmOps.AzureDevOpsComponent.Domain.Models; public class ReleaseModel { - public string Id { get; set; } + public string? Id { get; set; } - public string Name { get; set; } + public string? Name { get; set; } - public string Status { get; set; } + public string? Status { get; set; } public DateTime CreatedOn { get; set; } public DateTime ModifiedOn { get; set; } - public PersonModel ModifiedBy { get; set; } + public PersonModel? ModifiedBy { get; set; } - public PersonModel CreatedBy { get; set; } + public PersonModel? CreatedBy { get; set; } - public List Environments { get; set; } + public List? Environments { get; set; } - public object Variables { get; set; } + public object? Variables { get; set; } - public List VariableGroups { get; set; } + public List? VariableGroups { get; set; } - public ReleaseDefinitionModel ReleaseDefinition { get; set; } + public ReleaseDefinitionModel? ReleaseDefinition { get; set; } - public string Description { get; set; } + public string? Description { get; set; } - public string Reason { get; set; } + public string? Reason { get; set; } - public string ReleaseNameFormat { get; set; } + public string? ReleaseNameFormat { get; set; } public bool KeepForever { get; set; } public int DefinitionSnapshotRevision { get; set; } - public string LogsContainerUrl { get; set; } + public string? LogsContainerUrl { get; set; } - public string Url { get; set; } + public string? Url { get; set; } - public List Tags { get; set; } + public List? Tags { get; set; } - public ProjectModel ProjectReference { get; set; } + public ProjectModel? ProjectReference { get; set; } - public object Properties { get; set; } + public object? Properties { get; set; } } diff --git a/src/AzureDevOpsComponent.Domain/Models/VariableGroupModel.cs b/src/AzureDevOpsComponent.Domain/Models/VariableGroupModel.cs index 16d66cf..05ab1ad 100644 --- a/src/AzureDevOpsComponent.Domain/Models/VariableGroupModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/VariableGroupModel.cs @@ -4,11 +4,11 @@ public class VariableGroupModel { public long Id { get; set; } - public string Type { get; set; } + public string? Type { get; set; } - public string Name { get; set; } + public string? Name { get; set; } - public string Description { get; set; } + public string? Description { get; set; } - public object Variables { get; set; } + public object? Variables { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj index 1a048ac..6163acb 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/DependencyInjection/ServiceCollectionExtensions.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/DependencyInjection/ServiceCollectionExtensions.cs index 021c193..fdd8094 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/DependencyInjection/ServiceCollectionExtensions.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/DependencyInjection/ServiceCollectionExtensions.cs @@ -23,6 +23,7 @@ public static IServiceCollection AddAzureDevOpsRestApi(this IServiceCollection s ArgumentNullException.ThrowIfNull(configuration); services.TryAddSingleton(configuration); + services.TryAddSingleton(); services.TryAddTransient(); services.TryAddTransient(); services.TryAddTransient(); diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalDto.cs index 3019d03..d4e5830 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalDto.cs @@ -6,5 +6,5 @@ public class ApprovalDto public int Rank { get; set; } public bool IsAutomated { get; set; } public bool IsNotificationOn { get; set; } - public PersonDto Approver { get; set; } + public PersonDto? Approver { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalsSnapshotDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalsSnapshotDto.cs index 7de25c8..5259c8a 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalsSnapshotDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalsSnapshotDto.cs @@ -4,6 +4,6 @@ namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; public class ApprovalsSnapshotDto { - public List Approvals { get; set; } - public ApprovalOptionsDto ApprovalOptions { get; set; } + public List? Approvals { get; set; } + public ApprovalOptionsDto? ApprovalOptions { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildArtifactDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildArtifactDto.cs index 5d10a24..5fa36b3 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildArtifactDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildArtifactDto.cs @@ -3,7 +3,7 @@ public class BuildArtifactDto { public int Id { get; set; } - public string Name { get; set; } - public string Source { get; set; } - public ResourceDto Resource { get; set; } + public string? Name { get; set; } + public string? Source { get; set; } + public ResourceDto? Resource { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDefinitionDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDefinitionDto.cs index 33191c7..9ba894e 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDefinitionDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDefinitionDto.cs @@ -4,14 +4,14 @@ namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; public class BuildDefinitionDto { - public string Id { get; set; } - public string Name { get; set; } - public string Url { get; set; } - public string Uri { get; set; } - public string Path { get; set; } - public string Type { get; set; } - public string QueueStatus { get; set; } + public string? Id { get; set; } + public string? Name { get; set; } + public string? Url { get; set; } + public string? Uri { get; set; } + public string? Path { get; set; } + public string? Type { get; set; } + public string? QueueStatus { get; set; } public int Revision { get; set; } - public ProjectDto Project { get; set; } - public List Drafts { get; set; } + public ProjectDto? Project { get; set; } + public List? Drafts { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs index 0ef4873..8a40785 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs @@ -6,39 +6,39 @@ namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; public class BuildDto { - public string Id { get; set; } - public string BuildNumber { get; set; } - public string Status { get; set; } - public string Result { get; set; } + public string? Id { get; set; } + public string? BuildNumber { get; set; } + public string? Status { get; set; } + public string? Result { get; set; } public DateTime QueueTime { get; set; } public DateTime StartTime { get; set; } public DateTime FinishTime { get; set; } - public string Url { get; set; } - public List Tags { get; set; } - public BuildDefinitionDto Definition { get; set; } - public ProjectDto Project { get; set; } - public RepositoryDto Repository { get; set; } + public string? Url { get; set; } + public List? Tags { get; set; } + public BuildDefinitionDto? Definition { get; set; } + public ProjectDto? Project { get; set; } + public RepositoryDto? Repository { get; set; } [JsonProperty("_links")] - public LinksDto Links { get; set; } - public object Properties { get; set; } - public List ValidationResults { get; set; } - public List Plans { get; set; } - public TriggerInfoDto TriggerInfo { get; set; } + public LinksDto? Links { get; set; } + public object? Properties { get; set; } + public List? ValidationResults { get; set; } + public List? Plans { get; set; } + public TriggerInfoDto? TriggerInfo { get; set; } public int BuildNumberRevision { get; set; } - public string Uri { get; set; } - public string SourceBranch { get; set; } - public string SourceVersion { get; set; } - public QueueDto Queue { get; set; } - public string Priority { get; set; } - public string Reason { get; set; } - public PersonDto RequestedFor { get; set; } - public PersonDto RequestedBy { get; set; } + public string? Uri { get; set; } + public string? SourceBranch { get; set; } + public string? SourceVersion { get; set; } + public QueueDto? Queue { get; set; } + public string? Priority { get; set; } + public string? Reason { get; set; } + public PersonDto? RequestedFor { get; set; } + public PersonDto? RequestedBy { get; set; } public DateTime LastChangedDate { get; set; } - public PersonDto LastChangedBy { get; set; } - public string Parameters { get; set; } - public OrchestrationPlanDto OrchestrationPlan { get; set; } - public LogsDto Logs { get; set; } + public PersonDto? LastChangedBy { get; set; } + public string? Parameters { get; set; } + public OrchestrationPlanDto? OrchestrationPlan { get; set; } + public LogsDto? Logs { get; set; } public bool KeepForever { get; set; } public bool RetainedByRelease { get; set; } - public object TriggeredByBuild { get; set; } + public object? TriggeredByBuild { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ConditionDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ConditionDto.cs index c170531..98234cd 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ConditionDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ConditionDto.cs @@ -3,7 +3,7 @@ public class ConditionDto { public bool Result { get; set; } - public string Name { get; set; } - public string ConditionType { get; set; } - public string Value { get; set; } + public string? Name { get; set; } + public string? ConditionType { get; set; } + public string? Value { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DefinitionReferenceDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DefinitionReferenceDto.cs index 99c99a9..a451ff7 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DefinitionReferenceDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DefinitionReferenceDto.cs @@ -2,14 +2,14 @@ { public class DefinitionReferenceDto { - public NameValueDto ArtifactSourceDefinitionUrl { get; set; } - public NameValueDto DefaultVersionBranch { get; set; } - public NameValueDto DefaultVersionSpecific { get; set; } - public NameValueDto DefaultVersionTags { get; set; } - public NameValueDto DefaultVersionType { get; set; } - public NameValueDto Definition { get; set; } - public ProjectDto Project { get; set; } - public NameValueDto Version { get; set; } - public NameValueDto ArtifactSourceVersionUrl { get; set; } + public NameValueDto? ArtifactSourceDefinitionUrl { get; set; } + public NameValueDto? DefaultVersionBranch { get; set; } + public NameValueDto? DefaultVersionSpecific { get; set; } + public NameValueDto? DefaultVersionTags { get; set; } + public NameValueDto? DefaultVersionType { get; set; } + public NameValueDto? Definition { get; set; } + public ProjectDto? Project { get; set; } + public NameValueDto? Version { get; set; } + public NameValueDto? ArtifactSourceVersionUrl { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeployPhasesSnapshotDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeployPhasesSnapshotDto.cs index 5cbe02f..636b0f9 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeployPhasesSnapshotDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeployPhasesSnapshotDto.cs @@ -4,10 +4,10 @@ namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class DeployPhasesSnapshotDto { - public DeploymentInputDto DeploymentInput { get; set; } + public DeploymentInputDto? DeploymentInput { get; set; } public int Rank { get; set; } - public string PhaseType { get; set; } - public string Name { get; set; } - public List WorkflowTasks { get; set; } + public string? PhaseType { get; set; } + public string? Name { get; set; } + public List? WorkflowTasks { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeploymentInputDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeploymentInputDto.cs index e88b88f..bfe85c9 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeploymentInputDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeploymentInputDto.cs @@ -4,11 +4,11 @@ namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class DeploymentInputDto { - public ParallelExecutionDto ParallelExecution { get; set; } + public ParallelExecutionDto? ParallelExecution { get; set; } public bool SkipArtifactsDownload { get; set; } public int TimeoutInMinutes { get; set; } public int QueueId { get; set; } - public List Demands { get; set; } + public List? Demands { get; set; } public bool EnableAccessToken { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentDto.cs index 7ad2c68..27ba4bc 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentDto.cs @@ -6,26 +6,26 @@ public class EnvironmentDto { public int Id { get; set; } public int ReleaseId { get; set; } - public string Name { get; set; } - public string Status { get; set; } - public object Variables { get; set; } - public object PreDeployApprovals { get; set; } - public object PostDeployApprovals { get; set; } - public ApprovalsSnapshotDto PreApprovalsSnapshot { get; set; } - public ApprovalsSnapshotDto PostApprovalsSnapshot { get; set; } - public List DeploySteps { get; set; } + public string? Name { get; set; } + public string? Status { get; set; } + public object? Variables { get; set; } + public object? PreDeployApprovals { get; set; } + public object? PostDeployApprovals { get; set; } + public ApprovalsSnapshotDto? PreApprovalsSnapshot { get; set; } + public ApprovalsSnapshotDto? PostApprovalsSnapshot { get; set; } + public List? DeploySteps { get; set; } public int Rank { get; set; } public int DefinitionEnvironmentId { get; set; } - public EnvironmentOptionsDto EnvironmentOptions { get; set; } - public List Demands { get; set; } - public List Conditions { get; set; } - public List WorkflowTasks { get; set; } - public List DeployPhasesSnapshot { get; set; } - public PersonDto Owner { get; set; } - public List Schedules { get; set; } - public ReleaseDto Release { get; set; } - public ReleaseDefinitionDto ReleaseDefinition { get; set; } - public PersonDto ReleaseCreatedBy { get; set; } - public string TriggerReason { get; set; } + public EnvironmentOptionsDto? EnvironmentOptions { get; set; } + public List? Demands { get; set; } + public List? Conditions { get; set; } + public List? WorkflowTasks { get; set; } + public List? DeployPhasesSnapshot { get; set; } + public PersonDto? Owner { get; set; } + public List? Schedules { get; set; } + public ReleaseDto? Release { get; set; } + public ReleaseDefinitionDto? ReleaseDefinition { get; set; } + public PersonDto? ReleaseCreatedBy { get; set; } + public string? TriggerReason { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentOptionsDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentOptionsDto.cs index 95201b8..770bc45 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentOptionsDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentOptionsDto.cs @@ -2,8 +2,8 @@ { public class EnvironmentOptionsDto { - public string EmailNotificationType { get; set; } - public string EmailRecipients { get; set; } + public string? EmailNotificationType { get; set; } + public string? EmailRecipients { get; set; } public bool SkipArtifactsDownload { get; set; } public int TimeoutInMinutes { get; set; } public bool EnableAccessToken { get; set; } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/HrefDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/HrefDto.cs index 0c0c31f..1368d50 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/HrefDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/HrefDto.cs @@ -2,6 +2,6 @@ { public class HrefDto { - public string Href { get; set; } + public string? Href { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/InputsDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/InputsDto.cs index 19dd4e8..b50bd55 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/InputsDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/InputsDto.cs @@ -2,11 +2,11 @@ { public class InputsDto { - public string ScriptType { get; set; } - public string ScriptName { get; set; } - public string Arguments { get; set; } - public string InlineScript { get; set; } - public string WorkingFolder { get; set; } - public string FailOnStandardError { get; set; } + public string? ScriptType { get; set; } + public string? ScriptName { get; set; } + public string? Arguments { get; set; } + public string? InlineScript { get; set; } + public string? WorkingFolder { get; set; } + public string? FailOnStandardError { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LinksDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LinksDto.cs index f73f5de..0178e16 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LinksDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LinksDto.cs @@ -2,10 +2,10 @@ { public class LinksDto { - public HrefDto Self { get; set; } - public HrefDto Web { get; set; } - public HrefDto SourceVersionDisplayUri { get; set; } - public HrefDto Timeline { get; set; } - public HrefDto Badge { get; set; } + public HrefDto? Self { get; set; } + public HrefDto? Web { get; set; } + public HrefDto? SourceVersionDisplayUri { get; set; } + public HrefDto? Timeline { get; set; } + public HrefDto? Badge { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LogsDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LogsDto.cs index 490e2ab..42220a0 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LogsDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LogsDto.cs @@ -3,7 +3,7 @@ public class LogsDto { public int Id { get; set; } - public string Type { get; set; } - public string Url { get; set; } + public string? Type { get; set; } + public string? Url { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/NameValueDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/NameValueDto.cs index fe4642d..70bc47f 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/NameValueDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/NameValueDto.cs @@ -2,7 +2,7 @@ { public class NameValueDto { - public string Id { get; set; } - public string Name { get; set; } + public string? Id { get; set; } + public string? Name { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/OrchestrationPlanDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/OrchestrationPlanDto.cs index f97815b..78cf2dd 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/OrchestrationPlanDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/OrchestrationPlanDto.cs @@ -2,6 +2,6 @@ { public class OrchestrationPlanDto { - public string PlanId { get; set; } + public string? PlanId { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ParallelExecutionDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ParallelExecutionDto.cs index ed172c2..c465b97 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ParallelExecutionDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ParallelExecutionDto.cs @@ -2,6 +2,6 @@ { public class ParallelExecutionDto { - public string ParallelExecutionType { get; set; } + public string? ParallelExecutionType { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PersonDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PersonDto.cs index b0dfd0b..7b6bfdb 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PersonDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PersonDto.cs @@ -2,11 +2,11 @@ { public class PersonDto { - public string DisplayName { get; set; } - public string Url { get; set; } - public string Id { get; set; } - public string UniqueName { get; set; } - public string ImageUrl { get; set; } - public string Descriptor { get; set; } + public string? DisplayName { get; set; } + public string? Url { get; set; } + public string? Id { get; set; } + public string? UniqueName { get; set; } + public string? ImageUrl { get; set; } + public string? Descriptor { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PlanDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PlanDto.cs index 60f6a63..666cbba 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PlanDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PlanDto.cs @@ -2,6 +2,6 @@ { public class PlanDto { - public string PlanId { get; set; } + public string? PlanId { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PoolDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PoolDto.cs index fd485a0..80318d5 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PoolDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PoolDto.cs @@ -3,7 +3,7 @@ public class PoolDto { public int Id { get; set; } - public string Name { get; set; } + public string? Name { get; set; } public bool IsHosted { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectDto.cs index 05c6677..34714e6 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectDto.cs @@ -4,13 +4,13 @@ namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class ProjectDto { - public string Id { get; set; } - public string Name { get; set; } - public string Description { get; set; } - public string Url { get; set; } - public string State { get; set; } + public string? Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + public string? Url { get; set; } + public string? State { get; set; } public int Revision { get; set; } - public string Visibility { get; set; } + public string? Visibility { get; set; } public DateTime LastUpdateTime { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectReferenceDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectReferenceDto.cs index 54bc3f7..cf451e9 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectReferenceDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectReferenceDto.cs @@ -2,10 +2,10 @@ { public class ProjectReferenceDto { - public string Name { get; set; } + public string? Name { get; set; } - public string Description { get; set; } + public string? Description { get; set; } - public ReferenceDto ProjectReference { get; set; } + public ReferenceDto? ProjectReference { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/QueueDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/QueueDto.cs index 8fb1f23..3d86044 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/QueueDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/QueueDto.cs @@ -3,7 +3,7 @@ public class QueueDto { public int Id { get; set; } - public string Name { get; set; } - public PoolDto Pool { get; set; } + public string? Name { get; set; } + public PoolDto? Pool { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReferenceDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReferenceDto.cs index b825db1..c05f668 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReferenceDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReferenceDto.cs @@ -6,6 +6,6 @@ public class ReferenceDto { public Guid Id { get; set; } - public string Name { get; set; } + public string? Name { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseArtifactDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseArtifactDto.cs index d706ada..b9014a2 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseArtifactDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseArtifactDto.cs @@ -2,10 +2,10 @@ { public class ReleaseArtifactDto { - public string SourceId { get; set; } - public string Type { get; set; } - public string Alias { get; set; } - public DefinitionReferenceDto DefinitionReference { get; set; } + public string? SourceId { get; set; } + public string? Type { get; set; } + public string? Alias { get; set; } + public DefinitionReferenceDto? DefinitionReference { get; set; } public bool IsPrimary { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDefinitionDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDefinitionDto.cs index c12f458..2e42d3d 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDefinitionDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDefinitionDto.cs @@ -6,27 +6,27 @@ namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto public class ReleaseDefinitionDto { public int Id { get; set; } - public string Name { get; set; } - public string Url { get; set; } - public LinksDto Links { get; set; } - public string Source { get; set; } + public string? Name { get; set; } + public string? Url { get; set; } + public LinksDto? Links { get; set; } + public string? Source { get; set; } public int Revision { get; set; } - public object Description { get; set; } - public PersonDto CreatedBy { get; set; } + public object? Description { get; set; } + public PersonDto? CreatedBy { get; set; } public DateTime CreatedOn { get; set; } - public PersonDto ModifiedBy { get; set; } + public PersonDto? ModifiedBy { get; set; } public DateTime ModifiedOn { get; set; } public bool IsDeleted { get; set; } - public ReleaseDto LastRelease { get; set; } - public object Variables { get; set; } - public List VariableGroups { get; set; } - public List Environments { get; set; } - public List Artifacts { get; set; } - public List Triggers { get; set; } - public string ReleaseNameFormat { get; set; } - public List Tags { get; set; } - public object Properties { get; set; } - public string Path { get; set; } - public object ProjectReference { get; set; } + public ReleaseDto? LastRelease { get; set; } + public object? Variables { get; set; } + public List? VariableGroups { get; set; } + public List? Environments { get; set; } + public List? Artifacts { get; set; } + public List? Triggers { get; set; } + public string? ReleaseNameFormat { get; set; } + public List? Tags { get; set; } + public object? Properties { get; set; } + public string? Path { get; set; } + public object? ProjectReference { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDto.cs index 42c894e..40ed279 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDto.cs @@ -7,28 +7,28 @@ namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto public class ReleaseDto { public int Id { get; set; } - public string Name { get; set; } - public string Status { get; set; } + public string? Name { get; set; } + public string? Status { get; set; } public DateTime CreatedOn { get; set; } public DateTime ModifiedOn { get; set; } - public PersonDto ModifiedBy { get; set; } - public PersonDto CreatedBy { get; set; } - public List Environments { get; set; } - public object Variables { get; set; } - public List VariableGroups { get; set; } - public List Artifacts { get; set; } - public ReleaseDefinitionDto ReleaseDefinition { get; set; } - public string Description { get; set; } - public string Reason { get; set; } - public string ReleaseNameFormat { get; set; } + public PersonDto? ModifiedBy { get; set; } + public PersonDto? CreatedBy { get; set; } + public List? Environments { get; set; } + public object? Variables { get; set; } + public List? VariableGroups { get; set; } + public List? Artifacts { get; set; } + public ReleaseDefinitionDto? ReleaseDefinition { get; set; } + public string? Description { get; set; } + public string? Reason { get; set; } + public string? ReleaseNameFormat { get; set; } public bool KeepForever { get; set; } public int DefinitionSnapshotRevision { get; set; } - public string LogsContainerUrl { get; set; } - public string Url { get; set; } + public string? LogsContainerUrl { get; set; } + public string? Url { get; set; } [JsonProperty("_links")] - public LinksDto Links { get; set; } - public List Tags { get; set; } - public ProjectDto ProjectReference { get; set; } - public object Properties { get; set; } + public LinksDto? Links { get; set; } + public List? Tags { get; set; } + public ProjectDto? ProjectReference { get; set; } + public object? Properties { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/RepositoryDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/RepositoryDto.cs index 9816452..33ae9ae 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/RepositoryDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/RepositoryDto.cs @@ -2,11 +2,11 @@ { public class RepositoryDto { - public string Id { get; set; } - public string Type { get; set; } - public string Name { get; set; } - public string Url { get; set; } - public object Clean { get; set; } + public string? Id { get; set; } + public string? Type { get; set; } + public string? Name { get; set; } + public string? Url { get; set; } + public object? Clean { get; set; } public bool CheckoutSubmodules { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourceDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourceDto.cs index 1f58155..e8f7416 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourceDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourceDto.cs @@ -2,10 +2,10 @@ { public class ResourceDto { - public string Type { get; set; } - public string Data { get; set; } - public ResourcePropertiesDto Properties { get; set; } - public string Url { get; set; } - public string DownloadUrl { get; set; } + public string? Type { get; set; } + public string? Data { get; set; } + public ResourcePropertiesDto? Properties { get; set; } + public string? Url { get; set; } + public string? DownloadUrl { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourcePropertiesDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourcePropertiesDto.cs index b43e48a..8e02936 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourcePropertiesDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourcePropertiesDto.cs @@ -2,7 +2,7 @@ { public class ResourcePropertiesDto { - public string LocalPath { get; set; } - public string ArtifactSize { get; set; } + public string? LocalPath { get; set; } + public string? ArtifactSize { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResultDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResultDto.cs index dd03e6f..2a951ba 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResultDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResultDto.cs @@ -4,6 +4,6 @@ namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; public class ResultListDto { - public List Value { get; set; } + public List? Value { get; set; } public int Count { get; set; } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/TriggerInfoDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/TriggerInfoDto.cs index 426d92c..0becac2 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/TriggerInfoDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/TriggerInfoDto.cs @@ -2,10 +2,10 @@ { public class TriggerInfoDto { - public string PrNumber { get; set; } - public string PrSourceBranch { get; set; } - public string PrSourceSha { get; set; } - public string PrTitle { get; set; } - public string PrIsFork { get; set; } + public string? PrNumber { get; set; } + public string? PrSourceBranch { get; set; } + public string? PrSourceSha { get; set; } + public string? PrTitle { get; set; } + public string? PrIsFork { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ValidationResultDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ValidationResultDto.cs index d31d494..6534024 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ValidationResultDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ValidationResultDto.cs @@ -2,7 +2,7 @@ { public class ValidationResultDto { - public string Result { get; set; } - public string Message { get; set; } + public string? Result { get; set; } + public string? Message { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/VariableGroupDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/VariableGroupDto.cs index a4a8484..8742c3c 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/VariableGroupDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/VariableGroupDto.cs @@ -9,27 +9,27 @@ public class VariableGroupDto { public long Id { get; set; } - public string Type { get; set; } + public string? Type { get; set; } - public string Name { get; set; } + public string? Name { get; set; } - public JObject Variables { get; set; } + public JObject? Variables { get; set; } - public string Description { get; set; } + public string? Description { get; set; } - public PersonDto CreatedBy { get; set; } + public PersonDto? CreatedBy { get; set; } public DateTime CreatedOn { get; set; } - public PersonDto ModifiedBy { get; set; } + public PersonDto? ModifiedBy { get; set; } public DateTime ModifiedOn { get; set; } public bool IsShared { get; set; } [JsonProperty("variableGroupProjectReferences")] - public List ProjectReferences { get; set; } - + public List? ProjectReferences { get; set; } + // providerData VariableGroupProviderData } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/WorkflowTaskDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/WorkflowTaskDto.cs index bf7e4e9..2df25b8 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/WorkflowTaskDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/WorkflowTaskDto.cs @@ -2,11 +2,11 @@ { public class WorkflowTaskDto { - public string TaskId { get; set; } + public string? TaskId { get; set; } - public string Version { get; set; } + public string? Version { get; set; } - public string Name { get; set; } + public string? Name { get; set; } public bool Enabled { get; set; } @@ -16,8 +16,8 @@ public class WorkflowTaskDto public int TimeoutInMinutes { get; set; } - public string DefinitionType { get; set; } + public string? DefinitionType { get; set; } - public InputsDto Inputs { get; set; } + public InputsDto? Inputs { get; set; } } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Mappers/AzureDevOpsDtoMapper.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Mappers/AzureDevOpsDtoMapper.cs new file mode 100644 index 0000000..6c12aca --- /dev/null +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Mappers/AzureDevOpsDtoMapper.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using AlmOps.AzureDevOpsComponent.Domain.Models; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; +using Riok.Mapperly.Abstractions; + +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; + +/// +/// Maps the DTOs of the Azure DevOps REST API to the domain models. +/// +/// +/// A model keeps a subset of what the API returns, so every member of the model must be mapped, not every member of the DTO. +/// +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class AzureDevOpsDtoMapper +{ + [MapProperty("Resource.Type", nameof(BuildArtifactModel.ResourceType))] + [MapProperty("Resource.Data", nameof(BuildArtifactModel.ResourceData))] + [MapProperty("Resource.Url", nameof(BuildArtifactModel.ResourceUrl))] + [MapProperty("Resource.DownloadUrl", nameof(BuildArtifactModel.ResourceDownloadUrl))] + [MapProperty("Resource.Properties.LocalPath", nameof(BuildArtifactModel.ResourceLocalPath))] + [MapProperty("Resource.Properties.ArtifactSize", nameof(BuildArtifactModel.ResourceArtifactSize))] + public partial BuildArtifactModel ToModel(BuildArtifactDto dto); + + public partial List ToModels(List dtos); + + public partial BuildModel ToModel(BuildDto dto); + + public partial List ToModels(List dtos); + + public partial ProjectModel ToModel(ProjectDto dto); + + public partial List ToModels(List dtos); + + public partial ReleaseModel ToModel(ReleaseDto dto); + + public partial ReleaseDefinitionModel ToModel(ReleaseDefinitionDto dto); + + public partial List ToModels(List dtos); + + public partial VariableGroupModel ToModel(VariableGroupDto dto); + + [MapProperty("DefinitionReference.Definition.Id", nameof(ReleaseArtifactModel.BuildDefinitionId))] + [MapProperty("DefinitionReference.Definition.Name", nameof(ReleaseArtifactModel.BuildDefinitionName))] + private partial ReleaseArtifactModel ToModel(ReleaseArtifactDto dto); +} diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/MappingProfiles/GenericMappingProfile.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/MappingProfiles/GenericMappingProfile.cs deleted file mode 100644 index 0c798ce..0000000 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/MappingProfiles/GenericMappingProfile.cs +++ /dev/null @@ -1,113 +0,0 @@ -using AutoMapper; - -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.MappingProfiles; - -public class GenericMappingProfile : Profile -{ - public override string ProfileName - { - get { return "AzureDevOpsRestApiGenericMappingProfile"; } - } - - public GenericMappingProfile() - { - CreateMap(); - CreateMap() - .ForMember(x => x.Drafts, opt => opt.Ignore()); - - CreateMap() - .ForMember(x => x.ResourceArtifactSize, opt => opt.MapFrom(x => x.Resource.Properties.ArtifactSize)) - .ForMember(x => x.ResourceData, opt => opt.MapFrom(x => x.Resource.Data)) - .ForMember(x => x.ResourceDownloadUrl, opt => opt.MapFrom(x => x.Resource.DownloadUrl)) - .ForMember(x => x.ResourceLocalPath, opt => opt.MapFrom(x => x.Resource.Properties.LocalPath)) - .ForMember(x => x.ResourceType, opt => opt.MapFrom(x => x.Resource.Type)) - .ForMember(x => x.ResourceUrl, opt => opt.MapFrom(x => x.Resource.Url)); - CreateMap() - .ForMember(x => x.Resource, opt => opt.MapFrom(x => x)); - CreateMap() - .ForMember(x => x.Data, opt => opt.MapFrom(x => x.ResourceData)) - .ForMember(x => x.DownloadUrl, opt => opt.MapFrom(x => x.ResourceDownloadUrl)) - .ForMember(x => x.Properties, opt => opt.MapFrom(x => x)) - .ForMember(x => x.Type, opt => opt.MapFrom(x => x.ResourceType)) - .ForMember(x => x.Url, opt => opt.MapFrom(x => x.ResourceUrl)); - CreateMap() - .ForMember(x => x.ArtifactSize, opt => opt.MapFrom(x => x.ResourceArtifactSize)) - .ForMember(x => x.LocalPath, opt => opt.MapFrom(x => x.ResourceLocalPath)); - - CreateMap(); - CreateMap() - .ForMember(x => x.Tags, opt => opt.Ignore()) - .ForMember(x => x.Repository, opt => opt.Ignore()) - .ForMember(x => x.Links, opt => opt.Ignore()) - .ForMember(x => x.Properties, opt => opt.Ignore()) - .ForMember(x => x.ValidationResults, opt => opt.Ignore()) - .ForMember(x => x.Plans, opt => opt.Ignore()) - .ForMember(x => x.TriggerInfo, opt => opt.Ignore()) - .ForMember(x => x.BuildNumberRevision, opt => opt.Ignore()) - .ForMember(x => x.Parameters, opt => opt.Ignore()) - .ForMember(x => x.OrchestrationPlan, opt => opt.Ignore()) - .ForMember(x => x.Logs, opt => opt.Ignore()) - .ForMember(x => x.KeepForever, opt => opt.Ignore()) - .ForMember(x => x.RetainedByRelease, opt => opt.Ignore()) - .ForMember(x => x.TriggeredByBuild, opt => opt.Ignore()); - - CreateMap(); - CreateMap(); - - CreateMap(); - CreateMap(); - - CreateMap(); - CreateMap() - .ForMember(x => x.LastUpdateTime, opt => opt.Ignore()); - - CreateMap(); - CreateMap(); - - CreateMap(); - CreateMap() - .ForMember(x => x.Artifacts, opt => opt.Ignore()) - .ForMember(x => x.Links, opt => opt.Ignore()); - - CreateMap(); - CreateMap() - .ForMember(x => x.Links, opt => opt.Ignore()) - .ForMember(x => x.ProjectReference, opt => opt.Ignore()) - .ForMember(x => x.Properties, opt => opt.Ignore()) - .ForMember(x => x.Triggers, opt => opt.Ignore()) - .ForMember(x => x.Tags, opt => opt.Ignore()) - .ForMember(x => x.VariableGroups, opt => opt.Ignore()) - .ForMember(x => x.Variables, opt => opt.Ignore()); - - CreateMap(); - CreateMap() - .ForMember(x => x.DeploySteps, opt => opt.Ignore()) - .ForMember(x => x.DeployPhasesSnapshot, opt => opt.Ignore()) - .ForMember(x => x.WorkflowTasks, opt => opt.Ignore()) - .ForMember(x => x.Conditions, opt => opt.Ignore()) - .ForMember(x => x.Demands, opt => opt.Ignore()) - .ForMember(x => x.EnvironmentOptions, opt => opt.Ignore()) - .ForMember(x => x.PostApprovalsSnapshot, opt => opt.Ignore()) - .ForMember(x => x.PreApprovalsSnapshot, opt => opt.Ignore()) - .ForMember(x => x.PreDeployApprovals, opt => opt.Ignore()) - .ForMember(x => x.PostDeployApprovals, opt => opt.Ignore()); - - CreateMap() - .ForMember(x => x.BuildDefinitionId, opt => opt.MapFrom(x => x.DefinitionReference.Definition.Id)) - .ForMember(x => x.BuildDefinitionName, opt => opt.MapFrom(x => x.DefinitionReference.Definition.Name)); - CreateMap() - .ForMember(x => x.DefinitionReference, opt => opt.MapFrom(x => x)); - CreateMap() - .ForMember(x => x.ArtifactSourceDefinitionUrl, opt => opt.Ignore()) - .ForMember(x => x.ArtifactSourceVersionUrl, opt => opt.Ignore()) - .ForMember(x => x.DefaultVersionBranch, opt => opt.Ignore()) - .ForMember(x => x.DefaultVersionSpecific, opt => opt.Ignore()) - .ForMember(x => x.DefaultVersionTags, opt => opt.Ignore()) - .ForMember(x => x.DefaultVersionType, opt => opt.Ignore()) - .ForMember(x => x.Definition, opt => opt.MapFrom(x => new Dto.NameValueDto { Id = x.BuildDefinitionId, Name = x.BuildDefinitionName })) - .ForMember(x => x.Project, opt => opt.Ignore()) - .ForMember(x => x.Version, opt => opt.Ignore()); - - CreateMap(); - } -} diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildArtifactRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildArtifactRepository.cs index 30a8230..bd30574 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildArtifactRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildArtifactRepository.cs @@ -4,7 +4,7 @@ using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; -using AutoMapper; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; using Microsoft.Extensions.Logging; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Repositories; @@ -17,7 +17,7 @@ public class BuildArtifactRepository( AzureDevOpsRestApiConfiguration configuration, ILogger logger, IHttpClientFactory httpClientFactory, - IMapper mapper) + AzureDevOpsDtoMapper mapper) : RepositoryBase(configuration, logger, httpClientFactory, mapper), IBuildArtifactRepository { protected override string ResourceName => "_apis/build/builds"; @@ -34,6 +34,6 @@ public class BuildArtifactRepository( public async Task> FindAllAsync(string projectName, string buildId) { var resultList = await GetAsync>(GenerateUrl(prefix: $"/{projectName}", suffix: $"/{buildId}/artifacts")); - return Mapper.Map>(resultList.Value); + return Mapper.ToModels(resultList.Value ?? []); } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildRepository.cs index 02f488c..c2cd79b 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildRepository.cs @@ -4,7 +4,7 @@ using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; -using AutoMapper; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; using Microsoft.Extensions.Logging; using Withywoods.Serialization.Json; @@ -18,7 +18,7 @@ public class BuildRepository( AzureDevOpsRestApiConfiguration configuration, ILogger logger, IHttpClientFactory httpClientFactory, - IMapper mapper) + AzureDevOpsDtoMapper mapper) : RepositoryBase(configuration, logger, httpClientFactory, mapper), IBuildRepository { protected override string ResourceName => "_apis/build/builds"; @@ -35,13 +35,13 @@ public async Task> FindAllAsync(string projectName, string bran arguments += $"&definitions={buildDefinitionsId}"; } var resultList = await GetAsync>(GenerateUrl(prefix: $"/{projectName}", arguments: arguments)); - return Mapper.Map>(resultList.Value); + return Mapper.ToModels(resultList.Value ?? []); } public async Task FindOneByIdAsync(string projectName, string id) { var result = await GetAsync(GenerateUrl(prefix: $"/{projectName}", suffix: $"/{id}")); - return Mapper.Map(result); + return Mapper.ToModel(result); } /// @@ -65,6 +65,6 @@ public async Task CreateAsync(string projectName, string buildDefini SourceBranch = sourceBranchName, Parameters = variables.ToJson() }); - return Mapper.Map(result); + return Mapper.ToModel(result); } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildTagRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildTagRepository.cs index 2fa0105..69af5a6 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildTagRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildTagRepository.cs @@ -1,7 +1,7 @@ using System.Net.Http; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Repositories; -using AutoMapper; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; using Microsoft.Extensions.Logging; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Repositories; @@ -14,7 +14,7 @@ public class BuildTagRepository( AzureDevOpsRestApiConfiguration configuration, ILogger logger, IHttpClientFactory httpClientFactory, - IMapper mapper) + AzureDevOpsDtoMapper mapper) : RepositoryBase(configuration, logger, httpClientFactory, mapper), IBuildTagRepository { protected override string ResourceName => "_apis/build/builds"; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ProjectRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ProjectRepository.cs index a6aad2d..041fc70 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ProjectRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ProjectRepository.cs @@ -4,7 +4,7 @@ using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; -using AutoMapper; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; using Microsoft.Extensions.Logging; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Repositories; @@ -19,7 +19,7 @@ public class ProjectRepository( AzureDevOpsRestApiConfiguration configuration, ILogger logger, IHttpClientFactory httpClientFactory, - IMapper mapper) + AzureDevOpsDtoMapper mapper) : RepositoryBase(configuration, logger, httpClientFactory, mapper), IProjectRepository { protected override string ResourceName => "_apis/projects"; @@ -27,6 +27,6 @@ public class ProjectRepository( public async Task> FindAllAsync() { var resultList = await GetAsync>(GenerateUrl()); - return Mapper.Map>(resultList.Value); + return Mapper.ToModels(resultList.Value ?? []); } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseDefinitionRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseDefinitionRepository.cs index 586cfb7..2630dc7 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseDefinitionRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseDefinitionRepository.cs @@ -4,7 +4,7 @@ using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; -using AutoMapper; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; using Microsoft.Extensions.Logging; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Repositories; @@ -19,7 +19,7 @@ public class ReleaseDefinitionRepository( AzureDevOpsRestApiConfiguration configuration, ILogger logger, IHttpClientFactory httpClientFactory, - IMapper mapper) + AzureDevOpsDtoMapper mapper) : RepositoryBase(configuration, logger, httpClientFactory, mapper), IReleaseDefinitionRepository { protected override string ResourceName => "_apis/release/definitions"; @@ -29,13 +29,13 @@ public async Task> FindAllAsync(string projectName, var arguments = $"&$top=10&searchText={searchText}"; var resultList = await GetAsync>( GenerateUrl(prefix: $"/{projectName}", arguments: arguments, isVsrm: true)); - return Mapper.Map>(resultList.Value); + return Mapper.ToModels(resultList.Value ?? []); } public async Task FindOneByIdAsync(string projectName, string id) { var result = await GetAsync( GenerateUrl(prefix: $"/{projectName}", suffix: $"/{id}", isVsrm: true)); - return Mapper.Map(result); + return Mapper.ToModel(result); } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseRepository.cs index fa9b16a..bf9b84c 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseRepository.cs @@ -3,7 +3,7 @@ using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; -using AutoMapper; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; using Microsoft.Extensions.Logging; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Repositories; @@ -16,7 +16,7 @@ public class ReleaseRepository( AzureDevOpsRestApiConfiguration configuration, ILogger logger, IHttpClientFactory httpClientFactory, - IMapper mapper) + AzureDevOpsDtoMapper mapper) : RepositoryBase(configuration, logger, httpClientFactory, mapper), IReleaseRepository { protected override string ResourceName => "_apis/release/releases"; @@ -43,6 +43,6 @@ public async Task CreateAsync(string projectName, string releaseDe IsDraft = false, Reason = "none" }); - return Mapper.Map(result); + return Mapper.ToModel(result); } } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs index 5b7c723..0c83f94 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs @@ -1,5 +1,5 @@ using System.Net.Http; -using AutoMapper; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; using Microsoft.Extensions.Logging; using Withywoods.Net.Http; @@ -9,12 +9,12 @@ public abstract class RepositoryBase( AzureDevOpsRestApiConfiguration configuration, ILogger logger, IHttpClientFactory httpClientFactory, - IMapper mapper) + AzureDevOpsDtoMapper mapper) : HttpRepositoryBase(logger, httpClientFactory) { private AzureDevOpsRestApiConfiguration Configuration { get; } = configuration; - protected IMapper Mapper { get; private set; } = mapper; + protected AzureDevOpsDtoMapper Mapper { get; } = mapper; protected override string HttpClientName => Configuration.HttpClientName; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/VariableGroupRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/VariableGroupRepository.cs index 5850364..1a7596b 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/VariableGroupRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/VariableGroupRepository.cs @@ -4,7 +4,7 @@ using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; -using AutoMapper; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; using Microsoft.Extensions.Logging; using Newtonsoft.Json.Linq; using Withywoods.Serialization.Json; @@ -21,7 +21,7 @@ public class VariableGroupRepository( AzureDevOpsRestApiConfiguration configuration, ILogger logger, IHttpClientFactory httpClientFactory, - IMapper mapper) + AzureDevOpsDtoMapper mapper) : RepositoryBase(configuration, logger, httpClientFactory, mapper), IVariableGroupRepository { protected override string ResourceName => "_apis/distributedtask/variablegroups"; @@ -38,7 +38,7 @@ public class VariableGroupRepository( public async Task FindOneByIdAsync(string projectName, string id) { var result = await FindOneVariableGroupDto(projectName, id); - return Mapper.Map(result); + return Mapper.ToModel(result); } /// @@ -60,16 +60,16 @@ public async Task UpdateAsync(string projectName, string id, Dictionary - diff --git a/src/ConsoleApp/Dockerfile b/src/ConsoleApp/Dockerfile index 6cd5930..3636364 100644 --- a/src/ConsoleApp/Dockerfile +++ b/src/ConsoleApp/Dockerfile @@ -1,19 +1,21 @@ -FROM registry.suse.com/bci/dotnet-aspnet:10.0 AS base -USER app +# syntax=docker/dockerfile:1 + +FROM registry.suse.com/bci/dotnet-aspnet:10.0.13 AS base +USER $APP_UID WORKDIR /app -FROM registry.suse.com/bci/dotnet-sdk:10.0 AS build +FROM registry.suse.com/bci/dotnet-sdk:10.0.13 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src -COPY ["src/", "./"] -RUN dotnet restore "ConsoleApp/ConsoleApp.csproj" -COPY . . -WORKDIR "/src/ConsoleApp" -RUN dotnet build "ConsoleApp.csproj" -c $BUILD_CONFIGURATION -o /app/build +COPY ./Directory.*.props . +COPY ./src ./src +RUN dotnet restore "src/ConsoleApp/ConsoleApp.csproj" +RUN dotnet build "src/ConsoleApp/ConsoleApp.csproj" --no-restore -c "$BUILD_CONFIGURATION" FROM build AS publish ARG BUILD_CONFIGURATION=Release -RUN dotnet publish "ConsoleApp.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false +WORKDIR /src +RUN dotnet publish "src/ConsoleApp/ConsoleApp.csproj" --no-build -c "$BUILD_CONFIGURATION" -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app diff --git a/src/ConsoleApp/Program.cs b/src/ConsoleApp/Program.cs index 3f4f309..e416c90 100644 --- a/src/ConsoleApp/Program.cs +++ b/src/ConsoleApp/Program.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.DependencyInjection; using AlmOps.ConsoleApp.Tasks; -using AutoMapper; using CommandLine; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -137,23 +136,9 @@ private static ServiceProvider CreateServiceProvider(CommandLineOptions opts, IC .AddSingleton(configuration) .AddAzureDevOpsRestApi(appConfiguration.AzureDevOpsRestApiConfiguration); - ConfigureAutoMapper(serviceCollection); - return serviceCollection.BuildServiceProvider(); } - private static void ConfigureAutoMapper(IServiceCollection serviceCollection) - { - var mappingConfig = new MapperConfiguration(x => - { - x.AddProfile(new AzureDevOpsComponent.Infrastructure.RestApi.MappingProfiles.GenericMappingProfile()); - x.AllowNullCollections = true; - }); - var mapper = mappingConfig.CreateMapper(); - mapper.ConfigurationProvider.AssertConfigurationIsValid(); - serviceCollection.AddSingleton(mapper); - } - private static void LogVerbose(CommandLineOptions opts, string message) { if (opts.IsVerbose) diff --git a/src/ConsoleApp/Tasks/ConsoleTaskFactory.cs b/src/ConsoleApp/Tasks/ConsoleTaskFactory.cs index 8addc44..f285b2d 100644 --- a/src/ConsoleApp/Tasks/ConsoleTaskFactory.cs +++ b/src/ConsoleApp/Tasks/ConsoleTaskFactory.cs @@ -6,7 +6,7 @@ namespace AlmOps.ConsoleApp.Tasks; public class ConsoleTaskFactory(ServiceProvider serviceProvider) { - public IConsoleTask? Create(string action, string resource, out string? errorMessage) + public IConsoleTask? Create(string action, string? resource, out string? errorMessage) { errorMessage = null; switch (resource) diff --git a/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs b/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs index a9eee78..83afcaf 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs @@ -6,39 +6,39 @@ namespace AlmOps.GitLabComponent.Infrastructure.RestApi.Dto; public class AuditEventDto { public long Id { get; set; } - + [JsonProperty("author_id")] public long AuthorId { get; set; } - + [JsonProperty("entity_id")] public long EntityId { get; set; } - + [JsonProperty("entity_type")] public required string EntityType { get; set; } - + public required DetailsDto Details { get; set; } - + [JsonProperty("created_at")] public DateTime CreatedAt { get; set; } - + [JsonProperty("ip_address")] public string? IpAddress { get; set; } - + [JsonProperty("author_name")] public string? AuthorName { get; set; } - + [JsonProperty("entity_path")] public string? EntityPath { get; set; } - + [JsonProperty("target_details")] public string? TargetDetails { get; set; } - + [JsonProperty("target_type")] public string? TargetType { get; set; } - + [JsonProperty("target_id")] public long TargetId { get; set; } - + [JsonProperty("event_type")] public string? EventType { get; set; } } diff --git a/src/GitLabComponent.Infrastructure.RestApi/Dto/DetailsDto.cs b/src/GitLabComponent.Infrastructure.RestApi/Dto/DetailsDto.cs index d1d6344..25eaf55 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/Dto/DetailsDto.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/Dto/DetailsDto.cs @@ -6,36 +6,36 @@ public class DetailsDto { [JsonProperty("custom_message")] public string? CustomMessage { get; set; } - + [JsonProperty("author_name")] public string? AuthorName { get; set; } - + [JsonProperty("author_email")] public string? AuthorEmail { get; set; } - + [JsonProperty("target_id")] public object? TargetId { get; set; } - + [JsonProperty("target_type")] public string? TargetType { get; set; } - + [JsonProperty("target_details")] public string? TargetDetails { get; set; } - + [JsonProperty("ip_address")] public string? IpAddress { get; set; } - + [JsonProperty("entity_path")] public string? EntityPath { get; set; } - + public string? Add { get; set; } - + public string? Change { get; set; } - + public string? From { get; set; } - + public string? To { get; set; } - + [JsonProperty("author_class")] public string? AuthorClass { get; set; } } diff --git a/src/GitLabComponent.Infrastructure.RestApi/GitLabRestApiConfiguration.cs b/src/GitLabComponent.Infrastructure.RestApi/GitLabRestApiConfiguration.cs index 6454e55..03ba4a0 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/GitLabRestApiConfiguration.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/GitLabRestApiConfiguration.cs @@ -10,7 +10,7 @@ public class GitLabRestApiConfiguration /// /// Access token. - /// Can be a User (Personal) Access Token, a Group Access Token, a Project Access Token, a Service Account Token. + /// Can be a User (Personal) Access Token, a Group Access Token, a Project Access Token, a Service Account Token. /// /// glpat-xxxxxx public required string Token { get; init; } diff --git a/src/GitLabComponent.Infrastructure.RestApi/Repositories/AuditEventRepository.cs b/src/GitLabComponent.Infrastructure.RestApi/Repositories/AuditEventRepository.cs index 8e806cc..8ef3aa8 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/Repositories/AuditEventRepository.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/Repositories/AuditEventRepository.cs @@ -22,12 +22,12 @@ public async Task> FindAtInstanceLevelAsync() { return await GetAsync>(GenerateUrl("audit_events")); } - + public async Task> FindAtGroupLevelAsync(string groupId) { return await GetAsync>(GenerateUrl($"groups/{groupId}/audit_events")); } - + public async Task> FindAtProjectLevelAsync(string projectId) { return await GetAsync>(GenerateUrl($"projects/{projectId}/audit_events")); diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.csproj b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.csproj index 62c89f6..7f9bd2a 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.csproj +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.csproj @@ -2,38 +2,26 @@ net10.0 + Exe AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests enable false + true - - full - true - + + + - + - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs index e4f5515..3196a77 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs @@ -1,6 +1,5 @@ using System; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.DependencyInjection; -using AutoMapper; using Microsoft.Extensions.DependencyInjection; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests; @@ -28,15 +27,8 @@ protected RepositoryIntegrationTestBase(string environmentName) ProjectName = GetEnvironmentVariable("Project"); - var mappingConfig = new MapperConfiguration(x => - { - x.AddProfile(new MappingProfiles.GenericMappingProfile()); - x.AllowNullCollections = true; - }); - var services = new ServiceCollection() .AddLogging() - .AddSingleton(mappingConfig.CreateMapper()) .AddAzureDevOpsRestApi(Configuration); ServiceProvider = services.BuildServiceProvider(); diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/Sandbox/VariableGroupRepositorySandboxTest.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/Sandbox/VariableGroupRepositorySandboxTest.cs index 34b86f3..e976c24 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/Sandbox/VariableGroupRepositorySandboxTest.cs +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/Sandbox/VariableGroupRepositorySandboxTest.cs @@ -1,14 +1,10 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Net.Http; using System.Threading.Tasks; -using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Repositories; -using AutoFixture; -using AutoMapper; -using FluentAssertions; +using AlmOps.AzureDevOpsComponent.Domain.Repositories; +using AwesomeAssertions; +using Bogus; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using Newtonsoft.Json.Linq; using Xunit; @@ -37,30 +33,26 @@ public async Task VariableGroupRepositoryUpdateAsync_OnSandbox_IsSuccessful() // Arrange var repository = BuildRepository(); var variableGroupId = GetEnvironmentVariable("VariableGroupId"); - var fixture = new Fixture(); - var inputCreate = fixture.CreateMany>(5).ToDictionary(x => x.Key, x => x.Value); + var faker = new Faker(); + var inputCreate = Enumerable.Range(0, 5).ToDictionary(_ => faker.Random.AlphaNumeric(12), _ => faker.Lorem.Word()); inputCreate.Add("test", DateTime.Now.ToShortDateString()); - var inputUpdate = fixture.CreateMany>(3).ToDictionary(x => x.Key, x => x.Value); + var inputUpdate = Enumerable.Range(0, 3).ToDictionary(_ => faker.Random.AlphaNumeric(12), _ => faker.Lorem.Word()); inputUpdate.Add("test", DateTime.Now.ToLongDateString()); // Act & Assert await repository.UpdateAsync(ProjectName, variableGroupId, inputCreate, true); var outputAfterFirstUpdate = await repository.FindOneByIdAsync(ProjectName, variableGroupId); outputAfterFirstUpdate.Should().NotBeNull(); - ((JObject)outputAfterFirstUpdate.Variables).Children().Count().Should().Be(6); + ((JObject)outputAfterFirstUpdate.Variables!).Children().Count().Should().Be(6); await repository.UpdateAsync(ProjectName, variableGroupId, inputUpdate); var outputAfterSecondUpdate = await repository.FindOneByIdAsync(ProjectName, variableGroupId); outputAfterSecondUpdate.Should().NotBeNull(); - ((JObject)outputAfterSecondUpdate.Variables).Children().Count().Should().Be(9); + ((JObject)outputAfterSecondUpdate.Variables!).Children().Count().Should().Be(9); } - private VariableGroupRepository BuildRepository() + private IVariableGroupRepository BuildRepository() { - var logger = ServiceProvider.GetService>(); - var httpClientFactory = ServiceProvider.GetService(); - var mapper = ServiceProvider.GetService(); - - return new VariableGroupRepository(Configuration, logger, httpClientFactory, mapper); + return ServiceProvider.GetRequiredService(); } } diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.csproj b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.csproj index e0880bc..5c34328 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.csproj +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.csproj @@ -1,11 +1,13 @@ - + net10.0 + Exe AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.UnitTests AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.UnitTests enable false + true @@ -13,23 +15,14 @@ - - - - + + - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/DependencyInjection/ServiceCollectionExtensionsTest.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/DependencyInjection/ServiceCollectionExtensionsTest.cs index 0d9b8f5..ffc5fb5 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/DependencyInjection/ServiceCollectionExtensionsTest.cs +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/DependencyInjection/ServiceCollectionExtensionsTest.cs @@ -1,8 +1,8 @@ using System; using System.Net.Http; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.DependencyInjection; -using AutoMapper; -using FluentAssertions; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; +using AwesomeAssertions; using Microsoft.Extensions.DependencyInjection; using Xunit; @@ -32,10 +32,8 @@ public void AddAzureDevOpsRestApi_ShouldProvideConfiguration() public void AddAzureDevOpsRestApi_ShouldProvideRepositories() { // Arrange - var mappingConfig = new MapperConfiguration(x => { x.AllowNullCollections = true; }); var serviceCollection = new ServiceCollection() - .AddLogging() - .AddSingleton(mappingConfig.CreateMapper()); + .AddLogging(); // Act serviceCollection.AddAzureDevOpsRestApi(_configuration); @@ -48,6 +46,21 @@ public void AddAzureDevOpsRestApi_ShouldProvideRepositories() services.GetRequiredService().Should().NotBeNull(); services.GetRequiredService().Should().NotBeNull(); services.GetRequiredService().Should().NotBeNull(); + services.GetRequiredService().Should().NotBeNull(); + } + + [Fact] + public void AddAzureDevOpsRestApi_ShouldProvideMapper() + { + // Arrange + var serviceCollection = new ServiceCollection(); + + // Act + serviceCollection.AddAzureDevOpsRestApi(_configuration); + + // Assert + var services = serviceCollection.BuildServiceProvider(); + services.GetRequiredService().Should().NotBeNull(); } [Fact] diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Mappers/AzureDevOpsDtoMapperTest.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Mappers/AzureDevOpsDtoMapperTest.cs new file mode 100644 index 0000000..fefd4a4 --- /dev/null +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Mappers/AzureDevOpsDtoMapperTest.cs @@ -0,0 +1,167 @@ +using System; +using System.Collections.Generic; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; +using AwesomeAssertions; +using Newtonsoft.Json.Linq; +using Xunit; + +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.Mappers; + +[Trait("Category", "UnitTests")] +public class AzureDevOpsDtoMapperTest +{ + private readonly AzureDevOpsDtoMapper _mapper = new(); + + [Fact] + public void ToModel_BuildArtifact_FlattensResource() + { + var dto = new BuildArtifactDto + { + Id = 12, + Name = "drop", + Source = "source-1", + Resource = new ResourceDto + { + Type = "Container", + Data = "#/1/drop", + Url = "https://dev.azure.com/org/artifacts/12", + DownloadUrl = "https://dev.azure.com/org/artifacts/12/zip", + Properties = new ResourcePropertiesDto { LocalPath = "/drop", ArtifactSize = "1024" } + } + }; + + var model = _mapper.ToModel(dto); + + model.Id.Should().Be(12); + model.Name.Should().Be("drop"); + model.Source.Should().Be("source-1"); + model.ResourceType.Should().Be("Container"); + model.ResourceData.Should().Be("#/1/drop"); + model.ResourceUrl.Should().Be("https://dev.azure.com/org/artifacts/12"); + model.ResourceDownloadUrl.Should().Be("https://dev.azure.com/org/artifacts/12/zip"); + model.ResourceLocalPath.Should().Be("/drop"); + model.ResourceArtifactSize.Should().Be("1024"); + } + + [Fact] + public void ToModel_BuildArtifactWithoutResource_LeavesResourceFieldsEmpty() + { + var model = _mapper.ToModel(new BuildArtifactDto { Id = 3, Name = "logs" }); + + model.Name.Should().Be("logs"); + model.ResourceType.Should().BeNull(); + model.ResourceLocalPath.Should().BeNull(); + } + + [Fact] + public void ToModel_Build_MapsNestedObjects() + { + var dto = new BuildDto + { + Id = "264", + BuildNumber = "20261020.1", + Status = "completed", + Result = "succeeded", + QueueTime = new DateTime(2026, 10, 20, 8, 0, 0, DateTimeKind.Utc), + SourceBranch = "refs/heads/main", + Definition = new BuildDefinitionDto { Id = "3", Name = "almops-ci", Project = new ProjectDto { Name = "almops" } }, + Project = new ProjectDto { Id = "p1", Name = "almops" }, + Queue = new QueueDto { Id = 9, Name = "Azure Pipelines", Pool = new PoolDto { Id = 1, Name = "Hosted", IsHosted = true } }, + RequestedFor = new PersonDto { DisplayName = "Build Agent", UniqueName = "agent@devpro.fr" }, + Tags = ["release"] + }; + + var model = _mapper.ToModel(dto); + + model.Id.Should().Be("264"); + model.BuildNumber.Should().Be("20261020.1"); + model.QueueTime.Should().Be(dto.QueueTime); + model.SourceBranch.Should().Be("refs/heads/main"); + model.Definition!.Name.Should().Be("almops-ci"); + model.Definition.Project!.Name.Should().Be("almops"); + model.Project!.Id.Should().Be("p1"); + model.Queue!.Pool!.IsHosted.Should().BeTrue(); + model.RequestedFor!.UniqueName.Should().Be("agent@devpro.fr"); + model.RequestedBy.Should().BeNull(); + } + + [Fact] + public void ToModel_Release_ConvertsIdAndMapsEnvironments() + { + var dto = new ReleaseDto + { + Id = 42, + Name = "Release-42", + Status = "active", + Environments = [new EnvironmentDto { Id = 7, Name = "Production", Owner = new PersonDto { DisplayName = "Ops" } }], + ReleaseDefinition = new ReleaseDefinitionDto { Id = 5, Name = "almops-cd" }, + ProjectReference = new ProjectDto { Name = "almops" } + }; + + var model = _mapper.ToModel(dto); + + model.Id.Should().Be("42"); + model.Name.Should().Be("Release-42"); + model.Environments.Should().ContainSingle().Which.Owner!.DisplayName.Should().Be("Ops"); + model.ReleaseDefinition!.Name.Should().Be("almops-cd"); + model.ProjectReference!.Name.Should().Be("almops"); + } + + [Fact] + public void ToModel_ReleaseDefinition_FlattensArtifactDefinitionReference() + { + var dto = new ReleaseDefinitionDto + { + Id = 5, + Name = "almops-cd", + Artifacts = + [ + new ReleaseArtifactDto + { + Alias = "_almops-ci", + IsPrimary = true, + SourceId = "p1:3", + Type = "Build", + DefinitionReference = new DefinitionReferenceDto { Definition = new NameValueDto { Id = "3", Name = "almops-ci" } } + }, + new ReleaseArtifactDto { Alias = "_other" } + ] + }; + + var model = _mapper.ToModel(dto); + + model.Artifacts.Should().HaveCount(2); + var primary = model.Artifacts![0]; + primary.Alias.Should().Be("_almops-ci"); + primary.IsPrimary.Should().BeTrue(); + primary.BuildDefinitionId.Should().Be("3"); + primary.BuildDefinitionName.Should().Be("almops-ci"); + model.Artifacts[1].BuildDefinitionId.Should().BeNull(); + } + + [Fact] + public void ToModel_VariableGroup_KeepsVariables() + { + var variables = JObject.Parse("{\"key1\":{\"value\":\"value1\"}}"); + var dto = new VariableGroupDto { Id = 8, Name = "almops-vars", Type = "Vsts", Variables = variables }; + + var model = _mapper.ToModel(dto); + + model.Id.Should().Be(8); + model.Name.Should().Be("almops-vars"); + model.Variables.Should().BeSameAs(variables); + } + + [Fact] + public void ToModels_Projects_MapsEveryItem() + { + List dtos = [new() { Id = "1", Name = "almops", Visibility = "public" }, new() { Id = "2", Name = "keeptrack" }]; + + var models = _mapper.ToModels(dtos); + + models.Should().HaveCount(2); + models[0].Visibility.Should().Be("public"); + models[1].Name.Should().Be("keeptrack"); + } +} diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/MappingProfiles/GenericMappingProfileTest.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/MappingProfiles/GenericMappingProfileTest.cs deleted file mode 100644 index 8b09f75..0000000 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/MappingProfiles/GenericMappingProfileTest.cs +++ /dev/null @@ -1,20 +0,0 @@ -using AutoMapper; -using Xunit; - -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.MappingProfiles; - -[Trait("Category", "UnitTests")] -public class GenericMappingProfileTest -{ - [Fact] - public void GenericMappingProfileBuildAutoMapper_AssertConfigurationIsValid() - { - var mappingConfig = new MapperConfiguration(x => - { - x.AddProfile(new RestApi.MappingProfiles.GenericMappingProfile()); - x.AllowNullCollections = true; - }); - var mapper = mappingConfig.CreateMapper(); - mapper.ConfigurationProvider.AssertConfigurationIsValid(); - } -} diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/BuildArtifactRepositoryTest.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/BuildArtifactRepositoryTest.cs new file mode 100644 index 0000000..3f51f26 --- /dev/null +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/BuildArtifactRepositoryTest.cs @@ -0,0 +1,47 @@ +using System.Threading.Tasks; +using AlmOps.AzureDevOpsComponent.Domain.Repositories; +using AwesomeAssertions; +using Xunit; + +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.Repositories; + +[Trait("Category", "UnitTests")] +public class BuildArtifactRepositoryTest : RepositoryTestBase +{ + [Fact] + public async Task FindAllAsync_ReadsNestedResource() + { + var repository = CreateRepository( + """ + { + "count": 1, + "value": [ + { + "id": 90, + "name": "drop", + "source": "11", + "resource": { + "type": "Container", + "data": "#/1/drop", + "properties": { "localpath": "/home/vsts/work/1/a", "artifactsize": "2048" }, + "url": "https://dev.azure.com/devpro/almops/_apis/build/builds/90/artifacts?artifactName=drop", + "downloadUrl": "https://dev.azure.com/devpro/almops/_apis/build/builds/90/artifacts?artifactName=drop&$format=zip" + } + } + ] + } + """); + + var artifacts = await repository.FindAllAsync("almops", "90"); + + LastRequest!.RequestUri!.AbsolutePath.Should().Be("/devpro/almops/_apis/build/builds/90/artifacts"); + artifacts.Should().ContainSingle(); + var artifact = artifacts[0]; + artifact.Id.Should().Be(90); + artifact.Name.Should().Be("drop"); + artifact.ResourceType.Should().Be("Container"); + artifact.ResourceLocalPath.Should().Be("/home/vsts/work/1/a"); + artifact.ResourceArtifactSize.Should().Be("2048"); + artifact.ResourceDownloadUrl.Should().EndWith("&$format=zip"); + } +} diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/ProjectRepositoryTest.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/ProjectRepositoryTest.cs new file mode 100644 index 0000000..6cec781 --- /dev/null +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/ProjectRepositoryTest.cs @@ -0,0 +1,38 @@ +using System.Threading.Tasks; +using AlmOps.AzureDevOpsComponent.Domain.Repositories; +using AwesomeAssertions; +using Xunit; + +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.Repositories; + +[Trait("Category", "UnitTests")] +public class ProjectRepositoryTest : RepositoryTestBase +{ + [Fact] + public async Task FindAllAsync_ReadsCamelCaseResponse() + { + var repository = CreateRepository( + """ + { + "count": 2, + "value": [ + { "id": "eb6e4656", "name": "almops", "description": "ALM tool", "url": "https://dev.azure.com/devpro/_apis/projects/eb6e4656", "state": "wellFormed", "revision": 411, "visibility": "public", "lastUpdateTime": "2026-10-20T08:00:00Z" }, + { "id": "6ce954b1", "name": "keeptrack", "state": "wellFormed", "revision": 12, "visibility": "private" } + ] + } + """); + + var projects = await repository.FindAllAsync(); + + LastRequest!.RequestUri!.ToString().Should().Be("https://dev.azure.com/devpro/_apis/projects?api-version=7.1"); + LastRequest.Headers.Authorization!.Scheme.Should().Be("Basic"); + projects.Should().HaveCount(2); + projects[0].Id.Should().Be("eb6e4656"); + projects[0].Name.Should().Be("almops"); + projects[0].Description.Should().Be("ALM tool"); + projects[0].State.Should().Be("wellFormed"); + projects[0].Revision.Should().Be(411); + projects[0].Visibility.Should().Be("public"); + projects[1].Name.Should().Be("keeptrack"); + } +} diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/RepositoryTestBase.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/RepositoryTestBase.cs new file mode 100644 index 0000000..b735cbd --- /dev/null +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/RepositoryTestBase.cs @@ -0,0 +1,43 @@ +using System.Net; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; +using Moq; +using Moq.Protected; + +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.Repositories; + +/// +/// Resolves repositories from the registration the application uses, with an HTTP handler answering the JSON the API sends, +/// so that a test covers the deserialization and the mapping together. +/// +public abstract class RepositoryTestBase +{ + protected AzureDevOpsRestApiConfiguration Configuration { get; } = new() + { + BaseUrl = "https://dev.azure.com/devpro", + Username = "user", + Token = "token" + }; + + protected HttpRequestMessage? LastRequest { get; private set; } + + protected T CreateRepository(string responseJson) where T : notnull + { + var handler = new Mock(); + handler.Protected() + .Setup>("SendAsync", ItExpr.IsAny(), ItExpr.IsAny()) + .Callback((request, _) => LastRequest = request) + .ReturnsAsync(() => new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(responseJson, Encoding.UTF8, "application/json") }); + + var services = new ServiceCollection() + .AddLogging() + .AddAzureDevOpsRestApi(Configuration); + services.AddHttpClient(Configuration.HttpClientName).ConfigurePrimaryHttpMessageHandler(() => handler.Object); + + return services.BuildServiceProvider().GetRequiredService(); + } +} diff --git a/test/ConsoleApp.IntegrationTests/ConsoleApp.IntegrationTests.csproj b/test/ConsoleApp.IntegrationTests/ConsoleApp.IntegrationTests.csproj index 50ad57c..2921f05 100644 --- a/test/ConsoleApp.IntegrationTests/ConsoleApp.IntegrationTests.csproj +++ b/test/ConsoleApp.IntegrationTests/ConsoleApp.IntegrationTests.csproj @@ -1,11 +1,13 @@ - + net10.0 + Exe AlmOps.ConsoleApp.IntegrationTests AlmOps.ConsoleApp.IntegrationTests enable false + true @@ -13,26 +15,10 @@ - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + diff --git a/test/ConsoleApp.IntegrationTests/SmokeTest.cs b/test/ConsoleApp.IntegrationTests/SmokeTest.cs index 56a7443..c24d846 100644 --- a/test/ConsoleApp.IntegrationTests/SmokeTest.cs +++ b/test/ConsoleApp.IntegrationTests/SmokeTest.cs @@ -1,7 +1,8 @@ using System; using System.Linq; using System.Threading.Tasks; -using FluentAssertions; +using AwesomeAssertions; +using Xunit; namespace AlmOps.ConsoleApp.IntegrationTests; diff --git a/test/ConsoleApp.UnitTests/ConsoleApp.UnitTests.csproj b/test/ConsoleApp.UnitTests/ConsoleApp.UnitTests.csproj index a495cb8..641781c 100644 --- a/test/ConsoleApp.UnitTests/ConsoleApp.UnitTests.csproj +++ b/test/ConsoleApp.UnitTests/ConsoleApp.UnitTests.csproj @@ -1,11 +1,13 @@ - + net10.0 + Exe AlmOps.ConsoleApp.UnitTests AlmOps.ConsoleApp.UnitTests enable false + true @@ -13,28 +15,11 @@ - - - - + - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - PreserveNewest - + + + diff --git a/test/ConsoleApp.UnitTests/Tasks/ConsoleTaskFactoryTest.cs b/test/ConsoleApp.UnitTests/Tasks/ConsoleTaskFactoryTest.cs index eba2d2f..5419d8d 100644 --- a/test/ConsoleApp.UnitTests/Tasks/ConsoleTaskFactoryTest.cs +++ b/test/ConsoleApp.UnitTests/Tasks/ConsoleTaskFactoryTest.cs @@ -1,8 +1,7 @@ using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.DependencyInjection; using AlmOps.ConsoleApp.Tasks; -using AutoMapper; -using FluentAssertions; +using AwesomeAssertions; using Microsoft.Extensions.DependencyInjection; using Xunit; @@ -17,8 +16,7 @@ public ConsoleTaskFactoryTest() { var services = new ServiceCollection() .AddLogging() - .AddAzureDevOpsRestApi(new AzureDevOpsRestApiConfiguration()) - .AddSingleton(new MapperConfiguration(x => { }).CreateMapper()); + .AddAzureDevOpsRestApi(new AzureDevOpsRestApiConfiguration()); _serviceProvider = services.BuildServiceProvider(); } @@ -49,7 +47,7 @@ public void ConsoleTaskFactoryCreate_ShouldCoverAllOptions(string action, string [InlineData("list", null, "Unknown resource \"\". Available resources: \"projects\", \"build\", \"builds\", \"artifacts\", \"release\", \"variables\"")] [InlineData("list", "", "Unknown resource \"\". Available resources: \"projects\", \"build\", \"builds\", \"artifacts\", \"release\", \"variables\"")] [InlineData("edit", "projects", "Unknown action \"edit\" for resource \"projects\"")] - public void ConsoleTaskFactoryCreate_ShouldSetErrorMessageOnInvalidOptions(string action, string resource, string expected) + public void ConsoleTaskFactoryCreate_ShouldSetErrorMessageOnInvalidOptions(string action, string? resource, string expected) { // Arrange var factory = new ConsoleTaskFactory(_serviceProvider); diff --git a/test/ConsoleApp.UnitTests/Tasks/TaskBaseTest.cs b/test/ConsoleApp.UnitTests/Tasks/TaskBaseTest.cs index 5dca59b..ee3535a 100644 --- a/test/ConsoleApp.UnitTests/Tasks/TaskBaseTest.cs +++ b/test/ConsoleApp.UnitTests/Tasks/TaskBaseTest.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using AlmOps.ConsoleApp.Tasks; -using FluentAssertions; +using AwesomeAssertions; using Xunit; namespace AlmOps.ConsoleApp.UnitTests.Tasks; diff --git a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/AuditEventRepositoryTest.cs b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/AuditEventRepositoryTest.cs index 1915021..5853cd9 100644 --- a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/AuditEventRepositoryTest.cs +++ b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/AuditEventRepositoryTest.cs @@ -1,7 +1,8 @@ using System.Threading.Tasks; using AlmOps.GitLabComponent.Infrastructure.RestApi.Repositories; -using FluentAssertions; +using AwesomeAssertions; using Microsoft.Extensions.DependencyInjection; +using Xunit; namespace AlmOps.GitLabComponent.Infrastructure.RestApi.IntegrationTests; diff --git a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/GitLabComponent.Infrastructure.RestApi.IntegrationTests.csproj b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/GitLabComponent.Infrastructure.RestApi.IntegrationTests.csproj index 4edb15c..18e7ad4 100644 --- a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/GitLabComponent.Infrastructure.RestApi.IntegrationTests.csproj +++ b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/GitLabComponent.Infrastructure.RestApi.IntegrationTests.csproj @@ -1,36 +1,26 @@ - + net10.0 + Exe AlmOps.GitLabComponent.Infrastructure.RestApi.IntegrationTests AlmOps.GitLabComponent.Infrastructure.RestApi.IntegrationTests enable false + true - + - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + diff --git a/test/GitLabComponent.Infrastructure.RestApi.UnitTests/GitLabComponent.Infrastructure.RestApi.UnitTests.csproj b/test/GitLabComponent.Infrastructure.RestApi.UnitTests/GitLabComponent.Infrastructure.RestApi.UnitTests.csproj new file mode 100644 index 0000000..a7b609b --- /dev/null +++ b/test/GitLabComponent.Infrastructure.RestApi.UnitTests/GitLabComponent.Infrastructure.RestApi.UnitTests.csproj @@ -0,0 +1,27 @@ + + + + net10.0 + Exe + AlmOps.GitLabComponent.Infrastructure.RestApi.UnitTests + AlmOps.GitLabComponent.Infrastructure.RestApi.UnitTests + enable + false + true + + + + + + + + + + + + + + + + + diff --git a/test/GitLabComponent.Infrastructure.RestApi.UnitTests/Repositories/AuditEventRepositoryTest.cs b/test/GitLabComponent.Infrastructure.RestApi.UnitTests/Repositories/AuditEventRepositoryTest.cs new file mode 100644 index 0000000..e929c76 --- /dev/null +++ b/test/GitLabComponent.Infrastructure.RestApi.UnitTests/Repositories/AuditEventRepositoryTest.cs @@ -0,0 +1,101 @@ +using System.Net; +using System.Net.Http; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using AlmOps.GitLabComponent.Infrastructure.RestApi.DependencyInjection; +using AlmOps.GitLabComponent.Infrastructure.RestApi.Repositories; +using AwesomeAssertions; +using Microsoft.Extensions.DependencyInjection; +using Moq; +using Moq.Protected; +using Xunit; + +namespace AlmOps.GitLabComponent.Infrastructure.RestApi.UnitTests.Repositories; + +[Trait("Category", "UnitTests")] +public class AuditEventRepositoryTest +{ + private const string AuditEventsJson = + """ + [ + { + "id": 1205, + "author_id": 42, + "entity_id": 7, + "entity_type": "Group", + "event_type": "member_updated", + "details": { "change": "access_level", "from": "Developer", "to": "Maintainer", "author_name": "Bertrand", "author_class": "User", "target_id": 3, "custom_message": "promoted" }, + "ip_address": "127.0.0.1", + "author_name": "Bertrand", + "entity_path": "devpro", + "target_details": "almops", + "target_type": "User", + "target_id": 3, + "created_at": "2026-10-20T08:00:00.000Z" + } + ] + """; + + private HttpRequestMessage? _lastRequest; + + [Fact] + public async Task FindAtGroupLevelAsync_ReadsSnakeCaseResponse() + { + var repository = CreateRepository(); + + var events = await repository.FindAtGroupLevelAsync("7"); + + _lastRequest!.RequestUri!.ToString().Should().Be("https://gitlab.com/api/v4/groups/7/audit_events"); + _lastRequest.Headers.Authorization!.Scheme.Should().Be("Bearer"); + events.Should().ContainSingle(); + var auditEvent = events[0]; + auditEvent.Id.Should().Be(1205); + auditEvent.AuthorId.Should().Be(42); + auditEvent.EntityType.Should().Be("Group"); + auditEvent.EventType.Should().Be("member_updated"); + auditEvent.EntityPath.Should().Be("devpro"); + auditEvent.TargetId.Should().Be(3); + auditEvent.Details.Change.Should().Be("access_level"); + auditEvent.Details.To.Should().Be("Maintainer"); + auditEvent.Details.AuthorClass.Should().Be("User"); + auditEvent.Details.CustomMessage.Should().Be("promoted"); + } + + [Fact] + public async Task FindAtProjectLevelAsync_CallsProjectEndpoint() + { + var repository = CreateRepository(); + + var events = await repository.FindAtProjectLevelAsync("12"); + + _lastRequest!.RequestUri!.ToString().Should().Be("https://gitlab.com/api/v4/projects/12/audit_events"); + events.Should().ContainSingle(); + } + + [Fact] + public async Task FindAtInstanceLevelAsync_CallsInstanceEndpoint() + { + var repository = CreateRepository(); + + await repository.FindAtInstanceLevelAsync(); + + _lastRequest!.RequestUri!.ToString().Should().Be("https://gitlab.com/api/v4/audit_events"); + } + + private AuditEventRepository CreateRepository() + { + var handler = new Mock(); + handler.Protected() + .Setup>("SendAsync", ItExpr.IsAny(), ItExpr.IsAny()) + .Callback((request, _) => _lastRequest = request) + .ReturnsAsync(() => new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(AuditEventsJson, Encoding.UTF8, "application/json") }); + + var services = new ServiceCollection() + .AddLogging() + .AddGitLabRestApi(new GitLabRestApiConfiguration { Token = "glpat-token" }); + services.AddHttpClient(GitLabRestApiConfiguration.HttpClientName).ConfigurePrimaryHttpMessageHandler(() => handler.Object); + + return services.BuildServiceProvider().GetRequiredService(); + } +} From 8abae67c13a8f90c2ba57f6fc7358914e0d4a2c3 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 20 Oct 2026 16:37:54 +0200 Subject: [PATCH 18/34] Call the REST APIs with System.Text.Json and code of this repository, rather than Withywoods and Newtonsoft The JSON options read camelCase fields and identifiers sent as numbers, as the APIs send them, and new repository tests cover the requests sent and the error responses. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01GUZUYtF1eZwjkNcfvtH8Qv --- AGENTS.md | 2 + AlmOps.slnx | 3 +- Directory.Packages.props | 5 - ...OpsComponent.Infrastructure.RestApi.csproj | 3 +- .../Dto/BuildDto.cs | 4 +- .../Dto/ReleaseDto.cs | 4 +- .../Dto/VariableGroupDto.cs | 8 +- .../Repositories/BuildRepository.cs | 4 +- .../Repositories/RepositoryBase.cs | 2 +- .../Repositories/VariableGroupRepository.cs | 13 +-- .../Common.Infrastructure.RestApi.csproj | 15 +++ .../ConnectivityException.cs | 19 ++++ .../HttpRepositoryBase.cs | 94 +++++++++++++++++++ .../Json/JsonDefaults.cs | 18 ++++ .../Json/LenientStringConverter.cs | 30 ++++++ src/ConsoleApp/ConsoleApp.csproj | 1 - src/ConsoleApp/Program.cs | 4 +- src/ConsoleApp/StringExtensions.cs | 10 ++ src/ConsoleApp/Tasks/ListArtifactTask.cs | 1 - src/ConsoleApp/Tasks/ListBuildTask.cs | 1 - src/ConsoleApp/Tasks/ListProjectTask.cs | 1 - src/ConsoleApp/Tasks/ShowBuildTask.cs | 1 - .../Dto/AuditEventDto.cs | 24 ++--- .../Dto/DetailsDto.cs | 20 ++-- ...LabComponent.Infrastructure.RestApi.csproj | 6 +- .../Repositories/RepositoryBase.cs | 2 +- .../VariableGroupRepositorySandboxTest.cs | 6 +- .../Mappers/AzureDevOpsDtoMapperTest.cs | 4 +- .../Repositories/BuildRepositoryTest.cs | 89 ++++++++++++++++++ .../Repositories/RepositoryTestBase.cs | 16 +++- .../VariableGroupRepositoryTest.cs | 71 ++++++++++++++ 31 files changed, 411 insertions(+), 70 deletions(-) create mode 100644 src/Common.Infrastructure.RestApi/Common.Infrastructure.RestApi.csproj create mode 100644 src/Common.Infrastructure.RestApi/ConnectivityException.cs create mode 100644 src/Common.Infrastructure.RestApi/HttpRepositoryBase.cs create mode 100644 src/Common.Infrastructure.RestApi/Json/JsonDefaults.cs create mode 100644 src/Common.Infrastructure.RestApi/Json/LenientStringConverter.cs create mode 100644 src/ConsoleApp/StringExtensions.cs create mode 100644 test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/BuildRepositoryTest.cs create mode 100644 test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/VariableGroupRepositoryTest.cs diff --git a/AGENTS.md b/AGENTS.md index 5491171..d33cfc0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -12,6 +12,7 @@ Project | Role `src/ConsoleApp` | Command line parsing, configuration and one task per action `src/AzureDevOpsComponent.Domain` | Models and repository interfaces `src/*Component.Infrastructure.RestApi` | REST API clients, DTOs and the Mapperly mapper from DTO to model +`src/Common.Infrastructure.RestApi` | HTTP repository base and JSON options shared by the REST API clients `samples/SamlTokenClaimEnricher` | Independent Azure Function sample ## Working rules @@ -58,6 +59,7 @@ Applies to Markdown, code comments, commit messages and prose in scripts. - NuGet versions are managed centrally in `Directory.Packages.props`: `PackageReference` entries in csproj files have no `Version` attribute. - Release version is `VersionPrefix` in `Directory.Build.props`. - No package with a license issue: Mapperly maps, never AutoMapper; AwesomeAssertions asserts, never FluentAssertions. +- JSON is System.Text.Json, never Newtonsoft, through `HttpRepositoryBase` and `JsonDefaults` of `src/Common.Infrastructure.RestApi`. - Tests use xunit v3 on the Microsoft Testing Platform (`global.json`), so runner options go after `--` with `dotnet test --project`. - A test reaching a live Azure DevOps or GitLab sandbox carries `[Trait("Environment", "Sandbox")]` and reads its credentials from `AlmOps__Sandbox__*` environment variables. - C# style is enforced by `.editorconfig`. diff --git a/AlmOps.slnx b/AlmOps.slnx index 52a8d17..70971c8 100644 --- a/AlmOps.slnx +++ b/AlmOps.slnx @@ -15,7 +15,8 @@ - + + diff --git a/Directory.Packages.props b/Directory.Packages.props index e32f206..be77604 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -26,11 +26,6 @@ - - - - diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj index 6163acb..7810176 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj @@ -9,14 +9,13 @@ + - - diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs index 8a40785..fd8497a 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; @@ -18,7 +18,7 @@ public class BuildDto public BuildDefinitionDto? Definition { get; set; } public ProjectDto? Project { get; set; } public RepositoryDto? Repository { get; set; } - [JsonProperty("_links")] + [JsonPropertyName("_links")] public LinksDto? Links { get; set; } public object? Properties { get; set; } public List? ValidationResults { get; set; } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDto.cs index 40ed279..3b8776a 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDto.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { @@ -25,7 +25,7 @@ public class ReleaseDto public int DefinitionSnapshotRevision { get; set; } public string? LogsContainerUrl { get; set; } public string? Url { get; set; } - [JsonProperty("_links")] + [JsonPropertyName("_links")] public LinksDto? Links { get; set; } public List? Tags { get; set; } public ProjectDto? ProjectReference { get; set; } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/VariableGroupDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/VariableGroupDto.cs index 8742c3c..0bd1ad4 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/VariableGroupDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/VariableGroupDto.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; +using System.Text.Json.Nodes; +using System.Text.Json.Serialization; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { @@ -13,7 +13,7 @@ public class VariableGroupDto public string? Name { get; set; } - public JObject? Variables { get; set; } + public JsonObject? Variables { get; set; } public string? Description { get; set; } @@ -27,7 +27,7 @@ public class VariableGroupDto public bool IsShared { get; set; } - [JsonProperty("variableGroupProjectReferences")] + [JsonPropertyName("variableGroupProjectReferences")] public List? ProjectReferences { get; set; } // providerData VariableGroupProviderData diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildRepository.cs index c2cd79b..2e89fbe 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildRepository.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Net.Http; +using System.Text.Json; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; using Microsoft.Extensions.Logging; -using Withywoods.Serialization.Json; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Repositories; @@ -63,7 +63,7 @@ public async Task CreateAsync(string projectName, string buildDefini { Definition = new { Id = buildDefinitionId }, SourceBranch = sourceBranchName, - Parameters = variables.ToJson() + Parameters = JsonSerializer.Serialize(variables) }); return Mapper.ToModel(result); } diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs index 0c83f94..6167800 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs @@ -1,7 +1,7 @@ using System.Net.Http; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; +using AlmOps.Common.Infrastructure.RestApi; using Microsoft.Extensions.Logging; -using Withywoods.Net.Http; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Repositories; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/VariableGroupRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/VariableGroupRepository.cs index 1a7596b..3baefa7 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/VariableGroupRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/VariableGroupRepository.cs @@ -1,13 +1,12 @@ using System.Collections.Generic; using System.Net.Http; +using System.Text.Json.Nodes; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; using Microsoft.Extensions.Logging; -using Newtonsoft.Json.Linq; -using Withywoods.Serialization.Json; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Repositories; @@ -55,25 +54,21 @@ public async Task FindOneByIdAsync(string projectName, strin public async Task UpdateAsync(string projectName, string id, Dictionary input, bool isReplaceAll = false) { var existing = await FindOneVariableGroupDto(projectName, id); - if (existing == null) - { - throw new System.ArgumentNullException(nameof(id)); - } if (isReplaceAll || existing.Variables == null) { - existing.Variables = new JObject(); + existing.Variables = new JsonObject(); } foreach (var variable in input) { - if (existing.Variables[variable.Key] is { } current) + if (existing.Variables[variable.Key] is JsonObject current) { current["value"] = variable.Value; continue; } - existing.Variables.Add(variable.Key, $"{{\"value\":\"{variable.Value}\"}}".FromJson()); + existing.Variables[variable.Key] = new JsonObject { ["value"] = variable.Value }; } var url = GenerateUrl(prefix: $"/{projectName}", suffix: $"/{id}"); diff --git a/src/Common.Infrastructure.RestApi/Common.Infrastructure.RestApi.csproj b/src/Common.Infrastructure.RestApi/Common.Infrastructure.RestApi.csproj new file mode 100644 index 0000000..0f7cd37 --- /dev/null +++ b/src/Common.Infrastructure.RestApi/Common.Infrastructure.RestApi.csproj @@ -0,0 +1,15 @@ + + + + net10.0 + AlmOps.Common.Infrastructure.RestApi + AlmOps.Common.Infrastructure.RestApi + enable + + + + + + + + diff --git a/src/Common.Infrastructure.RestApi/ConnectivityException.cs b/src/Common.Infrastructure.RestApi/ConnectivityException.cs new file mode 100644 index 0000000..18d920e --- /dev/null +++ b/src/Common.Infrastructure.RestApi/ConnectivityException.cs @@ -0,0 +1,19 @@ +using System; + +namespace AlmOps.Common.Infrastructure.RestApi; + +/// +/// Raised when a REST API call fails or returns content that cannot be read. +/// +public class ConnectivityException : Exception +{ + public ConnectivityException(string message) + : base(message) + { + } + + public ConnectivityException(string message, Exception innerException) + : base(message, innerException) + { + } +} diff --git a/src/Common.Infrastructure.RestApi/HttpRepositoryBase.cs b/src/Common.Infrastructure.RestApi/HttpRepositoryBase.cs new file mode 100644 index 0000000..9cbabc2 --- /dev/null +++ b/src/Common.Infrastructure.RestApi/HttpRepositoryBase.cs @@ -0,0 +1,94 @@ +using System; +using System.Net.Http; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; +using AlmOps.Common.Infrastructure.RestApi.Json; +using Microsoft.Extensions.Logging; + +namespace AlmOps.Common.Infrastructure.RestApi; + +/// +/// Base of the repositories calling a REST API with JSON content, through a named HTTP client. +/// +public abstract class HttpRepositoryBase(ILogger logger, IHttpClientFactory httpClientFactory) +{ + protected ILogger Logger { get; } = logger; + + protected abstract string HttpClientName { get; } + + /// + /// Gets the resource at the URL, which must answer with a success and a body. + /// + /// + protected async Task GetAsync(string url) + { + var response = await CreateHttpClient().GetAsync(url); + return await ReadResultAsync(url, "GET", response); + } + + /// + /// Posts the body to the URL, which must answer with a success and a body. + /// + /// + protected async Task PostAsync(string url, object body) + { + var response = await CreateHttpClient().PostAsync(url, CreateContent(body)); + return await ReadResultAsync(url, "POST", response); + } + + /// + /// Puts the body to the URL, which must answer with a success. + /// + /// + protected async Task PutAsync(string url, object body) + { + var response = await CreateHttpClient().PutAsync(url, CreateContent(body)); + CheckStatusCode(url, response, await response.Content.ReadAsStringAsync()); + } + + private HttpClient CreateHttpClient() + { + return httpClientFactory.CreateClient(HttpClientName); + } + + private static StringContent CreateContent(object body) + { + return new StringContent(JsonSerializer.Serialize(body, JsonDefaults.Options), Encoding.UTF8, "application/json"); + } + + private async Task ReadResultAsync(string url, string httpMethodName, HttpResponseMessage response) + { + var result = await response.Content.ReadAsStringAsync(); + CheckStatusCode(url, response, result); + if (string.IsNullOrEmpty(result)) + { + throw new ConnectivityException($"Empty response received while calling {url}"); + } + + try + { + return JsonSerializer.Deserialize(result, JsonDefaults.Options) + ?? throw new ConnectivityException($"Null response received while calling {url}"); + } + catch (JsonException exc) + { + Logger.LogWarning("Cannot deserialize {HttpMethodName} call response content [HttpRequestUrl={Url}] [SerializationType={Type}] [ExceptionMessage={ExceptionMessage}]", + httpMethodName, url, typeof(T), exc.Message); + Logger.LogDebug("[HttpResponseContent={Result}]", result); + throw new ConnectivityException($"Invalid data received when calling \"{url}\": {exc.Message}", exc); + } + } + + private void CheckStatusCode(string url, HttpResponseMessage response, string result) + { + if (response.IsSuccessStatusCode) + { + return; + } + + Logger.LogDebug("Status code doesn't indicate success [HttpRequestUrl={Url}] [HttpResponseStatusCode={ResponseStatusCode}] [HttpResponseContent={Result}]", + url, response.StatusCode, result); + throw new ConnectivityException($"The response status \"{response.StatusCode}\" is not a success (reason=\"{response.ReasonPhrase}\")"); + } +} diff --git a/src/Common.Infrastructure.RestApi/Json/JsonDefaults.cs b/src/Common.Infrastructure.RestApi/Json/JsonDefaults.cs new file mode 100644 index 0000000..8513275 --- /dev/null +++ b/src/Common.Infrastructure.RestApi/Json/JsonDefaults.cs @@ -0,0 +1,18 @@ +using System.Text.Json; + +namespace AlmOps.Common.Infrastructure.RestApi.Json; + +/// +/// JSON options of the REST API calls. +/// +public static class JsonDefaults +{ + /// + /// Web defaults, since the APIs name their fields in camelCase and the serializer is otherwise case sensitive, + /// and text read from a number, since the APIs send as a number some identifiers the DTOs keep as text. + /// + public static JsonSerializerOptions Options { get; } = new(JsonSerializerDefaults.Web) + { + Converters = { new LenientStringConverter() } + }; +} diff --git a/src/Common.Infrastructure.RestApi/Json/LenientStringConverter.cs b/src/Common.Infrastructure.RestApi/Json/LenientStringConverter.cs new file mode 100644 index 0000000..be2fc06 --- /dev/null +++ b/src/Common.Infrastructure.RestApi/Json/LenientStringConverter.cs @@ -0,0 +1,30 @@ +using System; +using System.Buffers; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace AlmOps.Common.Infrastructure.RestApi.Json; + +/// +/// Reads a string property from a JSON string, number or boolean, keeping the text as sent. +/// +public class LenientStringConverter : JsonConverter +{ + public override string? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return reader.TokenType switch + { + JsonTokenType.String => reader.GetString(), + JsonTokenType.Number => Encoding.UTF8.GetString(reader.HasValueSequence ? reader.ValueSequence.ToArray() : reader.ValueSpan), + JsonTokenType.True => "true", + JsonTokenType.False => "false", + _ => throw new JsonException($"Cannot read {reader.TokenType} as a string") + }; + } + + public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options) + { + writer.WriteStringValue(value); + } +} diff --git a/src/ConsoleApp/ConsoleApp.csproj b/src/ConsoleApp/ConsoleApp.csproj index 5bdfc02..875629c 100644 --- a/src/ConsoleApp/ConsoleApp.csproj +++ b/src/ConsoleApp/ConsoleApp.csproj @@ -36,7 +36,6 @@ - diff --git a/src/ConsoleApp/Program.cs b/src/ConsoleApp/Program.cs index e416c90..54aa3e7 100644 --- a/src/ConsoleApp/Program.cs +++ b/src/ConsoleApp/Program.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Text; +using System.Text.Json; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.DependencyInjection; using AlmOps.ConsoleApp.Tasks; @@ -11,7 +12,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Withywoods.Serialization.Json; [assembly: InternalsVisibleTo("AlmOps.ConsoleApp.IntegrationTests")] @@ -108,7 +108,7 @@ private static void SaveSettings(CommandLineOptions opts) opts.Token } }; - File.WriteAllText(Path.Combine(AppContext.BaseDirectory, AppSettingsFilename), jsonConfig.ToJson(), Encoding.UTF8); + File.WriteAllText(Path.Combine(AppContext.BaseDirectory, AppSettingsFilename), JsonSerializer.Serialize(jsonConfig), Encoding.UTF8); } private static IConfigurationRoot LoadConfiguration() diff --git a/src/ConsoleApp/StringExtensions.cs b/src/ConsoleApp/StringExtensions.cs new file mode 100644 index 0000000..f42c5d4 --- /dev/null +++ b/src/ConsoleApp/StringExtensions.cs @@ -0,0 +1,10 @@ +namespace AlmOps.ConsoleApp; + +internal static class StringExtensions +{ + /// + /// Turns a query such as "url" into the "Url" property name of a model. + /// + public static string FirstCharToUpper(this string input) => + input.Length == 0 ? input : $"{char.ToUpperInvariant(input[0])}{input[1..]}"; +} diff --git a/src/ConsoleApp/Tasks/ListArtifactTask.cs b/src/ConsoleApp/Tasks/ListArtifactTask.cs index 3f558bc..ba25332 100644 --- a/src/ConsoleApp/Tasks/ListArtifactTask.cs +++ b/src/ConsoleApp/Tasks/ListArtifactTask.cs @@ -3,7 +3,6 @@ using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using Microsoft.Extensions.Logging; -using Withywoods.System; namespace AlmOps.ConsoleApp.Tasks; diff --git a/src/ConsoleApp/Tasks/ListBuildTask.cs b/src/ConsoleApp/Tasks/ListBuildTask.cs index 0b026de..ec35c1d 100644 --- a/src/ConsoleApp/Tasks/ListBuildTask.cs +++ b/src/ConsoleApp/Tasks/ListBuildTask.cs @@ -3,7 +3,6 @@ using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using Microsoft.Extensions.Logging; -using Withywoods.System; namespace AlmOps.ConsoleApp.Tasks; diff --git a/src/ConsoleApp/Tasks/ListProjectTask.cs b/src/ConsoleApp/Tasks/ListProjectTask.cs index 60ddce0..f1340ad 100644 --- a/src/ConsoleApp/Tasks/ListProjectTask.cs +++ b/src/ConsoleApp/Tasks/ListProjectTask.cs @@ -3,7 +3,6 @@ using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using Microsoft.Extensions.Logging; -using Withywoods.System; namespace AlmOps.ConsoleApp.Tasks; diff --git a/src/ConsoleApp/Tasks/ShowBuildTask.cs b/src/ConsoleApp/Tasks/ShowBuildTask.cs index 4dcd414..2122ca0 100644 --- a/src/ConsoleApp/Tasks/ShowBuildTask.cs +++ b/src/ConsoleApp/Tasks/ShowBuildTask.cs @@ -2,7 +2,6 @@ using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using Microsoft.Extensions.Logging; -using Withywoods.System; namespace AlmOps.ConsoleApp.Tasks; diff --git a/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs b/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs index 83afcaf..93e7b4c 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs @@ -1,5 +1,5 @@ using System; -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AlmOps.GitLabComponent.Infrastructure.RestApi.Dto; @@ -7,38 +7,38 @@ public class AuditEventDto { public long Id { get; set; } - [JsonProperty("author_id")] + [JsonPropertyName("author_id")] public long AuthorId { get; set; } - [JsonProperty("entity_id")] + [JsonPropertyName("entity_id")] public long EntityId { get; set; } - [JsonProperty("entity_type")] + [JsonPropertyName("entity_type")] public required string EntityType { get; set; } public required DetailsDto Details { get; set; } - [JsonProperty("created_at")] + [JsonPropertyName("created_at")] public DateTime CreatedAt { get; set; } - [JsonProperty("ip_address")] + [JsonPropertyName("ip_address")] public string? IpAddress { get; set; } - [JsonProperty("author_name")] + [JsonPropertyName("author_name")] public string? AuthorName { get; set; } - [JsonProperty("entity_path")] + [JsonPropertyName("entity_path")] public string? EntityPath { get; set; } - [JsonProperty("target_details")] + [JsonPropertyName("target_details")] public string? TargetDetails { get; set; } - [JsonProperty("target_type")] + [JsonPropertyName("target_type")] public string? TargetType { get; set; } - [JsonProperty("target_id")] + [JsonPropertyName("target_id")] public long TargetId { get; set; } - [JsonProperty("event_type")] + [JsonPropertyName("event_type")] public string? EventType { get; set; } } diff --git a/src/GitLabComponent.Infrastructure.RestApi/Dto/DetailsDto.cs b/src/GitLabComponent.Infrastructure.RestApi/Dto/DetailsDto.cs index 25eaf55..1108526 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/Dto/DetailsDto.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/Dto/DetailsDto.cs @@ -1,31 +1,31 @@ -using Newtonsoft.Json; +using System.Text.Json.Serialization; namespace AlmOps.GitLabComponent.Infrastructure.RestApi.Dto; public class DetailsDto { - [JsonProperty("custom_message")] + [JsonPropertyName("custom_message")] public string? CustomMessage { get; set; } - [JsonProperty("author_name")] + [JsonPropertyName("author_name")] public string? AuthorName { get; set; } - [JsonProperty("author_email")] + [JsonPropertyName("author_email")] public string? AuthorEmail { get; set; } - [JsonProperty("target_id")] + [JsonPropertyName("target_id")] public object? TargetId { get; set; } - [JsonProperty("target_type")] + [JsonPropertyName("target_type")] public string? TargetType { get; set; } - [JsonProperty("target_details")] + [JsonPropertyName("target_details")] public string? TargetDetails { get; set; } - [JsonProperty("ip_address")] + [JsonPropertyName("ip_address")] public string? IpAddress { get; set; } - [JsonProperty("entity_path")] + [JsonPropertyName("entity_path")] public string? EntityPath { get; set; } public string? Add { get; set; } @@ -36,6 +36,6 @@ public class DetailsDto public string? To { get; set; } - [JsonProperty("author_class")] + [JsonPropertyName("author_class")] public string? AuthorClass { get; set; } } diff --git a/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj b/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj index cbe8a48..706f01f 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj +++ b/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj @@ -7,11 +7,13 @@ enable + + + + - - diff --git a/src/GitLabComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs b/src/GitLabComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs index 63e366b..6ac6f0e 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs @@ -1,6 +1,6 @@ using System.Net.Http; +using AlmOps.Common.Infrastructure.RestApi; using Microsoft.Extensions.Logging; -using Withywoods.Net.Http; namespace AlmOps.GitLabComponent.Infrastructure.RestApi.Repositories; diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/Sandbox/VariableGroupRepositorySandboxTest.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/Sandbox/VariableGroupRepositorySandboxTest.cs index e976c24..5dd4d96 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/Sandbox/VariableGroupRepositorySandboxTest.cs +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/Sandbox/VariableGroupRepositorySandboxTest.cs @@ -1,11 +1,11 @@ using System; using System.Linq; +using System.Text.Json.Nodes; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using AwesomeAssertions; using Bogus; using Microsoft.Extensions.DependencyInjection; -using Newtonsoft.Json.Linq; using Xunit; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests.Sandbox; @@ -43,12 +43,12 @@ public async Task VariableGroupRepositoryUpdateAsync_OnSandbox_IsSuccessful() await repository.UpdateAsync(ProjectName, variableGroupId, inputCreate, true); var outputAfterFirstUpdate = await repository.FindOneByIdAsync(ProjectName, variableGroupId); outputAfterFirstUpdate.Should().NotBeNull(); - ((JObject)outputAfterFirstUpdate.Variables!).Children().Count().Should().Be(6); + ((JsonObject)outputAfterFirstUpdate.Variables!).Count.Should().Be(6); await repository.UpdateAsync(ProjectName, variableGroupId, inputUpdate); var outputAfterSecondUpdate = await repository.FindOneByIdAsync(ProjectName, variableGroupId); outputAfterSecondUpdate.Should().NotBeNull(); - ((JObject)outputAfterSecondUpdate.Variables!).Children().Count().Should().Be(9); + ((JsonObject)outputAfterSecondUpdate.Variables!).Count.Should().Be(9); } private IVariableGroupRepository BuildRepository() diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Mappers/AzureDevOpsDtoMapperTest.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Mappers/AzureDevOpsDtoMapperTest.cs index fefd4a4..6eaf71b 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Mappers/AzureDevOpsDtoMapperTest.cs +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Mappers/AzureDevOpsDtoMapperTest.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; +using System.Text.Json.Nodes; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; using AwesomeAssertions; -using Newtonsoft.Json.Linq; using Xunit; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.Mappers; @@ -143,7 +143,7 @@ public void ToModel_ReleaseDefinition_FlattensArtifactDefinitionReference() [Fact] public void ToModel_VariableGroup_KeepsVariables() { - var variables = JObject.Parse("{\"key1\":{\"value\":\"value1\"}}"); + var variables = JsonNode.Parse("{\"key1\":{\"value\":\"value1\"}}")!.AsObject(); var dto = new VariableGroupDto { Id = 8, Name = "almops-vars", Type = "Vsts", Variables = variables }; var model = _mapper.ToModel(dto); diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/BuildRepositoryTest.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/BuildRepositoryTest.cs new file mode 100644 index 0000000..f70472f --- /dev/null +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/BuildRepositoryTest.cs @@ -0,0 +1,89 @@ +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Text.Json.Nodes; +using System.Threading.Tasks; +using AlmOps.AzureDevOpsComponent.Domain.Repositories; +using AlmOps.Common.Infrastructure.RestApi; +using AwesomeAssertions; +using Xunit; + +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.Repositories; + +[Trait("Category", "UnitTests")] +public class BuildRepositoryTest : RepositoryTestBase +{ + private const string BuildJson = + """ + { + "id": 264, + "buildNumber": "20261020.1", + "status": "notStarted", + "definition": { "id": 3, "name": "almops-ci" }, + "project": { "id": "eb6e4656", "name": "almops" }, + "sourceBranch": "refs/heads/main", + "_links": { "web": { "href": "https://dev.azure.com/devpro/almops/_build/results?buildId=264" } } + } + """; + + [Fact] + public async Task FindOneByIdAsync_ReadsNumericIdAsText() + { + var repository = CreateRepository(BuildJson); + + var build = await repository.FindOneByIdAsync("almops", "264"); + + LastRequest!.RequestUri!.ToString().Should().Be("https://dev.azure.com/devpro/almops/_apis/build/builds/264?api-version=7.1"); + build.Id.Should().Be("264"); + build.BuildNumber.Should().Be("20261020.1"); + build.Definition!.Id.Should().Be("3"); + build.Project!.Name.Should().Be("almops"); + } + + [Fact] + public async Task FindAllAsync_FiltersOnBranchAndDefinition() + { + var repository = CreateRepository($$"""{ "count": 1, "value": [ {{BuildJson}} ] }"""); + + var builds = await repository.FindAllAsync("almops", "main", "3"); + + LastRequest!.RequestUri!.Query.Should().Be("?api-version=7.1&queryOrder=startTimeDescending&$top=10&branchName=refs/heads/main&definitions=3"); + builds.Should().ContainSingle().Which.Id.Should().Be("264"); + } + + [Fact] + public async Task CreateAsync_PostsDefinitionBranchAndParameters() + { + var repository = CreateRepository(BuildJson); + + var build = await repository.CreateAsync("almops", "3", "main", new Dictionary { ["env"] = "dev" }); + + LastRequest!.Method.Should().Be(HttpMethod.Post); + LastRequest.RequestUri!.ToString().Should().Be("https://dev.azure.com/devpro/almops/_apis/build/builds?api-version=7.1"); + var body = JsonNode.Parse(LastRequestBody!)!; + body["definition"]!["id"]!.GetValue().Should().Be("3"); + body["sourceBranch"]!.GetValue().Should().Be("main"); + body["parameters"]!.GetValue().Should().Be("{\"env\":\"dev\"}"); + build.Id.Should().Be("264"); + } + + [Fact] + public async Task FindOneByIdAsync_OnErrorStatus_Throws() + { + var repository = CreateRepository("""{ "message": "TF401019" }""", HttpStatusCode.NotFound); + + var act = () => repository.FindOneByIdAsync("almops", "404"); + + (await act.Should().ThrowAsync()).Which.Message.Should().Be("The response status \"NotFound\" is not a success (reason=\"Not Found\")"); + } + + [Fact] + public async Task FindOneByIdAsync_OnEmptyResponse_Throws() + { + var repository = CreateRepository(""); + + var act = () => repository.FindOneByIdAsync("almops", "264"); + + (await act.Should().ThrowAsync()).Which.Message.Should().StartWith("Empty response received while calling https://dev.azure.com/devpro/almops/_apis/build/builds/264"); + } +} diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/RepositoryTestBase.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/RepositoryTestBase.cs index b735cbd..c035dfc 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/RepositoryTestBase.cs +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/RepositoryTestBase.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Text; @@ -12,7 +13,7 @@ namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.Repositor /// /// Resolves repositories from the registration the application uses, with an HTTP handler answering the JSON the API sends, -/// so that a test covers the deserialization and the mapping together. +/// so that a test covers the serialization, the deserialization and the mapping together. /// public abstract class RepositoryTestBase { @@ -23,15 +24,20 @@ public abstract class RepositoryTestBase Token = "token" }; - protected HttpRequestMessage? LastRequest { get; private set; } + protected List<(HttpRequestMessage Request, string? Body)> Requests { get; } = []; - protected T CreateRepository(string responseJson) where T : notnull + protected HttpRequestMessage? LastRequest => Requests.Count == 0 ? null : Requests[^1].Request; + + protected string? LastRequestBody => Requests.Count == 0 ? null : Requests[^1].Body; + + protected T CreateRepository(string responseJson, HttpStatusCode statusCode = HttpStatusCode.OK) where T : notnull { var handler = new Mock(); handler.Protected() .Setup>("SendAsync", ItExpr.IsAny(), ItExpr.IsAny()) - .Callback((request, _) => LastRequest = request) - .ReturnsAsync(() => new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(responseJson, Encoding.UTF8, "application/json") }); + // The body is read when the request is sent, as the client may dispose of its content afterwards. + .Callback((request, _) => Requests.Add((request, request.Content?.ReadAsStringAsync().GetAwaiter().GetResult()))) + .ReturnsAsync(() => new HttpResponseMessage(statusCode) { Content = new StringContent(responseJson, Encoding.UTF8, "application/json") }); var services = new ServiceCollection() .AddLogging() diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/VariableGroupRepositoryTest.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/VariableGroupRepositoryTest.cs new file mode 100644 index 0000000..696fa3a --- /dev/null +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/Repositories/VariableGroupRepositoryTest.cs @@ -0,0 +1,71 @@ +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Text.Json.Nodes; +using System.Threading.Tasks; +using AlmOps.AzureDevOpsComponent.Domain.Repositories; +using AwesomeAssertions; +using Xunit; + +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.UnitTests.Repositories; + +[Trait("Category", "UnitTests")] +public class VariableGroupRepositoryTest : RepositoryTestBase +{ + private const string VariableGroupJson = + """ + { + "id": 8, + "type": "Vsts", + "name": "almops-vars", + "description": "Settings", + "variables": { + "existing": { "value": "old" }, + "secret": { "value": null, "isSecret": true } + } + } + """; + + [Fact] + public async Task FindOneByIdAsync_ReadsVariables() + { + var repository = CreateRepository(VariableGroupJson); + + var variableGroup = await repository.FindOneByIdAsync("almops", "8"); + + LastRequest!.RequestUri!.ToString().Should().Be("https://dev.azure.com/devpro/almops/_apis/distributedtask/variablegroups/8?api-version=7.1"); + variableGroup.Id.Should().Be(8); + variableGroup.Name.Should().Be("almops-vars"); + ((JsonObject)variableGroup.Variables!).Select(x => x.Key).Should().Equal("existing", "secret"); + } + + [Fact] + public async Task UpdateAsync_MergesVariablesIntoExistingGroup() + { + var repository = CreateRepository(VariableGroupJson); + + await repository.UpdateAsync("almops", "8", new Dictionary { ["existing"] = "new", ["added"] = "value" }); + + Requests.Select(x => x.Request.Method).Should().Equal(HttpMethod.Get, HttpMethod.Put); + LastRequest!.RequestUri!.AbsolutePath.Should().Be("/devpro/almops/_apis/distributedtask/variablegroups/8"); + var body = JsonNode.Parse(LastRequestBody!)!; + body["name"]!.GetValue().Should().Be("almops-vars"); + var variables = body["variables"]!.AsObject(); + variables.Select(x => x.Key).Should().Equal("existing", "secret", "added"); + variables["existing"]!["value"]!.GetValue().Should().Be("new"); + variables["secret"]!["isSecret"]!.GetValue().Should().BeTrue(); + variables["added"]!["value"]!.GetValue().Should().Be("value"); + } + + [Fact] + public async Task UpdateAsync_ReplaceAll_KeepsOnlyInput() + { + var repository = CreateRepository(VariableGroupJson); + + await repository.UpdateAsync("almops", "8", new Dictionary { ["only"] = "one" }, isReplaceAll: true); + + var variables = JsonNode.Parse(LastRequestBody!)!["variables"]!.AsObject(); + variables.Select(x => x.Key).Should().Equal("only"); + variables["only"]!["value"]!.GetValue().Should().Be("one"); + } +} From 88dea689b8727269cdde92c109fa23ab23a11896 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 20 Oct 2026 17:24:55 +0200 Subject: [PATCH 19/34] List what remains to check and decide after the move to GitHub, Mapperly and System.Text.Json Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01GUZUYtF1eZwjkNcfvtH8Qv --- AGENTS.md | 1 + docs/backlog.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 docs/backlog.md diff --git a/AGENTS.md b/AGENTS.md index d33cfc0..d186e05 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -64,6 +64,7 @@ Applies to Markdown, code comments, commit messages and prose in scripts. - A test reaching a live Azure DevOps or GitLab sandbox carries `[Trait("Environment", "Sandbox")]` and reads its credentials from `AlmOps__Sandbox__*` environment variables. - C# style is enforced by `.editorconfig`. - Shell scripts are named in `snake_case` and committed with the executable bit set (`git update-index --chmod=+x`). +- Known debt not yet scheduled is listed in `docs/backlog.md`. - Target platform is Linux, including WSL2, and `bash`. ## Commands diff --git a/docs/backlog.md b/docs/backlog.md new file mode 100644 index 0000000..1c5fe5a --- /dev/null +++ b/docs/backlog.md @@ -0,0 +1,48 @@ +# Backlog + +Known debt and gaps, not yet scheduled. + +## Verification against live APIs + +The sandbox tests need credentials, so the move to System.Text.Json is proven against recorded JSON only. + +- [ ] Run the sandbox tests (`AlmOps__Sandbox__*` variables) against Azure DevOps and GitLab, which no local run does. +- [ ] Check that Azure DevOps accepts the camelCase request bodies of `QueueBuildTask`, `CreateReleaseTask` and `UpdateVariableTask`, where Newtonsoft sent PascalCase. +- [ ] Check that a variable group update keeps the secret variables and the provider data, now that the group goes through `JsonObject` and the DTO. +- [ ] Check that every GitLab audit event carries `entity_type` and `details`, which `AuditEventDto` marks `required`, and which System.Text.Json enforces. +- [ ] Look for other fields the APIs send as a type the DTOs do not declare, as with the numeric build `id` read into a `string`: + `LenientStringConverter` covers a number or a boolean read as text, nothing else. + +## GitHub setup + +- [ ] Set the repository variables `SONAR_ORG`, `SONAR_PROJECT_KEY`, `CONTAINER_REGISTRY_PATH` and `CONTAINER_IMAGE_NAME`. + The SonarCloud project key was `devpro.almops`, which the README badge still reads. +- [ ] Set the secrets `SONAR_TOKEN`, `FOSSA_API_KEY`, `NUGET_API_KEY`, `DOCKERHUB_USERNAME`, `DOCKERHUB_TOKEN`, and the sandbox ones, + `AZUREDEVOPS_TEST_ORG`, `AZUREDEVOPS_TEST_USERNAME`, `AZUREDEVOPS_TEST_TOKEN`, `AZUREDEVOPS_TEST_PROJECT`, `AZUREDEVOPS_TEST_VARIABLEGROUPID`, + `GITLAB_TEST_TOKEN`, `GITLAB_TEST_GROUPID` and `GITLAB_TEST_PROJECTID`. +- [ ] Decide what a pull request from a fork does with the sandbox tests, which fail without the secrets. +- [ ] Archive the GitLab project (`devpro-labs/software/almops`) and the Azure DevOps pipeline definitions, whose pipeline files are gone. + +## Packaging + +- [ ] Decide whether the libraries are published to NuGet at all, since the `almops` tool package carries its own dependencies. + `dotnet pack` publishes every packable project, so `AlmOps.Common.Infrastructure.RestApi` and `AlmOps.GitLabComponent.Infrastructure.RestApi` would appear on NuGet with the next version. +- [ ] Build the image on `bci/dotnet-runtime` rather than `bci/dotnet-aspnet`, a console application needing no ASP.NET Core, which would shrink the image and its scan findings. +- [ ] Bump `VersionPrefix` in `Directory.Build.props`, which gates the NuGet publication, when this branch is released. + +## Code quality + +- [ ] Fix the 21 remaining nullable warnings, in the console tasks (`CreateReleaseTask`, `QueueBuildTask`, `UpdateVariableTask`, `TaskBase`), + `IBuildRepository` optional parameters, `AzureDevOpsRestApiConfiguration` and the tests, then consider `TreatWarningsAsErrors`. +- [ ] Remove the DTOs and DTO members no mapping or request uses, kept from the AutoMapper profile, or decide they document the API. +- [ ] Wire the GitLab component into the console application, or document it as a library only: no command uses it. + +## Tests + +- [ ] Check that the `Local.runsettings` of `CONTRIBUTING.md` still reaches the sandbox tests from Rider on the Microsoft Testing Platform, + where `dotnet test --settings` runs none. +- [ ] Cover the console tasks with unit tests against mocked repositories, beyond the factory and `TaskBase`. + +## Upstream + +- [ ] Report to Withywoods that `HttpRepositoryBase` 2.x deserializes case sensitively, which leaves the camelCase fields of most REST APIs empty. From 44280df1bbf37a1f183b91f912420204de1443a6 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Wed, 21 Oct 2026 16:58:31 +0200 Subject: [PATCH 20/34] Restore deleted Azure DevOps and GitLab pipelines --- .azure/pipelines/ci.yml | 107 +++++++++++++++++++++++ .azure/pipelines/pkg.yml | 59 +++++++++++++ .gitlab-ci.yml | 180 +++++++++++++++++++++++++++++++++++++++ AlmOps.slnx | 19 +++-- README.md | 8 +- 5 files changed, 364 insertions(+), 9 deletions(-) create mode 100644 .azure/pipelines/ci.yml create mode 100644 .azure/pipelines/pkg.yml create mode 100644 .gitlab-ci.yml diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml new file mode 100644 index 0000000..cdd78aa --- /dev/null +++ b/.azure/pipelines/ci.yml @@ -0,0 +1,107 @@ +# Azure pipeline definition for the integration of the solution (continuous integration) + +trigger: none +# batch: true +# branches: +# include: +# - main +# paths: +# exclude: +# - README.md + +pr: none +# autoCancel: true +# branches: +# include: +# - main +# paths: +# exclude: +# - README.md + +#schedules: +#- cron: "0 0 * * *" +# displayName: 'Daily midnight build' +# branches: +# include: +# - main +# always: true + +variables: +# library variable groups +- group: 'build-tools' +- group: 'integration-testing-sandbox' +# common task variables +- name: 'BuildConfiguration' + value: 'Debug' +- name: 'SolutionFile' + value: 'AlmOps.sln' +- name: 'TestProjects' + value: 'test/*Tests/*.csproj' +# tool variables (Sonar) +- name: 'sonar.project.name' + value: 'AlmOps' +- name: 'sonar.project.key' + value: 'devpro.almops' + +pool: + # code coverage generation only works on Windows for the moment + vmImage: 'windows-latest' + +steps: +- task: UseDotNet@2 + displayName: 'Use .NET Core SDK' + inputs: + packageType: 'sdk' + version: '8.0.x' +- task: DotNetCoreCLI@2 + displayName: 'Restore .NET packages' + inputs: + command: 'restore' + projects: '$(SolutionFile)' + feedsToUse: 'select' + noCache: 'true' + env: + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + COREHOST_TRACE: 0 +- task: SonarCloudPrepare@1 + displayName: 'Prepare code analysis' + inputs: + SonarCloud: '$(sonar.instance)' + organization: '$(sonar.organization)' + scannerMode: 'MSBuild' + projectKey: '$(sonar.project.key)' + projectName: '$(sonar.project.name)' + extraProperties: | + sonar.cpd.exclusions=**/Models/*.cs,**/Dto/*.cs +- task: DotNetCoreCLI@2 + displayName: 'Build the .NET solution' + inputs: + command: 'build' + projects: $(SolutionFile) + arguments: '-c $(BuildConfiguration)' + env: + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + COREHOST_TRACE: 0 +- task: DotNetCoreCLI@2 + displayName: 'Run the .NET test projects' + inputs: + command: 'test' + projects: $(TestProjects) + arguments: '--configuration $(BuildConfiguration) --collect "Code coverage"' + env: + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + COREHOST_TRACE: 0 + AlmOps__Sandbox__Organization: $(almops.azuredevops.organization) + AlmOps__Sandbox__Username: $(almops.azuredevops.username) + AlmOps__Sandbox__Token: $(almops.azuredevops.token) + AlmOps__Sandbox__Project: $(almops.azuredevops.project) + AlmOps__Sandbox__VariableGroup: $(almops.azuredevops.demovariablegroup.id) +- task: SonarCloudAnalyze@1 + displayName: 'Analyze the code with Sonar' +- task: SonarCloudPublish@1 + displayName: 'Publish the code analysis results' + inputs: + pollingTimeoutSec: '300' diff --git a/.azure/pipelines/pkg.yml b/.azure/pipelines/pkg.yml new file mode 100644 index 0000000..793ecf9 --- /dev/null +++ b/.azure/pipelines/pkg.yml @@ -0,0 +1,59 @@ +# Azure pipeline definition for the packaging of the solution (continuous delivery) + +trigger: none +# batch: true +# branches: +# include: +# - main +# paths: +# exclude: +# - README.md +# include: +# - Directory.Build.props + +pr: none + +variables: +# library variable groups +- group: 'build-tools' +# environment variables +- name: 'DOTNET_CLI_TELEMETRY_OPTOUT' + value: '1' +- name: 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' + value: '1' +# common task variables +- name: 'BuildConfiguration' + value: 'Release' +- name: 'ProjectsToPackage' + value: '**/ConsoleApp/*.csproj;!**/*Tests.csproj' +- name: 'SolutionFile' + value: 'AlmOps.sln' + +pool: + vmImage: 'ubuntu-latest' + +steps: +- task: UseDotNet@2 + displayName: 'Use latest .NET Core SDK' + inputs: + packageType: 'sdk' + version: '8.0.x' +- task: DotNetCoreCLI@2 + displayName: 'Build the .NET solution' + inputs: + command: 'build' + projects: $(SolutionFile) + arguments: '-c $(BuildConfiguration)' +- task: DotNetCoreCLI@2 + displayName: 'Created packed NuGet files' + inputs: + command: 'pack' + packagesToPack: $(ProjectsToPackage) + versioningScheme: 'off' +- task: NuGetCommand@2 + displayName: 'Push files to NuGet' + inputs: + command: 'push' + packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg' + nuGetFeedType: 'external' + publishFeedCredentials: $(nuget.instance) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..97a4757 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,180 @@ +include: + - remote: 'https://gitlab.com/neuvector/gitlab-plugin/-/raw/master/scan.yml' + - template: Jobs/Container-Scanning.gitlab-ci.yml + +stages: + - build + - test + - publish + +workflow: + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + - if: '$CI_PIPELINE_SOURCE == "web"' + +variables: + IMAGE_REPOSITORY: $CONTAINER_REGISTRY_DOMAIN/$CONTAINER_REGISTRY_USER/almops + IMAGE_TAG: 1.3.$CI_PIPELINE_ID + IMAGE_NAME: $IMAGE_REPOSITORY:$IMAGE_TAG + IMAGE_LATEST: $IMAGE_REPOSITORY:latest + +.dotnet: + image: mcr.microsoft.com/dotnet/sdk:10.0 + variables: + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + COREHOST_TRACE: 0 + BUILD_SOURCEBRANCHNAME: $CI_COMMIT_BRANCH + BUILD_BUILDID: $CI_PIPELINE_ID + +dotnet-build: + extends: .dotnet + stage: build + script: + - dotnet restore + - dotnet build --no-restore --configuration Debug + +dotnet-test: + extends: .dotnet + stage: test + variables: + DOTNET_TEST_RESULT_XMLFILES: ./**/*test-result.xml + DOTNET_TEST_COVERAGE_XMLFILES: ./test/*/TestResults/*/coverage.cobertura.xml + DOTNET_TEST_REPORT_FOLDER: report + # other options available: /d:sonar.coverage.exclusions=... /d:sonar.cpd.exclusions=**/Models/*.cs,**/Dto/*.cs + SONAR_EXTRA_PARAMETERS: /d:sonar.cpd.exclusions=**/*Generated*.cs,report/** /d:sonar.coverageReportPaths=report/SonarQube.xml + # empty runs every test, and a local run filters out the ones against live sandboxes + DOTNET_TEST_EXTRA_PARAMETERS: "" + AlmOps__Sandbox__Organization: $AZUREDEVOPS_TEST_ORG + AlmOps__Sandbox__Username: $AZUREDEVOPS_TEST_USERNAME + AlmOps__Sandbox__Token: $AZUREDEVOPS_TEST_TOKEN + AlmOps__Sandbox__Project: $AZUREDEVOPS_TEST_PROJECT + AlmOps__Sandbox__VariableGroupId: $AZUREDEVOPS_TEST_VARIABLEGROUPID + AlmOps__Sandbox__GitLab__Token: $GITLAB_TEST_TOKEN + AlmOps__Sandbox__GitLab__GroupId: $GITLAB_TEST_GROUPID + AlmOps__Sandbox__GitLab__ProjectId: $GITLAB_TEST_PROJECTID + before_script: + # updates system + - cat /etc/issue + - apt-get update + - apt-get install -y gnupg + # installs java runtime, sonar scanner and report generator tool + - apt install -y default-jre + - dotnet tool install --global dotnet-sonarscanner + - dotnet tool install --global dotnet-reportgenerator-globaltool + # adds dotnet global tool in the path + - export PATH="$PATH:/root/.dotnet/tools" + script: + - dotnet sonarscanner begin /o:$SONAR_ORGANIZATION /k:$SONAR_PROJECTKEY /n:AlmOps /d:sonar.host.url=$SONAR_HOSTURL /d:sonar.token=$SONAR_TOKEN $SONAR_EXTRA_PARAMETERS + - dotnet test --configuration Debug --logger:"junit;LogFilePath=..\..\artifacts\{assembly}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage" $DOTNET_TEST_EXTRA_PARAMETERS + - reportgenerator "-reports:$DOTNET_TEST_COVERAGE_XMLFILES" -targetdir:$DOTNET_TEST_REPORT_FOLDER "-reporttypes:Cobertura;Html;TextSummary;SonarQube" + - dotnet sonarscanner end /d:sonar.token=$SONAR_TOKEN + - cat $DOTNET_TEST_REPORT_FOLDER/Summary.txt + artifacts: + when: always + paths: + - $DOTNET_TEST_RESULT_XMLFILES + - $DOTNET_TEST_COVERAGE_XMLFILES + - $DOTNET_TEST_REPORT_FOLDER/Cobertura.xml + - $DOTNET_TEST_REPORT_FOLDER/Summary.txt + reports: + junit: + - $DOTNET_TEST_RESULT_XMLFILES + coverage_report: + coverage_format: cobertura + # should also work and will prevent issue with line limit + # path: $DOTNET_TEST_REPORT_FOLDER/Cobertura.xml + path: $DOTNET_TEST_COVERAGE_XMLFILES + coverage: '/Line coverage: \d+(?:\.\d+)?%/' + +nuget-push: + extends: .dotnet + stage: publish + script: + - dotnet pack --configuration Release -o output + - for f in output/*.nupkg; do dotnet nuget push "$f" --api-key $NUGET_APIKEY --source $NUGET_SOURCE ; done + only: + refs: + - main + changes: + - Directory.Build.props + variables: + - $CI_PIPELINE_SOURCE == "push" + +#.docker: +# image: docker:stable +# services: +# - docker-dind +# tags: +# - gitlab-org-docker + +.podman: + image: quay.io/podman/stable:latest + +podman-build: + extends: .podman + stage: build + script: + - podman build . -t $IMAGE_NAME -f src/ConsoleApp/Dockerfile + - podman save -o image.tar $IMAGE_NAME + timeout: 30 minutes + artifacts: + expire_in: 1 hours + paths: + - image.tar + +neuvector_scan: + #extends: .docker + stage: test + variables: + #image_registry_url: "https://registry-1.docker.io" + #image_registry_user: $CONTAINER_REGISTRY_USER + #image_registry_password: $CONTAINER_REGISTRY_PASSWD + scan_local_image: "true" + image_tar: "image.tar" + image_repo: $IMAGE_REPOSITORY + image_tag: $IMAGE_TAG + #nv_registry_url: "https://registry-1.docker.io" + nv_registry_user: $CONTAINER_REGISTRY_USER + nv_registry_password: $CONTAINER_REGISTRY_PASSWD + scan_layers: "false" + high_vul_to_fail: 0 + medium_vul_to_fail: 0 + vul_names_to_fail: "" + #DOCKER_HOST: tcp://docker:2376 + #DOCKER_TLS_CERTDIR: "/certs" + #DOCKER_TLS_VERIFY: 1 + #DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client" + #before_script: + # - apk add curl + # - apk add jq + # - until docker info; do sleep 1; done + after_script: + - cat ./nvreport/scan-summary.txt + dependencies: + - podman-build + +# https://docs.gitlab.com/user/application_security/container_scanning/ +container_scanning: + variables: + CS_IMAGE: "archive://image.tar" + dependencies: + - podman-build + +#other way to add Trivy: https://trivy.dev/latest/getting-started/installation/, https://trivy.dev/v0.58/tutorials/integrations/gitlab-ci/ + +podman-push: + extends: .podman + stage: publish + before_script: + - echo "$CONTAINER_REGISTRY_PASSWD" | podman login $CONTAINER_REGISTRY_DOMAIN -u "$CONTAINER_REGISTRY_USER" --password-stdin + script: + - podman load -i image.tar + - podman push $IMAGE_NAME + - if [ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]; then podman tag $IMAGE_NAME $IMAGE_LATEST; podman push $IMAGE_LATEST; fi + only: + - main + - web + dependencies: + - podman-build diff --git a/AlmOps.slnx b/AlmOps.slnx index 70971c8..cff0b2e 100644 --- a/AlmOps.slnx +++ b/AlmOps.slnx @@ -3,24 +3,29 @@ - - - + - - + + + + + + + + + - + - + diff --git a/README.md b/README.md index 240730d..4c34178 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# almops - Ops tool for ALM solutions +# almops - Ops tool for ALM solutions [![CI](https://github.com/devpro/almops/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/devpro/almops/actions/workflows/ci.yaml) [![PKG](https://github.com/devpro/almops/actions/workflows/pkg.yaml/badge.svg?branch=main)](https://github.com/devpro/almops/actions/workflows/pkg.yaml) @@ -6,7 +6,11 @@ [![Nuget](https://img.shields.io/nuget/v/almops.svg)](https://www.nuget.org/packages/almops) [![Docker Image Version](https://img.shields.io/docker/v/devprofr/almops?label=Docker)](https://hub.docker.com/r/devprofr/almops) - + Command line tool to administrate [ALM (Application lifecycle management)](https://en.wikipedia.org/wiki/Application_lifecycle_management) solutions such as Azure DevOps, GitHub, GitLab. From 2d99ba6168ffd696417a360e2fb0c19c38581de0 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Thu, 22 Oct 2026 01:07:53 +0200 Subject: [PATCH 21/34] Fix yaml lint errors --- .azure/pipelines/ci.yml | 166 ++++++++++++++++++------------------- .azure/pipelines/pkg.yml | 82 +++++++++--------- .github/workflows/pkg.yaml | 2 +- .gitlab-ci.yml | 22 ++++- AlmOps.slnx | 7 +- 5 files changed, 150 insertions(+), 129 deletions(-) diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index cdd78aa..c26dc3c 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -4,104 +4,104 @@ trigger: none # batch: true # branches: # include: -# - main +# - main # paths: # exclude: -# - README.md +# - README.md pr: none # autoCancel: true # branches: # include: -# - main +# - main # paths: # exclude: -# - README.md +# - README.md -#schedules: -#- cron: "0 0 * * *" -# displayName: 'Daily midnight build' -# branches: -# include: -# - main -# always: true +# schedules: +# - cron: "0 0 * * *" +# displayName: 'Daily midnight build' +# branches: +# include: +# - main +# always: true variables: -# library variable groups -- group: 'build-tools' -- group: 'integration-testing-sandbox' -# common task variables -- name: 'BuildConfiguration' - value: 'Debug' -- name: 'SolutionFile' - value: 'AlmOps.sln' -- name: 'TestProjects' - value: 'test/*Tests/*.csproj' -# tool variables (Sonar) -- name: 'sonar.project.name' - value: 'AlmOps' -- name: 'sonar.project.key' - value: 'devpro.almops' + # library variable groups + - group: 'build-tools' + - group: 'integration-testing-sandbox' + # common task variables + - name: 'BuildConfiguration' + value: 'Debug' + - name: 'SolutionFile' + value: 'AlmOps.sln' + - name: 'TestProjects' + value: 'test/*Tests/*.csproj' + # tool variables (Sonar) + - name: 'sonar.project.name' + value: 'AlmOps' + - name: 'sonar.project.key' + value: 'devpro.almops' pool: # code coverage generation only works on Windows for the moment vmImage: 'windows-latest' steps: -- task: UseDotNet@2 - displayName: 'Use .NET Core SDK' - inputs: - packageType: 'sdk' - version: '8.0.x' -- task: DotNetCoreCLI@2 - displayName: 'Restore .NET packages' - inputs: - command: 'restore' - projects: '$(SolutionFile)' - feedsToUse: 'select' - noCache: 'true' - env: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - COREHOST_TRACE: 0 -- task: SonarCloudPrepare@1 - displayName: 'Prepare code analysis' - inputs: - SonarCloud: '$(sonar.instance)' - organization: '$(sonar.organization)' - scannerMode: 'MSBuild' - projectKey: '$(sonar.project.key)' - projectName: '$(sonar.project.name)' - extraProperties: | - sonar.cpd.exclusions=**/Models/*.cs,**/Dto/*.cs -- task: DotNetCoreCLI@2 - displayName: 'Build the .NET solution' - inputs: - command: 'build' - projects: $(SolutionFile) - arguments: '-c $(BuildConfiguration)' - env: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - COREHOST_TRACE: 0 -- task: DotNetCoreCLI@2 - displayName: 'Run the .NET test projects' - inputs: - command: 'test' - projects: $(TestProjects) - arguments: '--configuration $(BuildConfiguration) --collect "Code coverage"' - env: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - COREHOST_TRACE: 0 - AlmOps__Sandbox__Organization: $(almops.azuredevops.organization) - AlmOps__Sandbox__Username: $(almops.azuredevops.username) - AlmOps__Sandbox__Token: $(almops.azuredevops.token) - AlmOps__Sandbox__Project: $(almops.azuredevops.project) - AlmOps__Sandbox__VariableGroup: $(almops.azuredevops.demovariablegroup.id) -- task: SonarCloudAnalyze@1 - displayName: 'Analyze the code with Sonar' -- task: SonarCloudPublish@1 - displayName: 'Publish the code analysis results' - inputs: - pollingTimeoutSec: '300' + - task: UseDotNet@2 + displayName: 'Use .NET Core SDK' + inputs: + packageType: 'sdk' + version: '8.0.x' + - task: DotNetCoreCLI@2 + displayName: 'Restore .NET packages' + inputs: + command: 'restore' + projects: '$(SolutionFile)' + feedsToUse: 'select' + noCache: 'true' + env: + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + COREHOST_TRACE: 0 + - task: SonarCloudPrepare@1 + displayName: 'Prepare code analysis' + inputs: + SonarCloud: '$(sonar.instance)' + organization: '$(sonar.organization)' + scannerMode: 'MSBuild' + projectKey: '$(sonar.project.key)' + projectName: '$(sonar.project.name)' + extraProperties: | + sonar.cpd.exclusions=**/Models/*.cs,**/Dto/*.cs + - task: DotNetCoreCLI@2 + displayName: 'Build the .NET solution' + inputs: + command: 'build' + projects: $(SolutionFile) + arguments: '-c $(BuildConfiguration)' + env: + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + COREHOST_TRACE: 0 + - task: DotNetCoreCLI@2 + displayName: 'Run the .NET test projects' + inputs: + command: 'test' + projects: $(TestProjects) + arguments: '--configuration $(BuildConfiguration) --collect "Code coverage"' + env: + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + COREHOST_TRACE: 0 + AlmOps__Sandbox__Organization: $(almops.azuredevops.organization) + AlmOps__Sandbox__Username: $(almops.azuredevops.username) + AlmOps__Sandbox__Token: $(almops.azuredevops.token) + AlmOps__Sandbox__Project: $(almops.azuredevops.project) + AlmOps__Sandbox__VariableGroup: $(almops.azuredevops.demovariablegroup.id) + - task: SonarCloudAnalyze@1 + displayName: 'Analyze the code with Sonar' + - task: SonarCloudPublish@1 + displayName: 'Publish the code analysis results' + inputs: + pollingTimeoutSec: '300' diff --git a/.azure/pipelines/pkg.yml b/.azure/pipelines/pkg.yml index 793ecf9..458e3ba 100644 --- a/.azure/pipelines/pkg.yml +++ b/.azure/pipelines/pkg.yml @@ -4,56 +4,56 @@ trigger: none # batch: true # branches: # include: -# - main +# - main # paths: # exclude: -# - README.md +# - README.md # include: -# - Directory.Build.props +# - Directory.Build.props pr: none variables: -# library variable groups -- group: 'build-tools' -# environment variables -- name: 'DOTNET_CLI_TELEMETRY_OPTOUT' - value: '1' -- name: 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' - value: '1' -# common task variables -- name: 'BuildConfiguration' - value: 'Release' -- name: 'ProjectsToPackage' - value: '**/ConsoleApp/*.csproj;!**/*Tests.csproj' -- name: 'SolutionFile' - value: 'AlmOps.sln' + # library variable groups + - group: 'build-tools' + # environment variables + - name: 'DOTNET_CLI_TELEMETRY_OPTOUT' + value: '1' + - name: 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' + value: '1' + # common task variables + - name: 'BuildConfiguration' + value: 'Release' + - name: 'ProjectsToPackage' + value: '**/ConsoleApp/*.csproj;!**/*Tests.csproj' + - name: 'SolutionFile' + value: 'AlmOps.sln' pool: vmImage: 'ubuntu-latest' steps: -- task: UseDotNet@2 - displayName: 'Use latest .NET Core SDK' - inputs: - packageType: 'sdk' - version: '8.0.x' -- task: DotNetCoreCLI@2 - displayName: 'Build the .NET solution' - inputs: - command: 'build' - projects: $(SolutionFile) - arguments: '-c $(BuildConfiguration)' -- task: DotNetCoreCLI@2 - displayName: 'Created packed NuGet files' - inputs: - command: 'pack' - packagesToPack: $(ProjectsToPackage) - versioningScheme: 'off' -- task: NuGetCommand@2 - displayName: 'Push files to NuGet' - inputs: - command: 'push' - packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg' - nuGetFeedType: 'external' - publishFeedCredentials: $(nuget.instance) + - task: UseDotNet@2 + displayName: 'Use latest .NET Core SDK' + inputs: + packageType: 'sdk' + version: '8.0.x' + - task: DotNetCoreCLI@2 + displayName: 'Build the .NET solution' + inputs: + command: 'build' + projects: $(SolutionFile) + arguments: '-c $(BuildConfiguration)' + - task: DotNetCoreCLI@2 + displayName: 'Created packed NuGet files' + inputs: + command: 'pack' + packagesToPack: $(ProjectsToPackage) + versioningScheme: 'off' + - task: NuGetCommand@2 + displayName: 'Push files to NuGet' + inputs: + command: 'push' + packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg' + nuGetFeedType: 'external' + publishFeedCredentials: $(nuget.instance) diff --git a/.github/workflows/pkg.yaml b/.github/workflows/pkg.yaml index 5c954a3..b9a9359 100644 --- a/.github/workflows/pkg.yaml +++ b/.github/workflows/pkg.yaml @@ -41,7 +41,7 @@ jobs: timeout-minutes: 20 steps: - name: Clone repository - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 - name: Pack & push .NET projects diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 97a4757..0d11549 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -66,9 +66,25 @@ dotnet-test: # adds dotnet global tool in the path - export PATH="$PATH:/root/.dotnet/tools" script: - - dotnet sonarscanner begin /o:$SONAR_ORGANIZATION /k:$SONAR_PROJECTKEY /n:AlmOps /d:sonar.host.url=$SONAR_HOSTURL /d:sonar.token=$SONAR_TOKEN $SONAR_EXTRA_PARAMETERS - - dotnet test --configuration Debug --logger:"junit;LogFilePath=..\..\artifacts\{assembly}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage" $DOTNET_TEST_EXTRA_PARAMETERS - - reportgenerator "-reports:$DOTNET_TEST_COVERAGE_XMLFILES" -targetdir:$DOTNET_TEST_REPORT_FOLDER "-reporttypes:Cobertura;Html;TextSummary;SonarQube" + - > + dotnet sonarscanner begin + /o:$SONAR_ORGANIZATION + /k:$SONAR_PROJECTKEY + /n:AlmOps + /d:sonar.host.url=$SONAR_HOSTURL + /d:sonar.token=$SONAR_TOKEN + $SONAR_EXTRA_PARAMETERS + - > + dotnet test + --configuration Debug + --logger:"junit;LogFilePath=..\..\artifacts\{assembly}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose" + --collect:"XPlat Code Coverage" + $DOTNET_TEST_EXTRA_PARAMETERS + - > + reportgenerator + "-reports:$DOTNET_TEST_COVERAGE_XMLFILES" + -targetdir:$DOTNET_TEST_REPORT_FOLDER + "-reporttypes:Cobertura;Html;TextSummary;SonarQube" - dotnet sonarscanner end /d:sonar.token=$SONAR_TOKEN - cat $DOTNET_TEST_REPORT_FOLDER/Summary.txt artifacts: diff --git a/AlmOps.slnx b/AlmOps.slnx index cff0b2e..d674aed 100644 --- a/AlmOps.slnx +++ b/AlmOps.slnx @@ -11,11 +11,16 @@ - + + + + + + From 06b08425d7c023062f277371cd47eac5e385d6ae Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Thu, 22 Oct 2026 15:43:08 +0200 Subject: [PATCH 22/34] Remove BOM --- .editorconfig | 1 + src/ConsoleApp/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 7bc41cd..ca01803 100644 --- a/.editorconfig +++ b/.editorconfig @@ -20,6 +20,7 @@ trim_trailing_whitespace = true indent_size = 2 indent_style = space trim_trailing_whitespace = false +max_line_length = 240 [*.cs] dotnet_sort_system_directives_first = true diff --git a/src/ConsoleApp/Dockerfile b/src/ConsoleApp/Dockerfile index 3636364..6fb147a 100644 --- a/src/ConsoleApp/Dockerfile +++ b/src/ConsoleApp/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1 +# syntax=docker/dockerfile:1 FROM registry.suse.com/bci/dotnet-aspnet:10.0.13 AS base USER $APP_UID From ae366ae5797fd92ef0a670e02d85b2c56e7e2db4 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Fri, 23 Oct 2026 17:31:17 +0200 Subject: [PATCH 23/34] Use the github-workflow-parts of 13ac7cc, and drop the CVE thresholds the scan never read The container scan fails on any high or critical vulnerability with a fix, whatever max-high-cves and max-medium-cves said, and no longer declares them. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SESuYdZsJfq852odntm3Yi --- .github/workflows/ci.yaml | 16 +++++++--------- .github/workflows/pkg.yaml | 14 +++++++------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 03a4465..1c302b3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,21 +30,21 @@ permissions: jobs: git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e with: paths: 'src test samples Directory.Build.props Directory.Packages.props *.slnx global.json' version-file: Directory.Build.props - workflow-parts-version: 86258d301cd7d6d374587a0663ee384b9ccc4515 + workflow-parts-version: 13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e markup-lint: name: Markup - uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e code-quality: name: Code needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-code-quality) - uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e with: dotnet-test-args: "--report-xunit-trx --coverage --coverage-output-format cobertura ${{ vars.DOTNET_TEST_EXTRA_ARGS }}" fossa-enabled: ${{ vars.FOSSA_ENABLED != 'false' }} @@ -55,7 +55,7 @@ jobs: sonar-organization: ${{ vars.SONAR_ORG }} sonar-project-key: ${{ vars.SONAR_PROJECT_KEY }} sonar-project-name: AlmOps - workflow-parts-version: 86258d301cd7d6d374587a0663ee384b9ccc4515 + workflow-parts-version: 13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e secrets: fossa-api-key: ${{ secrets.FOSSA_API_KEY }} sonar-token: ${{ secrets.SONAR_TOKEN }} @@ -76,12 +76,10 @@ jobs: name: Image needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-image-scan) - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e with: image-definition: "src/ConsoleApp/Dockerfile" image-name: ${{ vars.CONTAINER_IMAGE_NAME }} image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" - max-high-cves: 0 - max-medium-cves: 0 - workflow-parts-version: 86258d301cd7d6d374587a0663ee384b9ccc4515 + workflow-parts-version: 13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e diff --git a/.github/workflows/pkg.yaml b/.github/workflows/pkg.yaml index b9a9359..f2fe0e5 100644 --- a/.github/workflows/pkg.yaml +++ b/.github/workflows/pkg.yaml @@ -19,19 +19,19 @@ permissions: jobs: git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e with: paths: 'src Directory.Build.props Directory.Packages.props global.json' version-file: Directory.Build.props - workflow-parts-version: 86258d301cd7d6d374587a0663ee384b9ccc4515 + workflow-parts-version: 13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e # NuGet refuses a version it already holds, so the packages are pushed only when the version changes. version-check: name: Version - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e with: paths: 'Directory.Build.props' - workflow-parts-version: 86258d301cd7d6d374587a0663ee384b9ccc4515 + workflow-parts-version: 13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e package-publication: name: Package / Publication @@ -45,7 +45,7 @@ jobs: with: fetch-depth: 0 - name: Pack & push .NET projects - uses: devpro/github-workflow-parts/actions/dotnet/pack-push@86258d301cd7d6d374587a0663ee384b9ccc4515 + uses: devpro/github-workflow-parts/actions/dotnet/pack-push@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e with: registry-token: ${{ secrets.NUGET_API_KEY }} push-enabled: ${{ github.event_name != 'workflow_dispatch' || inputs.push-enabled }} @@ -57,7 +57,7 @@ jobs: permissions: id-token: write contents: read - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@86258d301cd7d6d374587a0663ee384b9ccc4515 + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e with: create-latest: ${{ github.ref_name == 'main' }} image-definition: "src/ConsoleApp/Dockerfile" @@ -65,7 +65,7 @@ jobs: image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" image-platform: linux/amd64 - workflow-parts-version: 86258d301cd7d6d374587a0663ee384b9ccc4515 + workflow-parts-version: 13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e secrets: container-registry-password: ${{ secrets.DOCKERHUB_TOKEN }} container-registry-username: ${{ secrets.DOCKERHUB_USERNAME }} From 02465b0315a2c7431e9ba8bb110686f793d0e462 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Fri, 23 Oct 2026 17:31:21 +0200 Subject: [PATCH 24/34] Save the remaining text files as UTF-8 without a byte order mark, which some tools refuse to read Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SESuYdZsJfq852odntm3Yi --- .azure/pipelines/ci.yml | 2 +- .azure/pipelines/pkg.yml | 2 +- .dockerignore | 2 +- .editorconfig | 2 +- Directory.Build.props | 2 +- samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj | 2 +- samples/SamlTokenClaimEnricher/TokenClaimsEnricher.cs | 2 +- .../AzureDevOpsComponent.Domain.csproj | 2 +- src/AzureDevOpsComponent.Domain/Models/BuildArtifactModel.cs | 2 +- src/AzureDevOpsComponent.Domain/Models/BuildDefinitionModel.cs | 2 +- src/AzureDevOpsComponent.Domain/Models/BuildModel.cs | 2 +- src/AzureDevOpsComponent.Domain/Models/EnvironmentModel.cs | 2 +- src/AzureDevOpsComponent.Domain/Models/PersonModel.cs | 2 +- src/AzureDevOpsComponent.Domain/Models/PoolModel.cs | 2 +- src/AzureDevOpsComponent.Domain/Models/ProjectModel.cs | 2 +- src/AzureDevOpsComponent.Domain/Models/QueueModel.cs | 2 +- src/AzureDevOpsComponent.Domain/Models/ReleaseArtifactModel.cs | 2 +- .../Models/ReleaseDefinitionModel.cs | 2 +- src/AzureDevOpsComponent.Domain/Models/ReleaseModel.cs | 2 +- src/AzureDevOpsComponent.Domain/Models/VariableGroupModel.cs | 2 +- .../Repositories/IBuildArtifactRepository.cs | 2 +- .../Repositories/IBuildRepository.cs | 2 +- .../Repositories/IBuildTagRepository.cs | 2 +- .../Repositories/IProjectRepository.cs | 2 +- .../Repositories/IReleaseDefinitionRepository.cs | 2 +- .../Repositories/IReleaseRepository.cs | 2 +- .../Repositories/IVariableGroupRepository.cs | 2 +- .../AzureDevOpsComponent.Infrastructure.RestApi.csproj | 2 +- .../AzureDevOpsRestApiConfiguration.cs | 2 +- .../DependencyInjection/ServiceCollectionExtensions.cs | 2 +- .../Dto/ApprovalDto.cs | 2 +- .../Dto/ApprovalOptionsDto.cs | 2 +- .../Dto/ApprovalsSnapshotDto.cs | 2 +- .../Dto/BuildArtifactDto.cs | 2 +- .../Dto/BuildDefinitionDto.cs | 2 +- src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs | 2 +- .../Dto/ConditionDto.cs | 2 +- .../Dto/DefinitionReferenceDto.cs | 2 +- .../Dto/DeployPhasesSnapshotDto.cs | 2 +- .../Dto/DeploymentInputDto.cs | 2 +- .../Dto/EnvironmentDto.cs | 2 +- .../Dto/EnvironmentOptionsDto.cs | 2 +- src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/HrefDto.cs | 2 +- .../Dto/InputsDto.cs | 2 +- src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LinksDto.cs | 2 +- src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LogsDto.cs | 2 +- .../Dto/NameValueDto.cs | 2 +- .../Dto/OrchestrationPlanDto.cs | 2 +- .../Dto/ParallelExecutionDto.cs | 2 +- .../Dto/PersonDto.cs | 2 +- src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PlanDto.cs | 2 +- src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PoolDto.cs | 2 +- .../Dto/ProjectDto.cs | 2 +- .../Dto/ProjectReferenceDto.cs | 2 +- src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/QueueDto.cs | 2 +- .../Dto/ReferenceDto.cs | 2 +- .../Dto/ReleaseArtifactDto.cs | 2 +- .../Dto/ReleaseDefinitionDto.cs | 2 +- .../Dto/ReleaseDto.cs | 2 +- .../Dto/RepositoryDto.cs | 2 +- .../Dto/ResourceDto.cs | 2 +- .../Dto/ResourcePropertiesDto.cs | 2 +- .../Dto/ResultDto.cs | 2 +- .../Dto/TriggerInfoDto.cs | 2 +- .../Dto/ValidationResultDto.cs | 2 +- .../Dto/VariableGroupDto.cs | 2 +- .../Dto/WorkflowTaskDto.cs | 2 +- .../Repositories/BuildArtifactRepository.cs | 2 +- .../Repositories/BuildRepository.cs | 2 +- .../Repositories/BuildTagRepository.cs | 2 +- .../Repositories/ProjectRepository.cs | 2 +- .../Repositories/ReleaseDefinitionRepository.cs | 2 +- .../Repositories/ReleaseRepository.cs | 2 +- .../Repositories/RepositoryBase.cs | 2 +- src/ConsoleApp/AppConfiguration.cs | 2 +- src/ConsoleApp/CommandLineOptions.cs | 2 +- src/ConsoleApp/ConsoleApp.csproj | 2 +- src/ConsoleApp/Program.cs | 2 +- src/ConsoleApp/Tasks/ConsoleTaskFactory.cs | 2 +- src/ConsoleApp/Tasks/CreateReleaseTask.cs | 2 +- src/ConsoleApp/Tasks/IConsoleTask.cs | 2 +- src/ConsoleApp/Tasks/ListArtifactTask.cs | 2 +- src/ConsoleApp/Tasks/ListBuildTask.cs | 2 +- src/ConsoleApp/Tasks/ListProjectTask.cs | 2 +- src/ConsoleApp/Tasks/QueueBuildTask.cs | 2 +- src/ConsoleApp/Tasks/ShowBuildTask.cs | 2 +- src/ConsoleApp/Tasks/TaskBase.cs | 2 +- src/ConsoleApp/Tasks/UpdateVariableTask.cs | 2 +- .../DependencyInjection/ServiceCollectionExtensions.cs | 2 +- src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs | 2 +- src/GitLabComponent.Infrastructure.RestApi/Dto/DetailsDto.cs | 2 +- .../GitLabComponent.Infrastructure.RestApi.csproj | 2 +- .../GitLabRestApiConfiguration.cs | 2 +- .../Repositories/AuditEventRepository.cs | 2 +- .../Repositories/RepositoryBase.cs | 2 +- .../RepositoryIntegrationTestBase.cs | 2 +- .../Sandbox/VariableGroupRepositorySandboxTest.cs | 2 +- .../DependencyInjection/ServiceCollectionExtensionsTest.cs | 2 +- test/ConsoleApp.IntegrationTests/SmokeTest.cs | 2 +- test/ConsoleApp.UnitTests/Tasks/ConsoleTaskFactoryTest.cs | 2 +- test/ConsoleApp.UnitTests/Tasks/TaskBaseTest.cs | 2 +- .../AuditEventRepositoryTest.cs | 2 +- .../EnvironmentExtensions.cs | 2 +- .../RepositoryIntegrationTestBase.cs | 2 +- 104 files changed, 104 insertions(+), 104 deletions(-) diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index c26dc3c..2b96405 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -1,4 +1,4 @@ -# Azure pipeline definition for the integration of the solution (continuous integration) +# Azure pipeline definition for the integration of the solution (continuous integration) trigger: none # batch: true diff --git a/.azure/pipelines/pkg.yml b/.azure/pipelines/pkg.yml index 458e3ba..46bd8c3 100644 --- a/.azure/pipelines/pkg.yml +++ b/.azure/pipelines/pkg.yml @@ -1,4 +1,4 @@ -# Azure pipeline definition for the packaging of the solution (continuous delivery) +# Azure pipeline definition for the packaging of the solution (continuous delivery) trigger: none # batch: true diff --git a/.dockerignore b/.dockerignore index 85a1b15..fcb6b30 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,4 @@ -**/.dockerignore +**/.dockerignore **/.env **/.git **/.gitignore diff --git a/.editorconfig b/.editorconfig index ca01803..dd52c50 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -root = true +root = true # inspired by https://github.com/dotnet/roslyn/blob/master/.editorconfig [*] diff --git a/Directory.Build.props b/Directory.Build.props index 604f5b6..fc6a83c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,4 +1,4 @@ - + $(MsBuildAllProjects);$(MsBuildThisFileFullPath) diff --git a/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj b/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj index b768564..cbb958b 100644 --- a/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj +++ b/samples/SamlTokenClaimEnricher/SamlTokenClaimEnricher.csproj @@ -1,4 +1,4 @@ - + net10.0 diff --git a/samples/SamlTokenClaimEnricher/TokenClaimsEnricher.cs b/samples/SamlTokenClaimEnricher/TokenClaimsEnricher.cs index 33a787b..5041666 100644 --- a/samples/SamlTokenClaimEnricher/TokenClaimsEnricher.cs +++ b/samples/SamlTokenClaimEnricher/TokenClaimsEnricher.cs @@ -1,4 +1,4 @@ -using System.Net; +using System.Net; using System.Text.Json.Serialization; using Microsoft.Azure.Functions.Worker; using Microsoft.Azure.Functions.Worker.Http; diff --git a/src/AzureDevOpsComponent.Domain/AzureDevOpsComponent.Domain.csproj b/src/AzureDevOpsComponent.Domain/AzureDevOpsComponent.Domain.csproj index 9b7242b..4871ccc 100644 --- a/src/AzureDevOpsComponent.Domain/AzureDevOpsComponent.Domain.csproj +++ b/src/AzureDevOpsComponent.Domain/AzureDevOpsComponent.Domain.csproj @@ -1,4 +1,4 @@ - + net10.0 diff --git a/src/AzureDevOpsComponent.Domain/Models/BuildArtifactModel.cs b/src/AzureDevOpsComponent.Domain/Models/BuildArtifactModel.cs index 75b0685..05cb0f6 100644 --- a/src/AzureDevOpsComponent.Domain/Models/BuildArtifactModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/BuildArtifactModel.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models; +namespace AlmOps.AzureDevOpsComponent.Domain.Models; public class BuildArtifactModel { diff --git a/src/AzureDevOpsComponent.Domain/Models/BuildDefinitionModel.cs b/src/AzureDevOpsComponent.Domain/Models/BuildDefinitionModel.cs index 81f14b4..cd99bb7 100644 --- a/src/AzureDevOpsComponent.Domain/Models/BuildDefinitionModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/BuildDefinitionModel.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models; +namespace AlmOps.AzureDevOpsComponent.Domain.Models; public class BuildDefinitionModel { diff --git a/src/AzureDevOpsComponent.Domain/Models/BuildModel.cs b/src/AzureDevOpsComponent.Domain/Models/BuildModel.cs index 9473299..9d3e28b 100644 --- a/src/AzureDevOpsComponent.Domain/Models/BuildModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/BuildModel.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace AlmOps.AzureDevOpsComponent.Domain.Models; diff --git a/src/AzureDevOpsComponent.Domain/Models/EnvironmentModel.cs b/src/AzureDevOpsComponent.Domain/Models/EnvironmentModel.cs index 8146c59..8bcfdeb 100644 --- a/src/AzureDevOpsComponent.Domain/Models/EnvironmentModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/EnvironmentModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace AlmOps.AzureDevOpsComponent.Domain.Models; diff --git a/src/AzureDevOpsComponent.Domain/Models/PersonModel.cs b/src/AzureDevOpsComponent.Domain/Models/PersonModel.cs index a501786..8a22d12 100644 --- a/src/AzureDevOpsComponent.Domain/Models/PersonModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/PersonModel.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models; +namespace AlmOps.AzureDevOpsComponent.Domain.Models; public class PersonModel { diff --git a/src/AzureDevOpsComponent.Domain/Models/PoolModel.cs b/src/AzureDevOpsComponent.Domain/Models/PoolModel.cs index b227e04..e52123d 100644 --- a/src/AzureDevOpsComponent.Domain/Models/PoolModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/PoolModel.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models; +namespace AlmOps.AzureDevOpsComponent.Domain.Models; public class PoolModel { diff --git a/src/AzureDevOpsComponent.Domain/Models/ProjectModel.cs b/src/AzureDevOpsComponent.Domain/Models/ProjectModel.cs index 15bdff3..8fa1d15 100644 --- a/src/AzureDevOpsComponent.Domain/Models/ProjectModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/ProjectModel.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models; +namespace AlmOps.AzureDevOpsComponent.Domain.Models; public class ProjectModel { diff --git a/src/AzureDevOpsComponent.Domain/Models/QueueModel.cs b/src/AzureDevOpsComponent.Domain/Models/QueueModel.cs index 561c185..9e5bdf9 100644 --- a/src/AzureDevOpsComponent.Domain/Models/QueueModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/QueueModel.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models; +namespace AlmOps.AzureDevOpsComponent.Domain.Models; public class QueueModel { diff --git a/src/AzureDevOpsComponent.Domain/Models/ReleaseArtifactModel.cs b/src/AzureDevOpsComponent.Domain/Models/ReleaseArtifactModel.cs index 95e187f..7d95234 100644 --- a/src/AzureDevOpsComponent.Domain/Models/ReleaseArtifactModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/ReleaseArtifactModel.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models; +namespace AlmOps.AzureDevOpsComponent.Domain.Models; public class ReleaseArtifactModel { diff --git a/src/AzureDevOpsComponent.Domain/Models/ReleaseDefinitionModel.cs b/src/AzureDevOpsComponent.Domain/Models/ReleaseDefinitionModel.cs index eadeb52..73b28da 100644 --- a/src/AzureDevOpsComponent.Domain/Models/ReleaseDefinitionModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/ReleaseDefinitionModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; namespace AlmOps.AzureDevOpsComponent.Domain.Models; diff --git a/src/AzureDevOpsComponent.Domain/Models/ReleaseModel.cs b/src/AzureDevOpsComponent.Domain/Models/ReleaseModel.cs index b2c4126..b22ef07 100644 --- a/src/AzureDevOpsComponent.Domain/Models/ReleaseModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/ReleaseModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; namespace AlmOps.AzureDevOpsComponent.Domain.Models; diff --git a/src/AzureDevOpsComponent.Domain/Models/VariableGroupModel.cs b/src/AzureDevOpsComponent.Domain/Models/VariableGroupModel.cs index 05ab1ad..395391b 100644 --- a/src/AzureDevOpsComponent.Domain/Models/VariableGroupModel.cs +++ b/src/AzureDevOpsComponent.Domain/Models/VariableGroupModel.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Domain.Models; +namespace AlmOps.AzureDevOpsComponent.Domain.Models; public class VariableGroupModel { diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IBuildArtifactRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IBuildArtifactRepository.cs index cdb5f35..608bd27 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IBuildArtifactRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IBuildArtifactRepository.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IBuildRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IBuildRepository.cs index 7200093..9b78dbc 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IBuildRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IBuildRepository.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IBuildTagRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IBuildTagRepository.cs index cc91bf3..dd3ea69 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IBuildTagRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IBuildTagRepository.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; namespace AlmOps.AzureDevOpsComponent.Domain.Repositories; diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IProjectRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IProjectRepository.cs index b111214..dd7b08c 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IProjectRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IProjectRepository.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IReleaseDefinitionRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IReleaseDefinitionRepository.cs index 4d4c581..331537f 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IReleaseDefinitionRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IReleaseDefinitionRepository.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IReleaseRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IReleaseRepository.cs index 32fd201..d1e6a00 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IReleaseRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IReleaseRepository.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; namespace AlmOps.AzureDevOpsComponent.Domain.Repositories; diff --git a/src/AzureDevOpsComponent.Domain/Repositories/IVariableGroupRepository.cs b/src/AzureDevOpsComponent.Domain/Repositories/IVariableGroupRepository.cs index 990317d..dbb73f7 100644 --- a/src/AzureDevOpsComponent.Domain/Repositories/IVariableGroupRepository.cs +++ b/src/AzureDevOpsComponent.Domain/Repositories/IVariableGroupRepository.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj index 7810176..fcf1376 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsComponent.Infrastructure.RestApi.csproj @@ -1,4 +1,4 @@ - + net10.0 diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsRestApiConfiguration.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsRestApiConfiguration.cs index 694f468..4d0b410 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsRestApiConfiguration.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/AzureDevOpsRestApiConfiguration.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi; +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi; public class AzureDevOpsRestApiConfiguration { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/DependencyInjection/ServiceCollectionExtensions.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/DependencyInjection/ServiceCollectionExtensions.cs index fdd8094..e9a6f4c 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/DependencyInjection/ServiceCollectionExtensions.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/DependencyInjection/ServiceCollectionExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Net.Http.Headers; using System.Text; using Microsoft.Extensions.DependencyInjection; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalDto.cs index d4e5830..7f03cc8 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; public class ApprovalDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalOptionsDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalOptionsDto.cs index 4cc4114..b933d2b 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalOptionsDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalOptionsDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; public class ApprovalOptionsDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalsSnapshotDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalsSnapshotDto.cs index 5259c8a..ade1316 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalsSnapshotDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ApprovalsSnapshotDto.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildArtifactDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildArtifactDto.cs index 5fa36b3..297a621 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildArtifactDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildArtifactDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; public class BuildArtifactDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDefinitionDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDefinitionDto.cs index 9ba894e..8d2ac1a 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDefinitionDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDefinitionDto.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs index fd8497a..d0bd4dc 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/BuildDto.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Text.Json.Serialization; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ConditionDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ConditionDto.cs index 98234cd..9a61024 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ConditionDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ConditionDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; public class ConditionDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DefinitionReferenceDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DefinitionReferenceDto.cs index a451ff7..e71a4b0 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DefinitionReferenceDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DefinitionReferenceDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class DefinitionReferenceDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeployPhasesSnapshotDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeployPhasesSnapshotDto.cs index 636b0f9..aa2fdb9 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeployPhasesSnapshotDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeployPhasesSnapshotDto.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeploymentInputDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeploymentInputDto.cs index bfe85c9..13fb6c3 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeploymentInputDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/DeploymentInputDto.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentDto.cs index 27ba4bc..fc61ed8 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentDto.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentOptionsDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentOptionsDto.cs index 770bc45..9306353 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentOptionsDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/EnvironmentOptionsDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class EnvironmentOptionsDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/HrefDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/HrefDto.cs index 1368d50..510b0f4 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/HrefDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/HrefDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class HrefDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/InputsDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/InputsDto.cs index b50bd55..f063186 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/InputsDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/InputsDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class InputsDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LinksDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LinksDto.cs index 0178e16..68c5385 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LinksDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LinksDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class LinksDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LogsDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LogsDto.cs index 42220a0..10380d0 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LogsDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/LogsDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class LogsDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/NameValueDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/NameValueDto.cs index 70bc47f..323fec7 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/NameValueDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/NameValueDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class NameValueDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/OrchestrationPlanDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/OrchestrationPlanDto.cs index 78cf2dd..7fe3cd3 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/OrchestrationPlanDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/OrchestrationPlanDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class OrchestrationPlanDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ParallelExecutionDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ParallelExecutionDto.cs index c465b97..5216926 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ParallelExecutionDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ParallelExecutionDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class ParallelExecutionDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PersonDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PersonDto.cs index 7b6bfdb..94e424e 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PersonDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PersonDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class PersonDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PlanDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PlanDto.cs index 666cbba..8a90eb9 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PlanDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PlanDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class PlanDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PoolDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PoolDto.cs index 80318d5..8c927d2 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PoolDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/PoolDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class PoolDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectDto.cs index 34714e6..824afa3 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectDto.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectReferenceDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectReferenceDto.cs index cf451e9..2cabccc 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectReferenceDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ProjectReferenceDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class ProjectReferenceDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/QueueDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/QueueDto.cs index 3d86044..0a131a1 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/QueueDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/QueueDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class QueueDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReferenceDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReferenceDto.cs index c05f668..c8ca4fe 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReferenceDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReferenceDto.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseArtifactDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseArtifactDto.cs index b9014a2..2573220 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseArtifactDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseArtifactDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class ReleaseArtifactDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDefinitionDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDefinitionDto.cs index 2e42d3d..3369aaf 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDefinitionDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDefinitionDto.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDto.cs index 3b8776a..778be94 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ReleaseDto.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Text.Json.Serialization; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/RepositoryDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/RepositoryDto.cs index 33ae9ae..3555d43 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/RepositoryDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/RepositoryDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class RepositoryDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourceDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourceDto.cs index e8f7416..03670e6 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourceDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourceDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class ResourceDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourcePropertiesDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourcePropertiesDto.cs index 8e02936..6e673c3 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourcePropertiesDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResourcePropertiesDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class ResourcePropertiesDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResultDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResultDto.cs index 2a951ba..502a15e 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResultDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ResultDto.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/TriggerInfoDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/TriggerInfoDto.cs index 0becac2..9409d34 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/TriggerInfoDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/TriggerInfoDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class TriggerInfoDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ValidationResultDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ValidationResultDto.cs index 6534024..817eb8d 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ValidationResultDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/ValidationResultDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class ValidationResultDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/VariableGroupDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/VariableGroupDto.cs index 0bd1ad4..6668e5e 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/VariableGroupDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/VariableGroupDto.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Text.Json.Nodes; using System.Text.Json.Serialization; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/WorkflowTaskDto.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/WorkflowTaskDto.cs index 2df25b8..cd2cf09 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/WorkflowTaskDto.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Dto/WorkflowTaskDto.cs @@ -1,4 +1,4 @@ -namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto +namespace AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Dto { public class WorkflowTaskDto { diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildArtifactRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildArtifactRepository.cs index bd30574..1b18f1f 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildArtifactRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildArtifactRepository.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildRepository.cs index 2e89fbe..cc9738f 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildRepository.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Net.Http; using System.Text.Json; using System.Threading.Tasks; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildTagRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildTagRepository.cs index 69af5a6..2a50210 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildTagRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/BuildTagRepository.cs @@ -1,4 +1,4 @@ -using System.Net.Http; +using System.Net.Http; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ProjectRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ProjectRepository.cs index 041fc70..5858d00 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ProjectRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ProjectRepository.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseDefinitionRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseDefinitionRepository.cs index 2630dc7..2eb1941 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseDefinitionRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseDefinitionRepository.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseRepository.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseRepository.cs index bf9b84c..5a9c1f5 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseRepository.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/ReleaseRepository.cs @@ -1,4 +1,4 @@ -using System.Net.Http; +using System.Net.Http; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; diff --git a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs index 6167800..1ba13af 100644 --- a/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs +++ b/src/AzureDevOpsComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs @@ -1,4 +1,4 @@ -using System.Net.Http; +using System.Net.Http; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; using AlmOps.Common.Infrastructure.RestApi; using Microsoft.Extensions.Logging; diff --git a/src/ConsoleApp/AppConfiguration.cs b/src/ConsoleApp/AppConfiguration.cs index 8c5a021..2c5b08b 100644 --- a/src/ConsoleApp/AppConfiguration.cs +++ b/src/ConsoleApp/AppConfiguration.cs @@ -1,4 +1,4 @@ -using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi; using Microsoft.Extensions.Configuration; namespace AlmOps.ConsoleApp; diff --git a/src/ConsoleApp/CommandLineOptions.cs b/src/ConsoleApp/CommandLineOptions.cs index 415b90a..1aebcaa 100644 --- a/src/ConsoleApp/CommandLineOptions.cs +++ b/src/ConsoleApp/CommandLineOptions.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using CommandLine; namespace AlmOps.ConsoleApp; diff --git a/src/ConsoleApp/ConsoleApp.csproj b/src/ConsoleApp/ConsoleApp.csproj index 875629c..2f40cb8 100644 --- a/src/ConsoleApp/ConsoleApp.csproj +++ b/src/ConsoleApp/ConsoleApp.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/src/ConsoleApp/Program.cs b/src/ConsoleApp/Program.cs index 54aa3e7..32ab2bf 100644 --- a/src/ConsoleApp/Program.cs +++ b/src/ConsoleApp/Program.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/src/ConsoleApp/Tasks/ConsoleTaskFactory.cs b/src/ConsoleApp/Tasks/ConsoleTaskFactory.cs index f285b2d..9e2f2bd 100644 --- a/src/ConsoleApp/Tasks/ConsoleTaskFactory.cs +++ b/src/ConsoleApp/Tasks/ConsoleTaskFactory.cs @@ -1,4 +1,4 @@ -using AlmOps.AzureDevOpsComponent.Domain.Repositories; +using AlmOps.AzureDevOpsComponent.Domain.Repositories; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; diff --git a/src/ConsoleApp/Tasks/CreateReleaseTask.cs b/src/ConsoleApp/Tasks/CreateReleaseTask.cs index 27cf590..ba8c1c3 100644 --- a/src/ConsoleApp/Tasks/CreateReleaseTask.cs +++ b/src/ConsoleApp/Tasks/CreateReleaseTask.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using Microsoft.Extensions.Logging; diff --git a/src/ConsoleApp/Tasks/IConsoleTask.cs b/src/ConsoleApp/Tasks/IConsoleTask.cs index dc05374..ce41393 100644 --- a/src/ConsoleApp/Tasks/IConsoleTask.cs +++ b/src/ConsoleApp/Tasks/IConsoleTask.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; namespace AlmOps.ConsoleApp.Tasks; diff --git a/src/ConsoleApp/Tasks/ListArtifactTask.cs b/src/ConsoleApp/Tasks/ListArtifactTask.cs index ba25332..9b31d66 100644 --- a/src/ConsoleApp/Tasks/ListArtifactTask.cs +++ b/src/ConsoleApp/Tasks/ListArtifactTask.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; diff --git a/src/ConsoleApp/Tasks/ListBuildTask.cs b/src/ConsoleApp/Tasks/ListBuildTask.cs index ec35c1d..431c934 100644 --- a/src/ConsoleApp/Tasks/ListBuildTask.cs +++ b/src/ConsoleApp/Tasks/ListBuildTask.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; diff --git a/src/ConsoleApp/Tasks/ListProjectTask.cs b/src/ConsoleApp/Tasks/ListProjectTask.cs index f1340ad..1d6a5eb 100644 --- a/src/ConsoleApp/Tasks/ListProjectTask.cs +++ b/src/ConsoleApp/Tasks/ListProjectTask.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; diff --git a/src/ConsoleApp/Tasks/QueueBuildTask.cs b/src/ConsoleApp/Tasks/QueueBuildTask.cs index e6237cc..86ba07f 100644 --- a/src/ConsoleApp/Tasks/QueueBuildTask.cs +++ b/src/ConsoleApp/Tasks/QueueBuildTask.cs @@ -1,4 +1,4 @@ -using AlmOps.AzureDevOpsComponent.Domain.Repositories; +using AlmOps.AzureDevOpsComponent.Domain.Repositories; using Microsoft.Extensions.Logging; namespace AlmOps.ConsoleApp.Tasks; diff --git a/src/ConsoleApp/Tasks/ShowBuildTask.cs b/src/ConsoleApp/Tasks/ShowBuildTask.cs index 2122ca0..267d651 100644 --- a/src/ConsoleApp/Tasks/ShowBuildTask.cs +++ b/src/ConsoleApp/Tasks/ShowBuildTask.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Models; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using Microsoft.Extensions.Logging; diff --git a/src/ConsoleApp/Tasks/TaskBase.cs b/src/ConsoleApp/Tasks/TaskBase.cs index 30b7858..27066ed 100644 --- a/src/ConsoleApp/Tasks/TaskBase.cs +++ b/src/ConsoleApp/Tasks/TaskBase.cs @@ -1,4 +1,4 @@ -namespace AlmOps.ConsoleApp.Tasks; +namespace AlmOps.ConsoleApp.Tasks; public abstract class TaskBase : IConsoleTask { diff --git a/src/ConsoleApp/Tasks/UpdateVariableTask.cs b/src/ConsoleApp/Tasks/UpdateVariableTask.cs index 22299c8..44da8ca 100644 --- a/src/ConsoleApp/Tasks/UpdateVariableTask.cs +++ b/src/ConsoleApp/Tasks/UpdateVariableTask.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Threading.Tasks; using AlmOps.AzureDevOpsComponent.Domain.Repositories; using Microsoft.Extensions.Logging; diff --git a/src/GitLabComponent.Infrastructure.RestApi/DependencyInjection/ServiceCollectionExtensions.cs b/src/GitLabComponent.Infrastructure.RestApi/DependencyInjection/ServiceCollectionExtensions.cs index ff76024..cd8346a 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/DependencyInjection/ServiceCollectionExtensions.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/DependencyInjection/ServiceCollectionExtensions.cs @@ -1,4 +1,4 @@ -using System.Net.Http.Headers; +using System.Net.Http.Headers; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; diff --git a/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs b/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs index 93e7b4c..10835e7 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/Dto/AuditEventDto.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text.Json.Serialization; namespace AlmOps.GitLabComponent.Infrastructure.RestApi.Dto; diff --git a/src/GitLabComponent.Infrastructure.RestApi/Dto/DetailsDto.cs b/src/GitLabComponent.Infrastructure.RestApi/Dto/DetailsDto.cs index 1108526..c0a19ed 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/Dto/DetailsDto.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/Dto/DetailsDto.cs @@ -1,4 +1,4 @@ -using System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace AlmOps.GitLabComponent.Infrastructure.RestApi.Dto; diff --git a/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj b/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj index 706f01f..447765d 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj +++ b/src/GitLabComponent.Infrastructure.RestApi/GitLabComponent.Infrastructure.RestApi.csproj @@ -1,4 +1,4 @@ - + net10.0 diff --git a/src/GitLabComponent.Infrastructure.RestApi/GitLabRestApiConfiguration.cs b/src/GitLabComponent.Infrastructure.RestApi/GitLabRestApiConfiguration.cs index 03ba4a0..530833b 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/GitLabRestApiConfiguration.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/GitLabRestApiConfiguration.cs @@ -1,4 +1,4 @@ -namespace AlmOps.GitLabComponent.Infrastructure.RestApi; +namespace AlmOps.GitLabComponent.Infrastructure.RestApi; public class GitLabRestApiConfiguration { diff --git a/src/GitLabComponent.Infrastructure.RestApi/Repositories/AuditEventRepository.cs b/src/GitLabComponent.Infrastructure.RestApi/Repositories/AuditEventRepository.cs index 8ef3aa8..c953afc 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/Repositories/AuditEventRepository.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/Repositories/AuditEventRepository.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using AlmOps.GitLabComponent.Infrastructure.RestApi.Dto; diff --git a/src/GitLabComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs b/src/GitLabComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs index 6ac6f0e..0e5a486 100644 --- a/src/GitLabComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs +++ b/src/GitLabComponent.Infrastructure.RestApi/Repositories/RepositoryBase.cs @@ -1,4 +1,4 @@ -using System.Net.Http; +using System.Net.Http; using AlmOps.Common.Infrastructure.RestApi; using Microsoft.Extensions.Logging; diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs index 3196a77..a73b4d3 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs @@ -1,4 +1,4 @@ -using System; +using System; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.DependencyInjection; using Microsoft.Extensions.DependencyInjection; diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/Sandbox/VariableGroupRepositorySandboxTest.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/Sandbox/VariableGroupRepositorySandboxTest.cs index 5dd4d96..fd9140e 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/Sandbox/VariableGroupRepositorySandboxTest.cs +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.IntegrationTests/Sandbox/VariableGroupRepositorySandboxTest.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Text.Json.Nodes; using System.Threading.Tasks; diff --git a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/DependencyInjection/ServiceCollectionExtensionsTest.cs b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/DependencyInjection/ServiceCollectionExtensionsTest.cs index ffc5fb5..1515fbb 100644 --- a/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/DependencyInjection/ServiceCollectionExtensionsTest.cs +++ b/test/AzureDevOpsComponent.Infrastructure.RestApi.UnitTests/DependencyInjection/ServiceCollectionExtensionsTest.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Net.Http; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.DependencyInjection; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.Mappers; diff --git a/test/ConsoleApp.IntegrationTests/SmokeTest.cs b/test/ConsoleApp.IntegrationTests/SmokeTest.cs index c24d846..6bb11b3 100644 --- a/test/ConsoleApp.IntegrationTests/SmokeTest.cs +++ b/test/ConsoleApp.IntegrationTests/SmokeTest.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Threading.Tasks; using AwesomeAssertions; diff --git a/test/ConsoleApp.UnitTests/Tasks/ConsoleTaskFactoryTest.cs b/test/ConsoleApp.UnitTests/Tasks/ConsoleTaskFactoryTest.cs index 5419d8d..6479938 100644 --- a/test/ConsoleApp.UnitTests/Tasks/ConsoleTaskFactoryTest.cs +++ b/test/ConsoleApp.UnitTests/Tasks/ConsoleTaskFactoryTest.cs @@ -1,4 +1,4 @@ -using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi; +using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi; using AlmOps.AzureDevOpsComponent.Infrastructure.RestApi.DependencyInjection; using AlmOps.ConsoleApp.Tasks; using AwesomeAssertions; diff --git a/test/ConsoleApp.UnitTests/Tasks/TaskBaseTest.cs b/test/ConsoleApp.UnitTests/Tasks/TaskBaseTest.cs index ee3535a..0fa1a82 100644 --- a/test/ConsoleApp.UnitTests/Tasks/TaskBaseTest.cs +++ b/test/ConsoleApp.UnitTests/Tasks/TaskBaseTest.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using AlmOps.ConsoleApp.Tasks; using AwesomeAssertions; diff --git a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/AuditEventRepositoryTest.cs b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/AuditEventRepositoryTest.cs index 5853cd9..84d878b 100644 --- a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/AuditEventRepositoryTest.cs +++ b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/AuditEventRepositoryTest.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using AlmOps.GitLabComponent.Infrastructure.RestApi.Repositories; using AwesomeAssertions; using Microsoft.Extensions.DependencyInjection; diff --git a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/EnvironmentExtensions.cs b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/EnvironmentExtensions.cs index fcfa958..72b18ec 100644 --- a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/EnvironmentExtensions.cs +++ b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/EnvironmentExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace AlmOps.GitLabComponent.Infrastructure.RestApi.IntegrationTests; diff --git a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs index 6eaae19..3f8c2f3 100644 --- a/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs +++ b/test/GitLabComponent.Infrastructure.RestApi.IntegrationTests/RepositoryIntegrationTestBase.cs @@ -1,4 +1,4 @@ -using AlmOps.GitLabComponent.Infrastructure.RestApi.DependencyInjection; +using AlmOps.GitLabComponent.Infrastructure.RestApi.DependencyInjection; using Microsoft.Extensions.DependencyInjection; namespace AlmOps.GitLabComponent.Infrastructure.RestApi.IntegrationTests; From f5837096fba16990810d3c0432c8caa91fdc7125 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Mon, 26 Oct 2026 12:40:33 +0100 Subject: [PATCH 25/34] Use workflow parts 591b0c7, with the scanners installed from checksummed releases, clean image scans, native arm64 builds and a timeout on every job Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yaml | 14 +++++++------- .github/workflows/pkg.yaml | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1c302b3..dfe7c74 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,21 +30,21 @@ permissions: jobs: git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de with: paths: 'src test samples Directory.Build.props Directory.Packages.props *.slnx global.json' version-file: Directory.Build.props - workflow-parts-version: 13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + workflow-parts-version: 591b0c7bfba6fbc7b0cab7d896447e0732b819de markup-lint: name: Markup - uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de code-quality: name: Code needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-code-quality) - uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de with: dotnet-test-args: "--report-xunit-trx --coverage --coverage-output-format cobertura ${{ vars.DOTNET_TEST_EXTRA_ARGS }}" fossa-enabled: ${{ vars.FOSSA_ENABLED != 'false' }} @@ -55,7 +55,7 @@ jobs: sonar-organization: ${{ vars.SONAR_ORG }} sonar-project-key: ${{ vars.SONAR_PROJECT_KEY }} sonar-project-name: AlmOps - workflow-parts-version: 13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + workflow-parts-version: 591b0c7bfba6fbc7b0cab7d896447e0732b819de secrets: fossa-api-key: ${{ secrets.FOSSA_API_KEY }} sonar-token: ${{ secrets.SONAR_TOKEN }} @@ -76,10 +76,10 @@ jobs: name: Image needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-image-scan) - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de with: image-definition: "src/ConsoleApp/Dockerfile" image-name: ${{ vars.CONTAINER_IMAGE_NAME }} image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" - workflow-parts-version: 13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + workflow-parts-version: 591b0c7bfba6fbc7b0cab7d896447e0732b819de diff --git a/.github/workflows/pkg.yaml b/.github/workflows/pkg.yaml index f2fe0e5..7c1201a 100644 --- a/.github/workflows/pkg.yaml +++ b/.github/workflows/pkg.yaml @@ -19,19 +19,19 @@ permissions: jobs: git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de with: paths: 'src Directory.Build.props Directory.Packages.props global.json' version-file: Directory.Build.props - workflow-parts-version: 13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + workflow-parts-version: 591b0c7bfba6fbc7b0cab7d896447e0732b819de # NuGet refuses a version it already holds, so the packages are pushed only when the version changes. version-check: name: Version - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de with: paths: 'Directory.Build.props' - workflow-parts-version: 13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + workflow-parts-version: 591b0c7bfba6fbc7b0cab7d896447e0732b819de package-publication: name: Package / Publication @@ -45,7 +45,7 @@ jobs: with: fetch-depth: 0 - name: Pack & push .NET projects - uses: devpro/github-workflow-parts/actions/dotnet/pack-push@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + uses: devpro/github-workflow-parts/actions/dotnet/pack-push@591b0c7bfba6fbc7b0cab7d896447e0732b819de with: registry-token: ${{ secrets.NUGET_API_KEY }} push-enabled: ${{ github.event_name != 'workflow_dispatch' || inputs.push-enabled }} @@ -57,7 +57,7 @@ jobs: permissions: id-token: write contents: read - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de with: create-latest: ${{ github.ref_name == 'main' }} image-definition: "src/ConsoleApp/Dockerfile" @@ -65,7 +65,7 @@ jobs: image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" image-platform: linux/amd64 - workflow-parts-version: 13ac7ccf4ba593797f8c80a75f2559ce0fc2d09e + workflow-parts-version: 591b0c7bfba6fbc7b0cab7d896447e0732b819de secrets: container-registry-password: ${{ secrets.DOCKERHUB_TOKEN }} container-registry-username: ${{ secrets.DOCKERHUB_USERNAME }} From 1005e1b42a9cf2d1873162af476486b842782fa7 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Mon, 26 Oct 2026 23:42:39 +0100 Subject: [PATCH 26/34] Run the markup lint as the first CI job, so that every repository reports a broken document or workflow in the same place Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011Btfe5mZ8jkmrYUV8dN3Mx --- .github/workflows/ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dfe7c74..40b1307 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,6 +28,10 @@ permissions: contents: read jobs: + markup-lint: + name: Markup + uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de + git-check: name: Git uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de @@ -36,10 +40,6 @@ jobs: version-file: Directory.Build.props workflow-parts-version: 591b0c7bfba6fbc7b0cab7d896447e0732b819de - markup-lint: - name: Markup - uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de - code-quality: name: Code needs: git-check From 0dc761ef8dcba935c60c72273b34b90373b6417b Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Thu, 29 Oct 2026 12:07:00 +0100 Subject: [PATCH 27/34] Use workflow parts bf95c99, which lints shell scripts with ShellCheck, passes a .NET Sonar settings file to the scanner and no longer persists the checkout token Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yaml | 14 +++++++------- .github/workflows/pkg.yaml | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 40b1307..80abe39 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,21 +30,21 @@ permissions: jobs: markup-lint: name: Markup - uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de + uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 with: paths: 'src test samples Directory.Build.props Directory.Packages.props *.slnx global.json' version-file: Directory.Build.props - workflow-parts-version: 591b0c7bfba6fbc7b0cab7d896447e0732b819de + workflow-parts-version: bf95c99bf5b5a0bc2d2991c81975488a16f16142 code-quality: name: Code needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-code-quality) - uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de + uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 with: dotnet-test-args: "--report-xunit-trx --coverage --coverage-output-format cobertura ${{ vars.DOTNET_TEST_EXTRA_ARGS }}" fossa-enabled: ${{ vars.FOSSA_ENABLED != 'false' }} @@ -55,7 +55,7 @@ jobs: sonar-organization: ${{ vars.SONAR_ORG }} sonar-project-key: ${{ vars.SONAR_PROJECT_KEY }} sonar-project-name: AlmOps - workflow-parts-version: 591b0c7bfba6fbc7b0cab7d896447e0732b819de + workflow-parts-version: bf95c99bf5b5a0bc2d2991c81975488a16f16142 secrets: fossa-api-key: ${{ secrets.FOSSA_API_KEY }} sonar-token: ${{ secrets.SONAR_TOKEN }} @@ -76,10 +76,10 @@ jobs: name: Image needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-image-scan) - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 with: image-definition: "src/ConsoleApp/Dockerfile" image-name: ${{ vars.CONTAINER_IMAGE_NAME }} image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" - workflow-parts-version: 591b0c7bfba6fbc7b0cab7d896447e0732b819de + workflow-parts-version: bf95c99bf5b5a0bc2d2991c81975488a16f16142 diff --git a/.github/workflows/pkg.yaml b/.github/workflows/pkg.yaml index 7c1201a..753251d 100644 --- a/.github/workflows/pkg.yaml +++ b/.github/workflows/pkg.yaml @@ -19,19 +19,19 @@ permissions: jobs: git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 with: paths: 'src Directory.Build.props Directory.Packages.props global.json' version-file: Directory.Build.props - workflow-parts-version: 591b0c7bfba6fbc7b0cab7d896447e0732b819de + workflow-parts-version: bf95c99bf5b5a0bc2d2991c81975488a16f16142 # NuGet refuses a version it already holds, so the packages are pushed only when the version changes. version-check: name: Version - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 with: paths: 'Directory.Build.props' - workflow-parts-version: 591b0c7bfba6fbc7b0cab7d896447e0732b819de + workflow-parts-version: bf95c99bf5b5a0bc2d2991c81975488a16f16142 package-publication: name: Package / Publication @@ -45,7 +45,7 @@ jobs: with: fetch-depth: 0 - name: Pack & push .NET projects - uses: devpro/github-workflow-parts/actions/dotnet/pack-push@591b0c7bfba6fbc7b0cab7d896447e0732b819de + uses: devpro/github-workflow-parts/actions/dotnet/pack-push@bf95c99bf5b5a0bc2d2991c81975488a16f16142 with: registry-token: ${{ secrets.NUGET_API_KEY }} push-enabled: ${{ github.event_name != 'workflow_dispatch' || inputs.push-enabled }} @@ -57,7 +57,7 @@ jobs: permissions: id-token: write contents: read - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@591b0c7bfba6fbc7b0cab7d896447e0732b819de + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 with: create-latest: ${{ github.ref_name == 'main' }} image-definition: "src/ConsoleApp/Dockerfile" @@ -65,7 +65,7 @@ jobs: image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" image-platform: linux/amd64 - workflow-parts-version: 591b0c7bfba6fbc7b0cab7d896447e0732b819de + workflow-parts-version: bf95c99bf5b5a0bc2d2991c81975488a16f16142 secrets: container-registry-password: ${{ secrets.DOCKERHUB_TOKEN }} container-registry-username: ${{ secrets.DOCKERHUB_USERNAME }} From 26d7c88687541127f847d846a8187c38be5ef239 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Thu, 29 Oct 2026 15:02:27 +0100 Subject: [PATCH 28/34] Use workflow parts 1711cf6, which resolves the files a shell script sources from its own directory when ShellCheck checks it Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yaml | 14 +++++++------- .github/workflows/pkg.yaml | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 80abe39..804f31b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,21 +30,21 @@ permissions: jobs: markup-lint: name: Markup - uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 + uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@1711cf6d760e89fe43e3673dbd8986e355876cca git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@1711cf6d760e89fe43e3673dbd8986e355876cca with: paths: 'src test samples Directory.Build.props Directory.Packages.props *.slnx global.json' version-file: Directory.Build.props - workflow-parts-version: bf95c99bf5b5a0bc2d2991c81975488a16f16142 + workflow-parts-version: 1711cf6d760e89fe43e3673dbd8986e355876cca code-quality: name: Code needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-code-quality) - uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 + uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@1711cf6d760e89fe43e3673dbd8986e355876cca with: dotnet-test-args: "--report-xunit-trx --coverage --coverage-output-format cobertura ${{ vars.DOTNET_TEST_EXTRA_ARGS }}" fossa-enabled: ${{ vars.FOSSA_ENABLED != 'false' }} @@ -55,7 +55,7 @@ jobs: sonar-organization: ${{ vars.SONAR_ORG }} sonar-project-key: ${{ vars.SONAR_PROJECT_KEY }} sonar-project-name: AlmOps - workflow-parts-version: bf95c99bf5b5a0bc2d2991c81975488a16f16142 + workflow-parts-version: 1711cf6d760e89fe43e3673dbd8986e355876cca secrets: fossa-api-key: ${{ secrets.FOSSA_API_KEY }} sonar-token: ${{ secrets.SONAR_TOKEN }} @@ -76,10 +76,10 @@ jobs: name: Image needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-image-scan) - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@1711cf6d760e89fe43e3673dbd8986e355876cca with: image-definition: "src/ConsoleApp/Dockerfile" image-name: ${{ vars.CONTAINER_IMAGE_NAME }} image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" - workflow-parts-version: bf95c99bf5b5a0bc2d2991c81975488a16f16142 + workflow-parts-version: 1711cf6d760e89fe43e3673dbd8986e355876cca diff --git a/.github/workflows/pkg.yaml b/.github/workflows/pkg.yaml index 753251d..9cfbe43 100644 --- a/.github/workflows/pkg.yaml +++ b/.github/workflows/pkg.yaml @@ -19,19 +19,19 @@ permissions: jobs: git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@1711cf6d760e89fe43e3673dbd8986e355876cca with: paths: 'src Directory.Build.props Directory.Packages.props global.json' version-file: Directory.Build.props - workflow-parts-version: bf95c99bf5b5a0bc2d2991c81975488a16f16142 + workflow-parts-version: 1711cf6d760e89fe43e3673dbd8986e355876cca # NuGet refuses a version it already holds, so the packages are pushed only when the version changes. version-check: name: Version - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@1711cf6d760e89fe43e3673dbd8986e355876cca with: paths: 'Directory.Build.props' - workflow-parts-version: bf95c99bf5b5a0bc2d2991c81975488a16f16142 + workflow-parts-version: 1711cf6d760e89fe43e3673dbd8986e355876cca package-publication: name: Package / Publication @@ -45,7 +45,7 @@ jobs: with: fetch-depth: 0 - name: Pack & push .NET projects - uses: devpro/github-workflow-parts/actions/dotnet/pack-push@bf95c99bf5b5a0bc2d2991c81975488a16f16142 + uses: devpro/github-workflow-parts/actions/dotnet/pack-push@1711cf6d760e89fe43e3673dbd8986e355876cca with: registry-token: ${{ secrets.NUGET_API_KEY }} push-enabled: ${{ github.event_name != 'workflow_dispatch' || inputs.push-enabled }} @@ -57,7 +57,7 @@ jobs: permissions: id-token: write contents: read - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@bf95c99bf5b5a0bc2d2991c81975488a16f16142 + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@1711cf6d760e89fe43e3673dbd8986e355876cca with: create-latest: ${{ github.ref_name == 'main' }} image-definition: "src/ConsoleApp/Dockerfile" @@ -65,7 +65,7 @@ jobs: image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" image-platform: linux/amd64 - workflow-parts-version: bf95c99bf5b5a0bc2d2991c81975488a16f16142 + workflow-parts-version: 1711cf6d760e89fe43e3673dbd8986e355876cca secrets: container-registry-password: ${{ secrets.DOCKERHUB_TOKEN }} container-registry-username: ${{ secrets.DOCKERHUB_USERNAME }} From e32f9f61b4aec4166124be5278c66efbb88b73a9 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Thu, 29 Oct 2026 15:57:30 +0100 Subject: [PATCH 29/34] Use workflow parts 8c856cd, the merged commit of the ShellCheck source resolution, as a branch commit is not kept Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yaml | 14 +++++++------- .github/workflows/pkg.yaml | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 804f31b..c17d827 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,21 +30,21 @@ permissions: jobs: markup-lint: name: Markup - uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@1711cf6d760e89fe43e3673dbd8986e355876cca + uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@1711cf6d760e89fe43e3673dbd8986e355876cca + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 with: paths: 'src test samples Directory.Build.props Directory.Packages.props *.slnx global.json' version-file: Directory.Build.props - workflow-parts-version: 1711cf6d760e89fe43e3673dbd8986e355876cca + workflow-parts-version: 8c856cd16adc8a0ca01c7889a9c7d98ad8593818 code-quality: name: Code needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-code-quality) - uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@1711cf6d760e89fe43e3673dbd8986e355876cca + uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 with: dotnet-test-args: "--report-xunit-trx --coverage --coverage-output-format cobertura ${{ vars.DOTNET_TEST_EXTRA_ARGS }}" fossa-enabled: ${{ vars.FOSSA_ENABLED != 'false' }} @@ -55,7 +55,7 @@ jobs: sonar-organization: ${{ vars.SONAR_ORG }} sonar-project-key: ${{ vars.SONAR_PROJECT_KEY }} sonar-project-name: AlmOps - workflow-parts-version: 1711cf6d760e89fe43e3673dbd8986e355876cca + workflow-parts-version: 8c856cd16adc8a0ca01c7889a9c7d98ad8593818 secrets: fossa-api-key: ${{ secrets.FOSSA_API_KEY }} sonar-token: ${{ secrets.SONAR_TOKEN }} @@ -76,10 +76,10 @@ jobs: name: Image needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-image-scan) - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@1711cf6d760e89fe43e3673dbd8986e355876cca + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 with: image-definition: "src/ConsoleApp/Dockerfile" image-name: ${{ vars.CONTAINER_IMAGE_NAME }} image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" - workflow-parts-version: 1711cf6d760e89fe43e3673dbd8986e355876cca + workflow-parts-version: 8c856cd16adc8a0ca01c7889a9c7d98ad8593818 diff --git a/.github/workflows/pkg.yaml b/.github/workflows/pkg.yaml index 9cfbe43..95b50b5 100644 --- a/.github/workflows/pkg.yaml +++ b/.github/workflows/pkg.yaml @@ -19,19 +19,19 @@ permissions: jobs: git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@1711cf6d760e89fe43e3673dbd8986e355876cca + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 with: paths: 'src Directory.Build.props Directory.Packages.props global.json' version-file: Directory.Build.props - workflow-parts-version: 1711cf6d760e89fe43e3673dbd8986e355876cca + workflow-parts-version: 8c856cd16adc8a0ca01c7889a9c7d98ad8593818 # NuGet refuses a version it already holds, so the packages are pushed only when the version changes. version-check: name: Version - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@1711cf6d760e89fe43e3673dbd8986e355876cca + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 with: paths: 'Directory.Build.props' - workflow-parts-version: 1711cf6d760e89fe43e3673dbd8986e355876cca + workflow-parts-version: 8c856cd16adc8a0ca01c7889a9c7d98ad8593818 package-publication: name: Package / Publication @@ -45,7 +45,7 @@ jobs: with: fetch-depth: 0 - name: Pack & push .NET projects - uses: devpro/github-workflow-parts/actions/dotnet/pack-push@1711cf6d760e89fe43e3673dbd8986e355876cca + uses: devpro/github-workflow-parts/actions/dotnet/pack-push@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 with: registry-token: ${{ secrets.NUGET_API_KEY }} push-enabled: ${{ github.event_name != 'workflow_dispatch' || inputs.push-enabled }} @@ -57,7 +57,7 @@ jobs: permissions: id-token: write contents: read - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@1711cf6d760e89fe43e3673dbd8986e355876cca + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 with: create-latest: ${{ github.ref_name == 'main' }} image-definition: "src/ConsoleApp/Dockerfile" @@ -65,7 +65,7 @@ jobs: image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" image-platform: linux/amd64 - workflow-parts-version: 1711cf6d760e89fe43e3673dbd8986e355876cca + workflow-parts-version: 8c856cd16adc8a0ca01c7889a9c7d98ad8593818 secrets: container-registry-password: ${{ secrets.DOCKERHUB_TOKEN }} container-registry-username: ${{ secrets.DOCKERHUB_USERNAME }} From 998ef71f4babccc0377da03c5ca61ff78eb7b6d1 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Thu, 5 Nov 2026 21:58:37 +0100 Subject: [PATCH 30/34] Use workflow parts 5379b9d, which brings current actions and tools, GoReleaser 2.20.0 fixing GHSA-9422-8p9m-393x among them. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yaml | 14 +++++++------- .github/workflows/pkg.yaml | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c17d827..f7bded3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,21 +30,21 @@ permissions: jobs: markup-lint: name: Markup - uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e with: paths: 'src test samples Directory.Build.props Directory.Packages.props *.slnx global.json' version-file: Directory.Build.props - workflow-parts-version: 8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + workflow-parts-version: 5379b9d0052e3b233ec2e56ba8678e827361b89e code-quality: name: Code needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-code-quality) - uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e with: dotnet-test-args: "--report-xunit-trx --coverage --coverage-output-format cobertura ${{ vars.DOTNET_TEST_EXTRA_ARGS }}" fossa-enabled: ${{ vars.FOSSA_ENABLED != 'false' }} @@ -55,7 +55,7 @@ jobs: sonar-organization: ${{ vars.SONAR_ORG }} sonar-project-key: ${{ vars.SONAR_PROJECT_KEY }} sonar-project-name: AlmOps - workflow-parts-version: 8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + workflow-parts-version: 5379b9d0052e3b233ec2e56ba8678e827361b89e secrets: fossa-api-key: ${{ secrets.FOSSA_API_KEY }} sonar-token: ${{ secrets.SONAR_TOKEN }} @@ -76,10 +76,10 @@ jobs: name: Image needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-image-scan) - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e with: image-definition: "src/ConsoleApp/Dockerfile" image-name: ${{ vars.CONTAINER_IMAGE_NAME }} image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" - workflow-parts-version: 8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + workflow-parts-version: 5379b9d0052e3b233ec2e56ba8678e827361b89e diff --git a/.github/workflows/pkg.yaml b/.github/workflows/pkg.yaml index 95b50b5..a8eff29 100644 --- a/.github/workflows/pkg.yaml +++ b/.github/workflows/pkg.yaml @@ -19,19 +19,19 @@ permissions: jobs: git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e with: paths: 'src Directory.Build.props Directory.Packages.props global.json' version-file: Directory.Build.props - workflow-parts-version: 8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + workflow-parts-version: 5379b9d0052e3b233ec2e56ba8678e827361b89e # NuGet refuses a version it already holds, so the packages are pushed only when the version changes. version-check: name: Version - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e with: paths: 'Directory.Build.props' - workflow-parts-version: 8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + workflow-parts-version: 5379b9d0052e3b233ec2e56ba8678e827361b89e package-publication: name: Package / Publication @@ -45,7 +45,7 @@ jobs: with: fetch-depth: 0 - name: Pack & push .NET projects - uses: devpro/github-workflow-parts/actions/dotnet/pack-push@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + uses: devpro/github-workflow-parts/actions/dotnet/pack-push@5379b9d0052e3b233ec2e56ba8678e827361b89e with: registry-token: ${{ secrets.NUGET_API_KEY }} push-enabled: ${{ github.event_name != 'workflow_dispatch' || inputs.push-enabled }} @@ -57,7 +57,7 @@ jobs: permissions: id-token: write contents: read - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e with: create-latest: ${{ github.ref_name == 'main' }} image-definition: "src/ConsoleApp/Dockerfile" @@ -65,7 +65,7 @@ jobs: image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" image-platform: linux/amd64 - workflow-parts-version: 8c856cd16adc8a0ca01c7889a9c7d98ad8593818 + workflow-parts-version: 5379b9d0052e3b233ec2e56ba8678e827361b89e secrets: container-registry-password: ${{ secrets.DOCKERHUB_TOKEN }} container-registry-username: ${{ secrets.DOCKERHUB_USERNAME }} From 9ee0c29a903cf17f0a853f1014fa42d50ffc1f6b Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Thu, 5 Nov 2026 22:24:58 +0100 Subject: [PATCH 31/34] Build the image on .NET 10.0.14, which fixes the Brotli decoder out-of-bounds write GHSA-p3jp-9v83-76w9. Co-Authored-By: Claude Opus 5.5 --- src/ConsoleApp/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ConsoleApp/Dockerfile b/src/ConsoleApp/Dockerfile index 6fb147a..67627b7 100644 --- a/src/ConsoleApp/Dockerfile +++ b/src/ConsoleApp/Dockerfile @@ -1,10 +1,10 @@ # syntax=docker/dockerfile:1 -FROM registry.suse.com/bci/dotnet-aspnet:10.0.13 AS base +FROM registry.suse.com/bci/dotnet-aspnet:10.0.14 AS base USER $APP_UID WORKDIR /app -FROM registry.suse.com/bci/dotnet-sdk:10.0.13 AS build +FROM registry.suse.com/bci/dotnet-sdk:10.0.14 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ./Directory.*.props . From 2f98bd723af69aa9f72ab90973071860abe01348 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Thu, 5 Nov 2026 23:11:40 +0100 Subject: [PATCH 32/34] Update curl and brotli in the image, as the latest SUSE base image still lacks SUSE-SU-2026:5068-1 and SUSE-SU-2026:4945-1, with a comment saying when to remove it. Co-Authored-By: Claude Opus 5.5 --- src/ConsoleApp/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ConsoleApp/Dockerfile b/src/ConsoleApp/Dockerfile index 67627b7..3ee9ac6 100644 --- a/src/ConsoleApp/Dockerfile +++ b/src/ConsoleApp/Dockerfile @@ -1,6 +1,8 @@ # syntax=docker/dockerfile:1 FROM registry.suse.com/bci/dotnet-aspnet:10.0.14 AS base +# The latest base image lags SUSE-SU-2026:5068-1 (curl) and SUSE-SU-2026:4945-1 (brotli): remove this update once a rebuilt base image scans clean. +RUN zypper -n up curl libcurl4 libbrotlicommon1 libbrotlidec1 && zypper -n clean --all USER $APP_UID WORKDIR /app From 568c971faf0abd5f6cc6f1c2cca0b3f3f9adb625 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Thu, 12 Nov 2026 22:41:45 +0100 Subject: [PATCH 33/34] Leave the advisories of the 10.0.14 BCI base image out of the image scan until 2026-11-19, while SUSE publishes 10.0.15 and a rebuild with the curl and brotli fixes Co-Authored-By: Claude Opus 5.5 --- .trivyignore.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .trivyignore.yaml diff --git a/.trivyignore.yaml b/.trivyignore.yaml new file mode 100644 index 0000000..ba3594a --- /dev/null +++ b/.trivyignore.yaml @@ -0,0 +1,20 @@ +# Vulnerabilities left out of the image scan, each until the day it counts again. + +vulnerabilities: + # The fix is the 10.0.15 runtime, which registry.suse.com/bci/dotnet-aspnet does not publish yet. + - id: CVE-2026-114146 + statement: ASP.NET Core 10.0.14 runtime of the BCI base image, fixed in 10.0.15, not yet published by SUSE + expired_at: 2026-11-19 + - id: CVE-2026-114147 + statement: ASP.NET Core 10.0.14 runtime of the BCI base image, fixed in 10.0.15, not yet published by SUSE + expired_at: 2026-11-19 + - id: CVE-2026-114149 + statement: ASP.NET Core 10.0.14 runtime of the BCI base image, fixed in 10.0.15, not yet published by SUSE + expired_at: 2026-11-19 + # The fixed packages reach the image only through a rebuild of the BCI base image. + - id: SUSE-SU-2026:5068-1 + statement: curl and libcurl4 of the BCI base image, fixed upstream, not yet in a rebuilt image + expired_at: 2026-11-19 + - id: SUSE-SU-2026:4945-1 + statement: brotli of the BCI base image, fixed upstream, not yet in a rebuilt image + expired_at: 2026-11-19 From ceb119a3834acb8f449676f32dfc583eb9d52999 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Thu, 19 Nov 2026 00:53:48 +0100 Subject: [PATCH 34/34] Update pipelines --- .github/workflows/ci.yaml | 14 +++++++------- .github/workflows/pkg.yaml | 14 +++++++------- .istarci.yml | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f7bded3..8544e4c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,21 +30,21 @@ permissions: jobs: markup-lint: name: Markup - uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e + uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@398cf79719f90e41e3407bc9f060e297629d800d git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@398cf79719f90e41e3407bc9f060e297629d800d with: paths: 'src test samples Directory.Build.props Directory.Packages.props *.slnx global.json' version-file: Directory.Build.props - workflow-parts-version: 5379b9d0052e3b233ec2e56ba8678e827361b89e + workflow-parts-version: 398cf79719f90e41e3407bc9f060e297629d800d code-quality: name: Code needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-code-quality) - uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e + uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@398cf79719f90e41e3407bc9f060e297629d800d with: dotnet-test-args: "--report-xunit-trx --coverage --coverage-output-format cobertura ${{ vars.DOTNET_TEST_EXTRA_ARGS }}" fossa-enabled: ${{ vars.FOSSA_ENABLED != 'false' }} @@ -55,7 +55,7 @@ jobs: sonar-organization: ${{ vars.SONAR_ORG }} sonar-project-key: ${{ vars.SONAR_PROJECT_KEY }} sonar-project-name: AlmOps - workflow-parts-version: 5379b9d0052e3b233ec2e56ba8678e827361b89e + workflow-parts-version: 398cf79719f90e41e3407bc9f060e297629d800d secrets: fossa-api-key: ${{ secrets.FOSSA_API_KEY }} sonar-token: ${{ secrets.SONAR_TOKEN }} @@ -76,10 +76,10 @@ jobs: name: Image needs: git-check if: needs.git-check.outputs.changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-image-scan) - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@398cf79719f90e41e3407bc9f060e297629d800d with: image-definition: "src/ConsoleApp/Dockerfile" image-name: ${{ vars.CONTAINER_IMAGE_NAME }} image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" - workflow-parts-version: 5379b9d0052e3b233ec2e56ba8678e827361b89e + workflow-parts-version: 398cf79719f90e41e3407bc9f060e297629d800d diff --git a/.github/workflows/pkg.yaml b/.github/workflows/pkg.yaml index a8eff29..b57160d 100644 --- a/.github/workflows/pkg.yaml +++ b/.github/workflows/pkg.yaml @@ -19,19 +19,19 @@ permissions: jobs: git-check: name: Git - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@398cf79719f90e41e3407bc9f060e297629d800d with: paths: 'src Directory.Build.props Directory.Packages.props global.json' version-file: Directory.Build.props - workflow-parts-version: 5379b9d0052e3b233ec2e56ba8678e827361b89e + workflow-parts-version: 398cf79719f90e41e3407bc9f060e297629d800d # NuGet refuses a version it already holds, so the packages are pushed only when the version changes. version-check: name: Version - uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e + uses: devpro/github-workflow-parts/.github/workflows/reusable-git-check.yml@398cf79719f90e41e3407bc9f060e297629d800d with: paths: 'Directory.Build.props' - workflow-parts-version: 5379b9d0052e3b233ec2e56ba8678e827361b89e + workflow-parts-version: 398cf79719f90e41e3407bc9f060e297629d800d package-publication: name: Package / Publication @@ -45,7 +45,7 @@ jobs: with: fetch-depth: 0 - name: Pack & push .NET projects - uses: devpro/github-workflow-parts/actions/dotnet/pack-push@5379b9d0052e3b233ec2e56ba8678e827361b89e + uses: devpro/github-workflow-parts/actions/dotnet/pack-push@398cf79719f90e41e3407bc9f060e297629d800d with: registry-token: ${{ secrets.NUGET_API_KEY }} push-enabled: ${{ github.event_name != 'workflow_dispatch' || inputs.push-enabled }} @@ -57,7 +57,7 @@ jobs: permissions: id-token: write contents: read - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@5379b9d0052e3b233ec2e56ba8678e827361b89e + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@398cf79719f90e41e3407bc9f060e297629d800d with: create-latest: ${{ github.ref_name == 'main' }} image-definition: "src/ConsoleApp/Dockerfile" @@ -65,7 +65,7 @@ jobs: image-path: ${{ vars.CONTAINER_REGISTRY_PATH }} image-tag: "${{ needs.git-check.outputs.version-major-minor }}.${{ github.run_id }}" image-platform: linux/amd64 - workflow-parts-version: 5379b9d0052e3b233ec2e56ba8678e827361b89e + workflow-parts-version: 398cf79719f90e41e3407bc9f060e297629d800d secrets: container-registry-password: ${{ secrets.DOCKERHUB_TOKEN }} container-registry-username: ${{ secrets.DOCKERHUB_USERNAME }} diff --git a/.istarci.yml b/.istarci.yml index ae36ac9..b7fb19b 100644 --- a/.istarci.yml +++ b/.istarci.yml @@ -3,9 +3,9 @@ runner: image: ghcr.io/devpro/ubuntu-dotnet:latest images: - "git-check*": ghcr.io/devpro/debian-node:latest - "markup-lint*": ghcr.io/devpro/debian-node:latest - "image-scan*": ghcr.io/devpro/debian-node:latest + "git-check*": ghcr.io/devpro/ubuntu-node:latest + "markup-lint*": ghcr.io/devpro/ubuntu-node:latest + "image-scan*": ghcr.io/devpro/ubuntu-node:latest # The scan job builds an image and scans it through the host Docker daemon. docker: ["image-scan*"] # The analysis runs against the SonarQube IstarCI starts on this machine, with a token made there.