From 8dcf9a79a851c67b5b4decaae0a5b00531cfc104 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 14:31:07 +0200 Subject: [PATCH 01/32] sonarcloud configuration ci --- CHANGELOG.md | 1 + azure-pipelines/build/build-auth.yml | 2 + azure-pipelines/build/build-consumer.yml | 1 + azure-pipelines/build/build-sender.yml | 1 + .../templates/docker-build-push-jobs.yml | 43 +++++++++++++------ 5 files changed, 34 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4d890d..c2a0933 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec - Add dotnet install step to CI/CD - Upgrade .NET version to 10 - Organize ports for apps, containers, services +- Run sonar scan only on auth service CI, skip other services ## [1.0.0] - 18-Apr-2026 diff --git a/azure-pipelines/build/build-auth.yml b/azure-pipelines/build/build-auth.yml index a2bddb1..919db35 100644 --- a/azure-pipelines/build/build-auth.yml +++ b/azure-pipelines/build/build-auth.yml @@ -39,4 +39,6 @@ stages: shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' + sonarCloudEnabled: true + sonarCloudServiceConnection: 'SonarCloud_Service_Connection' workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' diff --git a/azure-pipelines/build/build-consumer.yml b/azure-pipelines/build/build-consumer.yml index 1cb23e1..13e7cbe 100644 --- a/azure-pipelines/build/build-consumer.yml +++ b/azure-pipelines/build/build-consumer.yml @@ -39,4 +39,5 @@ stages: shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' + sonarCloudEnabled: false workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' diff --git a/azure-pipelines/build/build-sender.yml b/azure-pipelines/build/build-sender.yml index b5f5490..c4754e7 100644 --- a/azure-pipelines/build/build-sender.yml +++ b/azure-pipelines/build/build-sender.yml @@ -39,4 +39,5 @@ stages: shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' + sonarCloudEnabled: false workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' diff --git a/azure-pipelines/templates/docker-build-push-jobs.yml b/azure-pipelines/templates/docker-build-push-jobs.yml index 0de6f06..a361e84 100644 --- a/azure-pipelines/templates/docker-build-push-jobs.yml +++ b/azure-pipelines/templates/docker-build-push-jobs.yml @@ -81,6 +81,14 @@ parameters: type: string default: '10.x' + - name: sonarCloudEnabled + type: boolean + default: false + + - name: sonarCloudServiceConnection + type: string + default: SonarCloud_Service_Connection + jobs: - job: ${{ parameters.JobName }} displayName: ${{ parameters.JobName }} @@ -117,19 +125,17 @@ jobs: Write-Host "FullSemVer: $(version_step.FullSemVer)" Write-Host "SemVer: $(version_step.SemVer)" Write-Host "ShortSha: $(version_step.ShortSha)" - - Write-Host "=== PIPELINE VARIABLES ===" Write-Host "Build Source branch: $env:BUILD_SOURCEBRANCHNAME" displayName: Debug environment - - task: PowerShell@2 - displayName: 'Debug branch condition' - condition: ne(variables['Build.SourceBranchName'], 'main') - inputs: - targetType: 'inline' - script: | - Write-Host "Running because branch is NOT main" - Write-Host "Branch: $env:BUILD_SOURCEBRANCHNAME" + # - task: PowerShell@2 + # displayName: 'Debug branch condition' + # condition: ne(variables['Build.SourceBranchName'], 'main') + # inputs: + # targetType: 'inline' + # script: | + # Write-Host "Running because branch is NOT main" + # Write-Host "Branch: $env:BUILD_SOURCEBRANCHNAME" - task: DotNetCoreCLI@2 displayName: 'Dotnet restore' @@ -140,9 +146,12 @@ jobs: nugetConfigPath: 'nuget.config' - task: SonarCloudPrepare@4 - condition: eq(variables['Build.SourceBranchName'], 'main') + condition: and( + succeeded(), + ${{ parameters.sonarCloudEnabled }}, + eq(variables['Build.SourceBranchName'], 'main')) inputs: - SonarCloud: SonarCloud_Service_Connection + SonarCloud: ${{ parameters.sonarCloudServiceConnection }} organization: event-triangle scannerMode: dotnet projectKey: event-triangle-api @@ -160,11 +169,17 @@ jobs: arguments: '-c ${{ parameters.buildConfiguration }} -p:Version=$(version_step.semVer) --no-restore' - task: SonarCloudAnalyze@4 - condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'main')) + condition: and( + succeeded(), + ${{ parameters.sonarCloudEnabled }}, + eq(variables['Build.SourceBranchName'], 'main')) inputs: {} - task: SonarCloudPublish@4 - condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'main')) + condition: and( + succeeded(), + ${{ parameters.sonarCloudEnabled }}, + eq(variables['Build.SourceBranchName'], 'main')) inputs: pollingTimeoutSec: "300" From 7891fb6d256eba63c3795f41faf8dc010c3b9dc7 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 15:28:48 +0200 Subject: [PATCH 02/32] update triggers for pr --- .../pr-validation/pr-validation-auth.yml | 42 +++++++++++++---- .../pr-validation/pr-validation-consumer.yml | 46 ++++++++++++++----- .../pr-validation/pr-validation-sender.yml | 46 ++++++++++++++----- 3 files changed, 102 insertions(+), 32 deletions(-) diff --git a/azure-pipelines/pr-validation/pr-validation-auth.yml b/azure-pipelines/pr-validation/pr-validation-auth.yml index b76d17d..266468c 100644 --- a/azure-pipelines/pr-validation/pr-validation-auth.yml +++ b/azure-pipelines/pr-validation/pr-validation-auth.yml @@ -5,16 +5,42 @@ pr: include: - develop - main + paths: include: - - azure-pipelines - - platform - - helm - - cloudflare - - src/authorization/EventTriangleAPI.Authorization.BusinessLogic - - src/authorization/EventTriangleAPI.Authorization.Presentation - - src/shared/EventTriangleAPI.Shared.Application - - src/shared/EventTriangleAPI.Shared.DTO + # Auth service (ALL layers) + - src/authorization/** + + # Shared code used by auth + - src/shared/** + + # Pipeline itself (so changes validate) + - azure-pipelines/** + - azure-pipelines/templates/** + + exclude: + # Docs + - '**/*.md' + + # Docker compose (global/dev only) + - '**/docker-compose*.yml' + - '**/docker-compose*.yaml' + + # Ignore other services explicitly + - src/consumer/** + - src/sender/** + + # Helm & infra (unless auth-specific) + - helm/** + - platform/** + - cloudflare/** + - docs/** + - kubernetes/** + - img/** + - terraform/** + - terraform-azdo-libraries/** + - .github/** + - LICENSE variables: - name: appName diff --git a/azure-pipelines/pr-validation/pr-validation-consumer.yml b/azure-pipelines/pr-validation/pr-validation-consumer.yml index 162df5d..abfc268 100644 --- a/azure-pipelines/pr-validation/pr-validation-consumer.yml +++ b/azure-pipelines/pr-validation/pr-validation-consumer.yml @@ -5,20 +5,42 @@ pr: include: - develop - main + paths: include: - - azure-pipelines - - platform - - helm - - cloudflare - - src/consumer/EventTriangleAPI.Consumer.Application - - src/consumer/EventTriangleAPI.Consumer.BusinessLogic - - src/consumer/EventTriangleAPI.Consumer.Domain - - src/consumer/EventTriangleAPI.Consumer.Presentation - - src/consumer/EventTriangleAPI.Consumer.IntegrationTests - - src/consumer/EventTriangleAPI.Consumer.UnitTests - - src/shared/EventTriangleAPI.Shared.Application - - src/shared/EventTriangleAPI.Shared.DTO + # Consumer service (ALL layers) + - src/consumer/** + + # Shared code used by auth + - src/shared/** + + # Pipeline itself (so changes validate) + - azure-pipelines/** + - azure-pipelines/templates/** + + exclude: + # Docs + - '**/*.md' + + # Docker compose (global/dev only) + - '**/docker-compose*.yml' + - '**/docker-compose*.yaml' + + # Ignore other services explicitly + - src/authorization/** + - src/sender/** + + # Helm & infra (unless auth-specific) + - helm/** + - platform/** + - cloudflare/** + - docs/** + - kubernetes/** + - img/** + - terraform/** + - terraform-azdo-libraries/** + - .github/** + - LICENSE variables: - name: appName diff --git a/azure-pipelines/pr-validation/pr-validation-sender.yml b/azure-pipelines/pr-validation/pr-validation-sender.yml index f567d09..81ad310 100644 --- a/azure-pipelines/pr-validation/pr-validation-sender.yml +++ b/azure-pipelines/pr-validation/pr-validation-sender.yml @@ -5,20 +5,42 @@ pr: include: - develop - main + paths: include: - - azure-pipelines - - platform - - helm - - cloudflare - - src/sender/EventTriangleAPI.Sender.Application - - src/sender/EventTriangleAPI.Sender.BusinessLogic - - src/sender/EventTriangleAPI.Sender.Domain - - src/sender/EventTriangleAPI.Sender.Presentation - - src/sender/EventTriangleAPI.Sender.IntegrationTests - - src/sender/EventTriangleAPI.Sender.UnitTests - - src/shared/EventTriangleAPI.Shared.Application - - src/shared/EventTriangleAPI.Shared.DTO + # Sender service (ALL layers) + - src/sender/** + + # Shared code used by auth + - src/shared/** + + # Pipeline itself (so changes validate) + - azure-pipelines/** + - azure-pipelines/templates/** + + exclude: + # Docs + - '**/*.md' + + # Docker compose (global/dev only) + - '**/docker-compose*.yml' + - '**/docker-compose*.yaml' + + # Ignore other services explicitly + - src/consumer/** + - src/authorization/** + + # Helm & infra (unless auth-specific) + - helm/** + - platform/** + - cloudflare/** + - docs/** + - kubernetes/** + - img/** + - terraform/** + - terraform-azdo-libraries/** + - .github/** + - LICENSE variables: - name: appName From 0a7c1136f32060fbd2d69c1ee7f9fb19fcef06fd Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 15:30:37 +0200 Subject: [PATCH 03/32] enable auto cancel --- azure-pipelines/pr-validation/pr-validation-auth.yml | 1 + azure-pipelines/pr-validation/pr-validation-consumer.yml | 1 + azure-pipelines/pr-validation/pr-validation-sender.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/azure-pipelines/pr-validation/pr-validation-auth.yml b/azure-pipelines/pr-validation/pr-validation-auth.yml index 266468c..414a34b 100644 --- a/azure-pipelines/pr-validation/pr-validation-auth.yml +++ b/azure-pipelines/pr-validation/pr-validation-auth.yml @@ -1,6 +1,7 @@ trigger: none pr: + autoCancel: true branches: include: - develop diff --git a/azure-pipelines/pr-validation/pr-validation-consumer.yml b/azure-pipelines/pr-validation/pr-validation-consumer.yml index abfc268..61488c8 100644 --- a/azure-pipelines/pr-validation/pr-validation-consumer.yml +++ b/azure-pipelines/pr-validation/pr-validation-consumer.yml @@ -1,6 +1,7 @@ trigger: none pr: + autoCancel: true branches: include: - develop diff --git a/azure-pipelines/pr-validation/pr-validation-sender.yml b/azure-pipelines/pr-validation/pr-validation-sender.yml index 81ad310..d229691 100644 --- a/azure-pipelines/pr-validation/pr-validation-sender.yml +++ b/azure-pipelines/pr-validation/pr-validation-sender.yml @@ -1,6 +1,7 @@ trigger: none pr: + autoCancel: true branches: include: - develop From 0f4e3470cbfb81dcd597b4e406276cde5624e784 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 15:32:03 +0200 Subject: [PATCH 04/32] encoding --- azure-pipelines/pr-validation/pr-validation-auth.yml | 2 +- azure-pipelines/pr-validation/pr-validation-consumer.yml | 2 +- azure-pipelines/pr-validation/pr-validation-sender.yml | 2 +- .../EventTriangleAPI.Authorization.IntegrationTests.csproj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/pr-validation/pr-validation-auth.yml b/azure-pipelines/pr-validation/pr-validation-auth.yml index 414a34b..c5cbdc6 100644 --- a/azure-pipelines/pr-validation/pr-validation-auth.yml +++ b/azure-pipelines/pr-validation/pr-validation-auth.yml @@ -1,7 +1,7 @@ trigger: none pr: - autoCancel: true + autoCancel: true branches: include: - develop diff --git a/azure-pipelines/pr-validation/pr-validation-consumer.yml b/azure-pipelines/pr-validation/pr-validation-consumer.yml index 61488c8..8ee15c5 100644 --- a/azure-pipelines/pr-validation/pr-validation-consumer.yml +++ b/azure-pipelines/pr-validation/pr-validation-consumer.yml @@ -1,7 +1,7 @@ trigger: none pr: - autoCancel: true + autoCancel: true branches: include: - develop diff --git a/azure-pipelines/pr-validation/pr-validation-sender.yml b/azure-pipelines/pr-validation/pr-validation-sender.yml index d229691..ca32be6 100644 --- a/azure-pipelines/pr-validation/pr-validation-sender.yml +++ b/azure-pipelines/pr-validation/pr-validation-sender.yml @@ -1,7 +1,7 @@ trigger: none pr: - autoCancel: true + autoCancel: true branches: include: - develop diff --git a/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj b/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj index 98746e5..8f5a19c 100644 --- a/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj +++ b/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj @@ -1,4 +1,4 @@ - + net10.0 From 5a7d1263eded4439335bfed692f17e0847ae9b8b Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 15:59:36 +0200 Subject: [PATCH 05/32] add docker ignore --- .dockerignore | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..14b4d08 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,18 @@ +**/bin +**/obj +**/node_modules +.git +.vscode +*.md +docker-compose*.yml +helm/ +platform/ +terraform/ +.github/ +azure-pipelines/ +img/ +scripts/ +terraform-azdo-libraries +docs/ +cloudflare/ +kubernetes/ From d5773b3430748e92480856760fe8ea769f212a87 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 16:10:47 +0200 Subject: [PATCH 06/32] optimize docker file --- src/authorization/Dockerfile | 38 ++++++++++++++++--- .../EventTriangle.Client/package.json | 2 +- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/authorization/Dockerfile b/src/authorization/Dockerfile index ac2cf3e..e2898b2 100644 --- a/src/authorization/Dockerfile +++ b/src/authorization/Dockerfile @@ -1,40 +1,68 @@ FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base -WORKDIR /app -EXPOSE 8080 +WORKDIR /app ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true +EXPOSE 8080 + FROM node:18.15.0-alpine AS angularBuild + WORKDIR /angular + COPY ["authorization/EventTriangle.Client/package.json", "EventTriangle.Client/"] + COPY ["authorization/EventTriangle.Client/package-lock.json", "EventTriangle.Client/"] + WORKDIR "EventTriangle.Client" + RUN npm ci + WORKDIR /angular + COPY ["authorization/EventTriangle.Client", "EventTriangle.Client/"] -RUN npm install -g @angular/cli@15.2.7 + +#RUN npm install -g @angular/cli@15.2.7 + WORKDIR "EventTriangle.Client" + ARG FRONT_API_URL + RUN sed -i "s|https://localhost:7000/|$FRONT_API_URL|" ./src/assets/config/config.json + RUN ng build --output-path "dist/client" FROM mcr.microsoft.com/dotnet/sdk:10.0 AS publish + WORKDIR /src + COPY ["authorization/EventTriangleAPI.Authorization.BusinessLogic/EventTriangleAPI.Authorization.BusinessLogic.csproj", "authorization/EventTriangleAPI.Authorization.BusinessLogic/"] COPY ["authorization/EventTriangleAPI.Authorization.Domain/EventTriangleAPI.Authorization.Domain.csproj", "authorization/EventTriangleAPI.Authorization.Domain/"] COPY ["authorization/EventTriangleAPI.Authorization.Persistence/EventTriangleAPI.Authorization.Persistence.csproj", "authorization/EventTriangleAPI.Authorization.Persistence/"] COPY ["authorization/EventTriangleAPI.Authorization.Presentation/EventTriangleAPI.Authorization.Presentation.csproj", "authorization/EventTriangleAPI.Authorization.Presentation/"] -COPY ["authorization/EventTriangleAPI.Authorization.UnitTests/EventTriangleAPI.Authorization.UnitTests.csproj", "authorization/EventTriangleAPI.Authorization.UnitTests/"] COPY ["shared/EventTriangleAPI.Shared.Application/EventTriangleAPI.Shared.Application.csproj", "shared/EventTriangleAPI.Shared.Application/"] COPY ["shared/EventTriangleAPI.Shared.DTO/EventTriangleAPI.Shared.DTO.csproj", "shared/EventTriangleAPI.Shared.DTO/"] + RUN dotnet restore "authorization/EventTriangleAPI.Authorization.Presentation/EventTriangleAPI.Authorization.Presentation.csproj" + COPY . . + WORKDIR "authorization/EventTriangleAPI.Authorization.Presentation" + ARG VERSION -RUN dotnet publish "EventTriangleAPI.Authorization.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false --no-cache + +RUN dotnet publish "EventTriangleAPI.Authorization.Presentation.csproj" \ + -c Release \ + -p:Version=$VERSION \ + -o /app/publish \ + /p:UseAppHost=false \ + /p:PublishTrimmed=true \ + /p:TieredCompilation=false FROM base AS final WORKDIR /app + COPY --from=publish /app/publish . + COPY --from=angularBuild "/angular/EventTriangle.Client/dist/client" wwwroot + ENTRYPOINT ["dotnet", "EventTriangleAPI.Authorization.Presentation.dll"] diff --git a/src/authorization/EventTriangle.Client/package.json b/src/authorization/EventTriangle.Client/package.json index 1794bfe..86007d4 100644 --- a/src/authorization/EventTriangle.Client/package.json +++ b/src/authorization/EventTriangle.Client/package.json @@ -29,7 +29,7 @@ }, "devDependencies": { "@angular-devkit/build-angular": "^15.2.5", - "@angular/cli": "~15.2.5", + "@angular/cli": "~15.2.7", "@angular/compiler-cli": "^15.2.0", "@types/jasmine": "~4.3.0", "jasmine-core": "~4.5.0", From 0e1527af7dc115046e414d5d459d64853db94e5a Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 16:14:23 +0200 Subject: [PATCH 07/32] fix docker file --- src/authorization/Dockerfile | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/authorization/Dockerfile b/src/authorization/Dockerfile index e2898b2..e8c3b89 100644 --- a/src/authorization/Dockerfile +++ b/src/authorization/Dockerfile @@ -21,8 +21,6 @@ WORKDIR /angular COPY ["authorization/EventTriangle.Client", "EventTriangle.Client/"] -#RUN npm install -g @angular/cli@15.2.7 - WORKDIR "EventTriangle.Client" ARG FRONT_API_URL @@ -50,13 +48,7 @@ WORKDIR "authorization/EventTriangleAPI.Authorization.Presentation" ARG VERSION -RUN dotnet publish "EventTriangleAPI.Authorization.Presentation.csproj" \ - -c Release \ - -p:Version=$VERSION \ - -o /app/publish \ - /p:UseAppHost=false \ - /p:PublishTrimmed=true \ - /p:TieredCompilation=false +RUN dotnet publish "EventTriangleAPI.Authorization.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app From 4470513867fd06f5fc8e936c074150e8d26692e5 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 16:17:04 +0200 Subject: [PATCH 08/32] add conditions --- azure-pipelines/templates/docker-build-push-jobs.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/azure-pipelines/templates/docker-build-push-jobs.yml b/azure-pipelines/templates/docker-build-push-jobs.yml index a361e84..05c73d9 100644 --- a/azure-pipelines/templates/docker-build-push-jobs.yml +++ b/azure-pipelines/templates/docker-build-push-jobs.yml @@ -98,21 +98,25 @@ jobs: - task: UseDotNet@2 displayName: 'Install .NET SDK ${{ parameters.dotnetSdkVersion }}' + condition: succeeded() inputs: packageType: 'sdk' version: '${{ parameters.dotnetSdkVersion }}' - task: gitversion-setup@4.5.0 displayName: 'GitVersion Setup' + condition: succeeded() inputs: versionSpec: ${{ parameters.gitVersionVersion }} - task: gitversion-execute@4.5.0 name: version_step # step id used as a reference for output values displayName: Determine Version + condition: succeeded() - bash: echo $Action$BuildVersion displayName: 'Set Build Version' + condition: succeeded() env: Action: '##vso[build.updatebuildnumber]' BuildVersion: $(version_step.semVer) @@ -127,6 +131,7 @@ jobs: Write-Host "ShortSha: $(version_step.ShortSha)" Write-Host "Build Source branch: $env:BUILD_SOURCEBRANCHNAME" displayName: Debug environment + condition: succeeded() # - task: PowerShell@2 # displayName: 'Debug branch condition' @@ -139,6 +144,7 @@ jobs: - task: DotNetCoreCLI@2 displayName: 'Dotnet restore' + condition: succeeded() inputs: command: 'restore' projects: '${{ parameters.solution }}' @@ -163,6 +169,7 @@ jobs: - task: DotNetCoreCLI@2 displayName: 'Build solution' + condition: succeeded() inputs: command: 'build' projects: '${{ parameters.solution }}' @@ -201,6 +208,7 @@ jobs: - task: PowerShell@2 displayName: 'Build Docker Image' + condition: succeeded() inputs: targetType: 'filePath' filePath: '$(System.DefaultWorkingDirectory)/scripts/Build-Docker.ps1' @@ -217,6 +225,7 @@ jobs: - task: Docker@2 displayName: 'Push to DockerHub' + condition: succeeded() inputs: command: push containerRegistry: ${{ parameters.dockerServiceConnection }} From 11928e85f54a2fca5ae59bebbd84396aeb79384e Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 16:22:08 +0200 Subject: [PATCH 09/32] roll back docker file --- src/authorization/Dockerfile | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/src/authorization/Dockerfile b/src/authorization/Dockerfile index e8c3b89..ac2cf3e 100644 --- a/src/authorization/Dockerfile +++ b/src/authorization/Dockerfile @@ -1,60 +1,40 @@ FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base - WORKDIR /app -ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true - EXPOSE 8080 -FROM node:18.15.0-alpine AS angularBuild +ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true +FROM node:18.15.0-alpine AS angularBuild WORKDIR /angular - COPY ["authorization/EventTriangle.Client/package.json", "EventTriangle.Client/"] - COPY ["authorization/EventTriangle.Client/package-lock.json", "EventTriangle.Client/"] - WORKDIR "EventTriangle.Client" - RUN npm ci - WORKDIR /angular - COPY ["authorization/EventTriangle.Client", "EventTriangle.Client/"] - +RUN npm install -g @angular/cli@15.2.7 WORKDIR "EventTriangle.Client" - ARG FRONT_API_URL - RUN sed -i "s|https://localhost:7000/|$FRONT_API_URL|" ./src/assets/config/config.json - RUN ng build --output-path "dist/client" FROM mcr.microsoft.com/dotnet/sdk:10.0 AS publish - WORKDIR /src - COPY ["authorization/EventTriangleAPI.Authorization.BusinessLogic/EventTriangleAPI.Authorization.BusinessLogic.csproj", "authorization/EventTriangleAPI.Authorization.BusinessLogic/"] COPY ["authorization/EventTriangleAPI.Authorization.Domain/EventTriangleAPI.Authorization.Domain.csproj", "authorization/EventTriangleAPI.Authorization.Domain/"] COPY ["authorization/EventTriangleAPI.Authorization.Persistence/EventTriangleAPI.Authorization.Persistence.csproj", "authorization/EventTriangleAPI.Authorization.Persistence/"] COPY ["authorization/EventTriangleAPI.Authorization.Presentation/EventTriangleAPI.Authorization.Presentation.csproj", "authorization/EventTriangleAPI.Authorization.Presentation/"] +COPY ["authorization/EventTriangleAPI.Authorization.UnitTests/EventTriangleAPI.Authorization.UnitTests.csproj", "authorization/EventTriangleAPI.Authorization.UnitTests/"] COPY ["shared/EventTriangleAPI.Shared.Application/EventTriangleAPI.Shared.Application.csproj", "shared/EventTriangleAPI.Shared.Application/"] COPY ["shared/EventTriangleAPI.Shared.DTO/EventTriangleAPI.Shared.DTO.csproj", "shared/EventTriangleAPI.Shared.DTO/"] - RUN dotnet restore "authorization/EventTriangleAPI.Authorization.Presentation/EventTriangleAPI.Authorization.Presentation.csproj" - COPY . . - WORKDIR "authorization/EventTriangleAPI.Authorization.Presentation" - ARG VERSION - -RUN dotnet publish "EventTriangleAPI.Authorization.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false +RUN dotnet publish "EventTriangleAPI.Authorization.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false --no-cache FROM base AS final WORKDIR /app - COPY --from=publish /app/publish . - COPY --from=angularBuild "/angular/EventTriangle.Client/dist/client" wwwroot - ENTRYPOINT ["dotnet", "EventTriangleAPI.Authorization.Presentation.dll"] From 4bad00075b84b4ba53fae485eb0e655a1c67414d Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 16:34:53 +0200 Subject: [PATCH 10/32] remove no cache argument --- src/authorization/Dockerfile | 2 +- src/consumer/Dockerfile | 4 ++-- src/sender/Dockerfile | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/authorization/Dockerfile b/src/authorization/Dockerfile index ac2cf3e..50180b9 100644 --- a/src/authorization/Dockerfile +++ b/src/authorization/Dockerfile @@ -31,7 +31,7 @@ RUN dotnet restore "authorization/EventTriangleAPI.Authorization.Presentation/Ev COPY . . WORKDIR "authorization/EventTriangleAPI.Authorization.Presentation" ARG VERSION -RUN dotnet publish "EventTriangleAPI.Authorization.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false --no-cache +RUN dotnet publish "EventTriangleAPI.Authorization.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app diff --git a/src/consumer/Dockerfile b/src/consumer/Dockerfile index 305c1f0..0624b36 100644 --- a/src/consumer/Dockerfile +++ b/src/consumer/Dockerfile @@ -9,14 +9,14 @@ COPY ["consumer/EventTriangleAPI.Consumer.BusinessLogic/EventTriangleAPI.Consume COPY ["consumer/EventTriangleAPI.Consumer.Domain/EventTriangleAPI.Consumer.Domain.csproj", "consumer/EventTriangleAPI.Consumer.Domain/"] COPY ["consumer/EventTriangleAPI.Consumer.Persistence/EventTriangleAPI.Consumer.Persistence.csproj", "consumer/EventTriangleAPI.Consumer.Persistence/"] COPY ["consumer/EventTriangleAPI.Consumer.Presentation/EventTriangleAPI.Consumer.Presentation.csproj", "consumer/EventTriangleAPI.Consumer.Presentation/"] -COPY ["consumer/EventTriangleAPI.Consumer.UnitTests/EventTriangleAPI.Consumer.UnitTests.csproj", "consumer/EventTriangleAPI.Consumer.UnitTests/"] +#COPY ["consumer/EventTriangleAPI.Consumer.UnitTests/EventTriangleAPI.Consumer.UnitTests.csproj", "consumer/EventTriangleAPI.Consumer.UnitTests/"] COPY ["shared/EventTriangleAPI.Shared.Application/EventTriangleAPI.Shared.Application.csproj", "shared/EventTriangleAPI.Shared.Application/"] COPY ["shared/EventTriangleAPI.Shared.DTO/EventTriangleAPI.Shared.DTO.csproj", "shared/EventTriangleAPI.Shared.DTO/"] RUN dotnet restore "consumer/EventTriangleAPI.Consumer.Presentation/EventTriangleAPI.Consumer.Presentation.csproj" COPY . . WORKDIR "consumer/EventTriangleAPI.Consumer.Presentation" ARG VERSION -RUN dotnet publish "EventTriangleAPI.Consumer.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false --no-cache +RUN dotnet publish "EventTriangleAPI.Consumer.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app diff --git a/src/sender/Dockerfile b/src/sender/Dockerfile index f483175..f05f7a3 100644 --- a/src/sender/Dockerfile +++ b/src/sender/Dockerfile @@ -1,5 +1,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base + WORKDIR /app + EXPOSE 8080 EXPOSE 8081 @@ -10,14 +12,14 @@ COPY ["sender/EventTriangleAPI.Sender.BusinessLogic/EventTriangleAPI.Sender.Busi COPY ["sender/EventTriangleAPI.Sender.Domain/EventTriangleAPI.Sender.Domain.csproj", "sender/EventTriangleAPI.Sender.Domain/"] COPY ["sender/EventTriangleAPI.Sender.Persistence/EventTriangleAPI.Sender.Persistence.csproj", "sender/EventTriangleAPI.Sender.Persistence/"] COPY ["sender/EventTriangleAPI.Sender.Presentation/EventTriangleAPI.Sender.Presentation.csproj", "sender/EventTriangleAPI.Sender.Presentation/"] -COPY ["sender/EventTriangleAPI.Sender.UnitTests/EventTriangleAPI.Sender.UnitTests.csproj", "sender/EventTriangleAPI.Sender.UnitTests/"] +#COPY ["sender/EventTriangleAPI.Sender.UnitTests/EventTriangleAPI.Sender.UnitTests.csproj", "sender/EventTriangleAPI.Sender.UnitTests/"] COPY ["shared/EventTriangleAPI.Shared.Application/EventTriangleAPI.Shared.Application.csproj", "shared/EventTriangleAPI.Shared.Application/"] COPY ["shared/EventTriangleAPI.Shared.DTO/EventTriangleAPI.Shared.DTO.csproj", "shared/EventTriangleAPI.Shared.DTO/"] RUN dotnet restore "sender/EventTriangleAPI.Sender.Presentation/EventTriangleAPI.Sender.Presentation.csproj" COPY . . WORKDIR "sender/EventTriangleAPI.Sender.Presentation" ARG VERSION -RUN dotnet publish "EventTriangleAPI.Sender.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false --no-cache +RUN dotnet publish "EventTriangleAPI.Sender.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app From eef7c4e8a3f6bf9e151bfef1a5dcdd4b8ad972b7 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 20:08:42 +0200 Subject: [PATCH 11/32] dockerfiles and script --- .dockerignore | 18 -------------- scripts/Build-Docker.ps1 | 14 +++++++++++ src/.dockerignore | 47 ++++++++++++++++++++++++++++++++++++ src/authorization/Dockerfile | 35 +++++++++++++++++++++++++-- 4 files changed, 94 insertions(+), 20 deletions(-) delete mode 100644 .dockerignore create mode 100644 src/.dockerignore diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 14b4d08..0000000 --- a/.dockerignore +++ /dev/null @@ -1,18 +0,0 @@ -**/bin -**/obj -**/node_modules -.git -.vscode -*.md -docker-compose*.yml -helm/ -platform/ -terraform/ -.github/ -azure-pipelines/ -img/ -scripts/ -terraform-azdo-libraries -docs/ -cloudflare/ -kubernetes/ diff --git a/scripts/Build-Docker.ps1 b/scripts/Build-Docker.ps1 index 464c4cd..bd738ed 100644 --- a/scripts/Build-Docker.ps1 +++ b/scripts/Build-Docker.ps1 @@ -24,6 +24,10 @@ param ( [string]$WorkingDirectory ) +$ErrorActionPreference = "Stop" + +$InitDirectory = Get-Location + Write-Output "Changing directory to $WorkingDirectory" Set-Location $WorkingDirectory @@ -45,12 +49,17 @@ Write-Output "ACR_GIT_VERSION_IMAGE: $ACR_GIT_VERSION_IMAGE" Write-Output "ACR_LATEST_VERSION_IMAGE: $ACR_LATEST_VERSION_IMAGE" Write-Output "ACR_SHA_IMAGE: $ACR_SHA_TAG" +$sw = [System.Diagnostics.Stopwatch]::StartNew() + # Build the Docker image docker build --build-arg FRONT_API_URL="$DockerBuildParameterUrl" ` --build-arg VERSION="$gitVersion" ` -t "$GIT_VERSION_IMAGE" ` -f "$DockerfilePath" . +$sw.Stop() +Write-Host "Docker build occupied: $($sw.Elapsed.TotalSeconds)" + # Tag the images docker tag "$GIT_VERSION_IMAGE" "$LATEST_VERSION_IMAGE" docker tag "$GIT_VERSION_IMAGE" "$ACR_LATEST_VERSION_IMAGE" @@ -61,6 +70,10 @@ docker tag "$GIT_VERSION_IMAGE" "$ACR_SHA_TAG" # List images docker image ls +Write-Host "Set location back to $InitDirectory..." + +Set-Location $InitDirectory + # EXAMPLE CALL #.\Build-Docker.ps1 ` # -DockerRegistryUrl "docker.io/kaminome"` @@ -69,4 +82,5 @@ docker image ls # -DockerBuildParameterUrl "https://auth-eventtriangle.razumovsky.me/" ` # -DockerfilePath "E:\RiderProjects\02_DOTNET_PROJECTS\EventTriangleAPI\src\authorization\Dockerfile" ` # -GitVersion "1.0.0" ` +# -CommitSha "8e33ce9" ` # -WorkingDirectory "E:\RiderProjects\02_DOTNET_PROJECTS\EventTriangleAPI\src" diff --git a/src/.dockerignore b/src/.dockerignore new file mode 100644 index 0000000..ac752ee --- /dev/null +++ b/src/.dockerignore @@ -0,0 +1,47 @@ +# ========================= +# Build outputs (.NET) +# ========================= +**/bin/ +**/obj/ + +# ========================= +# Node / frontend +# ========================= +**/node_modules/ +**/dist/ +**/build/ + +# ========================= +# IDE / editor +# ========================= +.vscode/ +.idea/ +*.suo +*.user +*.userosscache +*.sln.docstates + +# ========================= +# Git +# ========================= +.git/ +.gitignore + +# ========================= +# Logs / temp +# ========================= +*.log +*.tmp +*.cache + +# ========================= +# OS files +# ========================= +.DS_Store +Thumbs.db + +# ========================= +# Tests (optional!) +# ========================= +**/*Tests/ +**/*.Test*/ diff --git a/src/authorization/Dockerfile b/src/authorization/Dockerfile index 50180b9..4862b69 100644 --- a/src/authorization/Dockerfile +++ b/src/authorization/Dockerfile @@ -1,38 +1,69 @@ FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base + +ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true + WORKDIR /app + EXPOSE 8080 -ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true +####################################################################################################### +# BUILD ANGULAR +####################################################################################################### FROM node:18.15.0-alpine AS angularBuild + WORKDIR /angular + COPY ["authorization/EventTriangle.Client/package.json", "EventTriangle.Client/"] COPY ["authorization/EventTriangle.Client/package-lock.json", "EventTriangle.Client/"] + WORKDIR "EventTriangle.Client" + RUN npm ci + WORKDIR /angular + COPY ["authorization/EventTriangle.Client", "EventTriangle.Client/"] + RUN npm install -g @angular/cli@15.2.7 + WORKDIR "EventTriangle.Client" + ARG FRONT_API_URL + RUN sed -i "s|https://localhost:7000/|$FRONT_API_URL|" ./src/assets/config/config.json + RUN ng build --output-path "dist/client" +####################################################################################################### +# BUILD DOTNET +####################################################################################################### + FROM mcr.microsoft.com/dotnet/sdk:10.0 AS publish + WORKDIR /src + COPY ["authorization/EventTriangleAPI.Authorization.BusinessLogic/EventTriangleAPI.Authorization.BusinessLogic.csproj", "authorization/EventTriangleAPI.Authorization.BusinessLogic/"] COPY ["authorization/EventTriangleAPI.Authorization.Domain/EventTriangleAPI.Authorization.Domain.csproj", "authorization/EventTriangleAPI.Authorization.Domain/"] COPY ["authorization/EventTriangleAPI.Authorization.Persistence/EventTriangleAPI.Authorization.Persistence.csproj", "authorization/EventTriangleAPI.Authorization.Persistence/"] COPY ["authorization/EventTriangleAPI.Authorization.Presentation/EventTriangleAPI.Authorization.Presentation.csproj", "authorization/EventTriangleAPI.Authorization.Presentation/"] -COPY ["authorization/EventTriangleAPI.Authorization.UnitTests/EventTriangleAPI.Authorization.UnitTests.csproj", "authorization/EventTriangleAPI.Authorization.UnitTests/"] COPY ["shared/EventTriangleAPI.Shared.Application/EventTriangleAPI.Shared.Application.csproj", "shared/EventTriangleAPI.Shared.Application/"] COPY ["shared/EventTriangleAPI.Shared.DTO/EventTriangleAPI.Shared.DTO.csproj", "shared/EventTriangleAPI.Shared.DTO/"] + RUN dotnet restore "authorization/EventTriangleAPI.Authorization.Presentation/EventTriangleAPI.Authorization.Presentation.csproj" + COPY . . + WORKDIR "authorization/EventTriangleAPI.Authorization.Presentation" + ARG VERSION + RUN dotnet publish "EventTriangleAPI.Authorization.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false +####################################################################################################### +# CREATE FINAL ARTIFACT +####################################################################################################### + FROM base AS final WORKDIR /app COPY --from=publish /app/publish . From 10732631c735235350a188974939f86e826a7fa3 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 20:22:45 +0200 Subject: [PATCH 12/32] optimize frontend build --- src/authorization/Dockerfile | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/authorization/Dockerfile b/src/authorization/Dockerfile index 4862b69..724bc17 100644 --- a/src/authorization/Dockerfile +++ b/src/authorization/Dockerfile @@ -12,28 +12,21 @@ EXPOSE 8080 FROM node:18.15.0-alpine AS angularBuild -WORKDIR /angular +WORKDIR /angular/EventTriangle.Client -COPY ["authorization/EventTriangle.Client/package.json", "EventTriangle.Client/"] -COPY ["authorization/EventTriangle.Client/package-lock.json", "EventTriangle.Client/"] - -WORKDIR "EventTriangle.Client" +COPY authorization/EventTriangle.Client/package.json ./ +COPY authorization/EventTriangle.Client/package-lock.json ./ +COPY authorization/EventTriangle.Client/angular.json ./ +COPY authorization/EventTriangle.Client/tsconfig*.json ./ RUN npm ci -WORKDIR /angular - -COPY ["authorization/EventTriangle.Client", "EventTriangle.Client/"] - -RUN npm install -g @angular/cli@15.2.7 - -WORKDIR "EventTriangle.Client" +COPY authorization/EventTriangle.Client/src ./src ARG FRONT_API_URL - RUN sed -i "s|https://localhost:7000/|$FRONT_API_URL|" ./src/assets/config/config.json -RUN ng build --output-path "dist/client" +RUN npm run build -- --output-path dist/client ####################################################################################################### # BUILD DOTNET From 0ce1c08dc5cc220b1956f4b5689a7750a16ae7e9 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 20:34:52 +0200 Subject: [PATCH 13/32] disable push to dockerhub --- azure-pipelines/templates/docker-build-push-jobs.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/templates/docker-build-push-jobs.yml b/azure-pipelines/templates/docker-build-push-jobs.yml index 05c73d9..95c3fd0 100644 --- a/azure-pipelines/templates/docker-build-push-jobs.yml +++ b/azure-pipelines/templates/docker-build-push-jobs.yml @@ -48,6 +48,10 @@ parameters: type: string displayName: 'DockerHub Registry URL. For Docker Hub it is: docker.io/kaminome.' + - name: shouldPushToDockerHub + type: boolean + default: false + - name: shouldPushToAcr type: boolean default: false @@ -225,7 +229,7 @@ jobs: - task: Docker@2 displayName: 'Push to DockerHub' - condition: succeeded() + condition: and(succeeded(), eq(${{ parameters.shouldPushToDockerHub }}, true)) inputs: command: push containerRegistry: ${{ parameters.dockerServiceConnection }} From aba5016ce0c696dbb216f92e553a3dc8a4ac897e Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 22:01:39 +0200 Subject: [PATCH 14/32] split build anddocker jobs --- .github/actions/build-and-test/action.yml | 4 +- .../pr-validation/pr-validation-auth.yml | 21 +- .../templates/build-test-scan-jobs.yml | 252 ++++++++++++++++++ .../templates/docker-build-push-jobs.yml | 134 +++++----- 4 files changed, 341 insertions(+), 70 deletions(-) create mode 100644 azure-pipelines/templates/build-test-scan-jobs.yml diff --git a/.github/actions/build-and-test/action.yml b/.github/actions/build-and-test/action.yml index fc252d4..cfe2630 100644 --- a/.github/actions/build-and-test/action.yml +++ b/.github/actions/build-and-test/action.yml @@ -40,10 +40,10 @@ runs: - name: Determine Version uses: gittools/actions/gitversion/execute@v4.5.0 - - name: Setup .NET 8.x SDK + - name: Setup .NET 10.x SDK uses: actions/setup-dotnet@v5 with: - dotnet-version: 8.x + dotnet-version: 10.x - name: NuGet Cache uses: actions/cache@v5 diff --git a/azure-pipelines/pr-validation/pr-validation-auth.yml b/azure-pipelines/pr-validation/pr-validation-auth.yml index c5cbdc6..0548754 100644 --- a/azure-pipelines/pr-validation/pr-validation-auth.yml +++ b/azure-pipelines/pr-validation/pr-validation-auth.yml @@ -58,7 +58,26 @@ stages: jobs: - template: ../templates/docker-build-push-jobs.yml parameters: - JobName: 'PR_Validation_${{ variables.appName }}' + JobName: 'Docker_Push_${{ variables.appName }}' + solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' + buildConfiguration: 'Release' + backendProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.Presentation' + shouldRunUnitTests: false + shouldRunIntegrationTests: true + integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj' + dockerRegistryUrl: 'docker.io/kaminome' + dockerBuildParameterUrl: 'https://auth-eventtriangle.razumovsky.me/' + imageRepository: 'auth-service' + dockerfilePath: '$(System.DefaultWorkingDirectory)/src/authorization/Dockerfile' + dockerServiceConnection: 'Docker_Hub_Connection' + shouldPushToAcr: true + acrRegistryUrl: 'acrsharedd01.azurecr.io' + acrServiceConnection: 'Azure_ACR_Connection' + workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' + + - template: ../templates/build-test-scan-jobs.yml + parameters: + JobName: 'Build_Test_Scan_${{ variables.appName }}' solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' buildConfiguration: 'Release' backendProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.Presentation' diff --git a/azure-pipelines/templates/build-test-scan-jobs.yml b/azure-pipelines/templates/build-test-scan-jobs.yml new file mode 100644 index 0000000..1471fe0 --- /dev/null +++ b/azure-pipelines/templates/build-test-scan-jobs.yml @@ -0,0 +1,252 @@ +parameters: + - name: JobName + displayName: 'Job Name' + type: string + + - name: workingDirectoryForDocker + displayName: 'Working directory for Docker Build' + default: '$(System.DefaultWorkingDirectory)/src' + type: string + + - name: solution + displayName: 'Solution file path' + type: string + + - name: buildConfiguration + displayName: 'Build Configuration' + default: 'Release' + type: string + + - name: backendProjectPath + displayName: 'Backend project path' + type: string + + - name: unitTestsProjectPath + displayName: 'Unit tests project path' + default: '' + type: string + + - name: shouldRunUnitTests + displayName: 'Flag should run unit tests' + default: true + type: boolean + + - name: shouldRunIntegrationTests + displayName: 'Flag should run integration tests' + type: boolean + + - name: integrationTestsProjectPath + displayName: 'Integration tests project path' + type: string + + - name: gitVersionVersion + displayName: 'GitVersion version' + default: '6.x' + type: string + + - name: dockerRegistryUrl + type: string + displayName: 'DockerHub Registry URL. For Docker Hub it is: docker.io/kaminome.' + + - name: shouldPushToDockerHub + type: boolean + default: false + + - name: shouldPushToAcr + type: boolean + default: false + + - name: acrRegistryUrl + type: string + displayName: 'ACR Registry URL. For ACR it is FQDN URL of container registry: azuredevopsacrd01.azurecr.io' + + - name: imageRepository + displayName: 'Image Repository name' + type: string + + - name: dockerfilePath + displayName: 'Dockerfile path' + type: string + + - name: dockerServiceConnection + displayName: 'Docker container registry service connection in Azure DevOps.' + type: string + + - name: acrServiceConnection + displayName: 'Azure container registry service connection in Azure DevOps.' + type: string + + - name: dockerBuildParameterUrl + displayName: 'Build parameter for Docker: Base URL' + default: 'https://auth.eventtriangle.razumovsky.me/' + type: string + + - name: dotnetSdkVersion + type: string + default: '10.x' + + - name: sonarCloudEnabled + type: boolean + default: false + + - name: sonarCloudServiceConnection + type: string + default: SonarCloud_Service_Connection + +jobs: + - job: ${{ parameters.JobName }} + displayName: ${{ parameters.JobName }} + steps: + - checkout: self + fetchDepth: 0 + + - task: UseDotNet@2 + displayName: 'Install .NET SDK ${{ parameters.dotnetSdkVersion }}' + condition: succeeded() + inputs: + packageType: 'sdk' + version: '${{ parameters.dotnetSdkVersion }}' + + - task: gitversion-setup@4.5.0 + displayName: 'GitVersion Setup' + condition: succeeded() + inputs: + versionSpec: ${{ parameters.gitVersionVersion }} + + - task: gitversion-execute@4.5.0 + name: version_step # step id used as a reference for output values + displayName: Determine Version + condition: succeeded() + + - bash: echo $Action$BuildVersion + displayName: 'Set Build Version' + condition: succeeded() + env: + Action: '##vso[build.updatebuildnumber]' + BuildVersion: $(version_step.semVer) + + - pwsh: | + Write-Host "=== ENV VARIABLES ===" + Get-ChildItem Env: | Sort-Object Name + + Write-Host "=== PIPELINE VARIABLES ===" + Write-Host "FullSemVer: $(version_step.FullSemVer)" + Write-Host "SemVer: $(version_step.SemVer)" + Write-Host "ShortSha: $(version_step.ShortSha)" + Write-Host "Build Source branch: $env:BUILD_SOURCEBRANCHNAME" + displayName: Debug environment + condition: succeeded() + + # - task: PowerShell@2 + # displayName: 'Debug branch condition' + # condition: ne(variables['Build.SourceBranchName'], 'main') + # inputs: + # targetType: 'inline' + # script: | + # Write-Host "Running because branch is NOT main" + # Write-Host "Branch: $env:BUILD_SOURCEBRANCHNAME" + + - task: DotNetCoreCLI@2 + displayName: 'Dotnet restore' + condition: succeeded() + inputs: + command: 'restore' + projects: '${{ parameters.solution }}' + arguments: '--verbosity minimal' + nugetConfigPath: 'nuget.config' + + - task: SonarCloudPrepare@4 + condition: and( + succeeded(), + ${{ parameters.sonarCloudEnabled }}, + eq(variables['Build.SourceBranchName'], 'main')) + inputs: + SonarCloud: ${{ parameters.sonarCloudServiceConnection }} + organization: event-triangle + scannerMode: dotnet + projectKey: event-triangle-api + projectName: eventtriangleapi + extraProperties: | + sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/**/*.trx + sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/*opencover.xml + sonar.exclusions=**/Properties/**, **/bin/**, **/obj/**, **/Migrations/** + + - task: DotNetCoreCLI@2 + displayName: 'Build solution' + condition: succeeded() + inputs: + command: 'build' + projects: '${{ parameters.solution }}' + arguments: '-c ${{ parameters.buildConfiguration }} -p:Version=$(version_step.semVer) --no-restore' + + - task: SonarCloudAnalyze@4 + condition: and( + succeeded(), + ${{ parameters.sonarCloudEnabled }}, + eq(variables['Build.SourceBranchName'], 'main')) + inputs: {} + + - task: SonarCloudPublish@4 + condition: and( + succeeded(), + ${{ parameters.sonarCloudEnabled }}, + eq(variables['Build.SourceBranchName'], 'main')) + inputs: + pollingTimeoutSec: "300" + + - task: DotnetCoreCLI@2 + displayName: 'Run unit tests' + condition: and(succeeded(), eq(${{ parameters.shouldRunUnitTests }}, true)) + inputs: + command: 'test' + projects: '${{ parameters.unitTestsProjectPath }}' + arguments: '--no-build --configuration ${{ parameters.buildConfiguration }} --collect "Code Coverage"' + + - task: DotNetCoreCLI@2 + displayName: 'Run integration tests' + condition: and(succeeded(), eq(${{ parameters.shouldRunIntegrationTests }}, true)) + inputs: + command: 'test' + projects: '${{ parameters.integrationTestsProjectPath }}' + arguments: '--no-build --configuration ${{ parameters.buildConfiguration }} --collect "Code Coverage"' + + # - task: PowerShell@2 + # displayName: 'Build Docker Image' + # condition: succeeded() + # inputs: + # targetType: 'filePath' + # filePath: '$(System.DefaultWorkingDirectory)/scripts/Build-Docker.ps1' + # arguments: "-DockerRegistryUrl ${{ parameters.dockerRegistryUrl }} + # -ImageRepository ${{ parameters.imageRepository }} + # -AcrRegistryUrl ${{ parameters.acrRegistryUrl }} + # -DockerBuildParameterUrl ${{ parameters.dockerBuildParameterUrl }} + # -DockerfilePath ${{ parameters.dockerfilePath }} + # -GitVersion $(version_step.semVer) + # -WorkingDirectory ${{ parameters.workingDirectoryForDocker }} + # -CommitSha $(version_step.ShortSha)" + # errorActionPreference: 'stop' + # pwsh: true + + # - task: Docker@2 + # displayName: 'Push to DockerHub' + # condition: and(succeeded(), eq(${{ parameters.shouldPushToDockerHub }}, true)) + # inputs: + # command: push + # containerRegistry: ${{ parameters.dockerServiceConnection }} + # repository: ${{ parameters.dockerRegistryUrl }}/${{ parameters.imageRepository }} + # tags: | + # $(version_step.semVer) + # $(version_step.semVer)-$(version_step.ShortSha) + # latest + + # - task: Docker@2 + # displayName: 'Push to ACR' + # condition: and(succeeded(), eq(${{ parameters.shouldPushToAcr }}, true)) + # inputs: + # command: push + # containerRegistry: ${{ parameters.acrServiceConnection }} + # repository: ${{ parameters.imageRepository }} + # tags: | + # $(version_step.semVer) + # $(version_step.semVer)-$(version_step.ShortSha) + # latest diff --git a/azure-pipelines/templates/docker-build-push-jobs.yml b/azure-pipelines/templates/docker-build-push-jobs.yml index 95c3fd0..7a87962 100644 --- a/azure-pipelines/templates/docker-build-push-jobs.yml +++ b/azure-pipelines/templates/docker-build-push-jobs.yml @@ -100,12 +100,12 @@ jobs: - checkout: self fetchDepth: 0 - - task: UseDotNet@2 - displayName: 'Install .NET SDK ${{ parameters.dotnetSdkVersion }}' - condition: succeeded() - inputs: - packageType: 'sdk' - version: '${{ parameters.dotnetSdkVersion }}' + # - task: UseDotNet@2 + # displayName: 'Install .NET SDK ${{ parameters.dotnetSdkVersion }}' + # condition: succeeded() + # inputs: + # packageType: 'sdk' + # version: '${{ parameters.dotnetSdkVersion }}' - task: gitversion-setup@4.5.0 displayName: 'GitVersion Setup' @@ -146,69 +146,69 @@ jobs: # Write-Host "Running because branch is NOT main" # Write-Host "Branch: $env:BUILD_SOURCEBRANCHNAME" - - task: DotNetCoreCLI@2 - displayName: 'Dotnet restore' - condition: succeeded() - inputs: - command: 'restore' - projects: '${{ parameters.solution }}' - arguments: '--verbosity minimal' - nugetConfigPath: 'nuget.config' - - - task: SonarCloudPrepare@4 - condition: and( - succeeded(), - ${{ parameters.sonarCloudEnabled }}, - eq(variables['Build.SourceBranchName'], 'main')) - inputs: - SonarCloud: ${{ parameters.sonarCloudServiceConnection }} - organization: event-triangle - scannerMode: dotnet - projectKey: event-triangle-api - projectName: eventtriangleapi - extraProperties: | - sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/**/*.trx - sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/*opencover.xml - sonar.exclusions=**/Properties/**, **/bin/**, **/obj/**, **/Migrations/** - - - task: DotNetCoreCLI@2 - displayName: 'Build solution' - condition: succeeded() - inputs: - command: 'build' - projects: '${{ parameters.solution }}' - arguments: '-c ${{ parameters.buildConfiguration }} -p:Version=$(version_step.semVer) --no-restore' - - - task: SonarCloudAnalyze@4 - condition: and( - succeeded(), - ${{ parameters.sonarCloudEnabled }}, - eq(variables['Build.SourceBranchName'], 'main')) - inputs: {} - - - task: SonarCloudPublish@4 - condition: and( - succeeded(), - ${{ parameters.sonarCloudEnabled }}, - eq(variables['Build.SourceBranchName'], 'main')) - inputs: - pollingTimeoutSec: "300" + # - task: DotNetCoreCLI@2 + # displayName: 'Dotnet restore' + # condition: succeeded() + # inputs: + # command: 'restore' + # projects: '${{ parameters.solution }}' + # arguments: '--verbosity minimal' + # nugetConfigPath: 'nuget.config' + + # - task: SonarCloudPrepare@4 + # condition: and( + # succeeded(), + # ${{ parameters.sonarCloudEnabled }}, + # eq(variables['Build.SourceBranchName'], 'main')) + # inputs: + # SonarCloud: ${{ parameters.sonarCloudServiceConnection }} + # organization: event-triangle + # scannerMode: dotnet + # projectKey: event-triangle-api + # projectName: eventtriangleapi + # extraProperties: | + # sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/**/*.trx + # sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/*opencover.xml + # sonar.exclusions=**/Properties/**, **/bin/**, **/obj/**, **/Migrations/** + + # - task: DotNetCoreCLI@2 + # displayName: 'Build solution' + # condition: succeeded() + # inputs: + # command: 'build' + # projects: '${{ parameters.solution }}' + # arguments: '-c ${{ parameters.buildConfiguration }} -p:Version=$(version_step.semVer) --no-restore' + + # - task: SonarCloudAnalyze@4 + # condition: and( + # succeeded(), + # ${{ parameters.sonarCloudEnabled }}, + # eq(variables['Build.SourceBranchName'], 'main')) + # inputs: {} + + # - task: SonarCloudPublish@4 + # condition: and( + # succeeded(), + # ${{ parameters.sonarCloudEnabled }}, + # eq(variables['Build.SourceBranchName'], 'main')) + # inputs: + # pollingTimeoutSec: "300" - - task: DotnetCoreCLI@2 - displayName: 'Run unit tests' - condition: and(succeeded(), eq(${{ parameters.shouldRunUnitTests }}, true)) - inputs: - command: 'test' - projects: '${{ parameters.unitTestsProjectPath }}' - arguments: '--no-build --configuration ${{ parameters.buildConfiguration }} --collect "Code Coverage"' + # - task: DotnetCoreCLI@2 + # displayName: 'Run unit tests' + # condition: and(succeeded(), eq(${{ parameters.shouldRunUnitTests }}, true)) + # inputs: + # command: 'test' + # projects: '${{ parameters.unitTestsProjectPath }}' + # arguments: '--no-build --configuration ${{ parameters.buildConfiguration }} --collect "Code Coverage"' - - task: DotNetCoreCLI@2 - displayName: 'Run integration tests' - condition: and(succeeded(), eq(${{ parameters.shouldRunIntegrationTests }}, true)) - inputs: - command: 'test' - projects: '${{ parameters.integrationTestsProjectPath }}' - arguments: '--no-build --configuration ${{ parameters.buildConfiguration }} --collect "Code Coverage"' + # - task: DotNetCoreCLI@2 + # displayName: 'Run integration tests' + # condition: and(succeeded(), eq(${{ parameters.shouldRunIntegrationTests }}, true)) + # inputs: + # command: 'test' + # projects: '${{ parameters.integrationTestsProjectPath }}' + # arguments: '--no-build --configuration ${{ parameters.buildConfiguration }} --collect "Code Coverage"' - task: PowerShell@2 displayName: 'Build Docker Image' From b63bd74ad10c2ce11bf47bbf441f78289b91cefb Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 22:13:15 +0200 Subject: [PATCH 15/32] pr validation pipelines --- .../pr-validation/pr-validation-auth.yml | 21 +------------------ .../pr-validation/pr-validation-consumer.yml | 4 ++-- .../pr-validation/pr-validation-sender.yml | 4 ++-- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/azure-pipelines/pr-validation/pr-validation-auth.yml b/azure-pipelines/pr-validation/pr-validation-auth.yml index 0548754..858ff11 100644 --- a/azure-pipelines/pr-validation/pr-validation-auth.yml +++ b/azure-pipelines/pr-validation/pr-validation-auth.yml @@ -45,7 +45,7 @@ pr: variables: - name: appName - value: 'AuthorizationAPI' + value: 'Auth' - name: System.Debug value: 'false' @@ -74,22 +74,3 @@ stages: acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' - - - template: ../templates/build-test-scan-jobs.yml - parameters: - JobName: 'Build_Test_Scan_${{ variables.appName }}' - solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' - buildConfiguration: 'Release' - backendProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.Presentation' - shouldRunUnitTests: false - shouldRunIntegrationTests: true - integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj' - dockerRegistryUrl: 'docker.io/kaminome' - dockerBuildParameterUrl: 'https://auth-eventtriangle.razumovsky.me/' - imageRepository: 'auth-service' - dockerfilePath: '$(System.DefaultWorkingDirectory)/src/authorization/Dockerfile' - dockerServiceConnection: 'Docker_Hub_Connection' - shouldPushToAcr: true - acrRegistryUrl: 'acrsharedd01.azurecr.io' - acrServiceConnection: 'Azure_ACR_Connection' - workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' diff --git a/azure-pipelines/pr-validation/pr-validation-consumer.yml b/azure-pipelines/pr-validation/pr-validation-consumer.yml index 8ee15c5..0397001 100644 --- a/azure-pipelines/pr-validation/pr-validation-consumer.yml +++ b/azure-pipelines/pr-validation/pr-validation-consumer.yml @@ -45,7 +45,7 @@ pr: variables: - name: appName - value: 'ConsumerAPI' + value: 'Consumer' - name: System.Debug value: 'false' @@ -58,7 +58,7 @@ stages: jobs: - template: ../templates/docker-build-push-jobs.yml parameters: - JobName: 'PR_Validation_${{ variables.appName }}' + JobName: 'Docker_Push_${{ variables.appName }}' solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' buildConfiguration: 'Release' backendProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.Presentation' diff --git a/azure-pipelines/pr-validation/pr-validation-sender.yml b/azure-pipelines/pr-validation/pr-validation-sender.yml index ca32be6..7a52269 100644 --- a/azure-pipelines/pr-validation/pr-validation-sender.yml +++ b/azure-pipelines/pr-validation/pr-validation-sender.yml @@ -45,7 +45,7 @@ pr: variables: - name: appName - value: 'SenderAPI' + value: 'Sender' - name: System.Debug value: 'false' @@ -58,7 +58,7 @@ stages: jobs: - template: ../templates/docker-build-push-jobs.yml parameters: - JobName: 'PR_Validation_${{ variables.appName }}' + JobName: 'Docker_Push_${{ variables.appName }}' solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' buildConfiguration: 'Release' backendProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.Presentation' From b26711b19f14921aebc6eff83ca2c8cc2b6f448f Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 22:27:48 +0200 Subject: [PATCH 16/32] comment unused parameters --- azure-pipelines/build/build-auth.yml | 30 ++++++++- azure-pipelines/build/build-consumer.yml | 31 +++++++-- azure-pipelines/build/build-sender.yml | 8 +-- .../pr-validation/pr-validation-auth.yml | 12 ++-- .../pr-validation/pr-validation-consumer.yml | 14 ++-- .../pr-validation/pr-validation-sender.yml | 14 ++-- .../templates/docker-build-push-jobs.yml | 66 +++++++++---------- 7 files changed, 111 insertions(+), 64 deletions(-) diff --git a/azure-pipelines/build/build-auth.yml b/azure-pipelines/build/build-auth.yml index 919db35..f7e6bc1 100644 --- a/azure-pipelines/build/build-auth.yml +++ b/azure-pipelines/build/build-auth.yml @@ -11,7 +11,7 @@ pr: none variables: - name: appName - value: 'AuthorizationAPI' + value: 'Auth' - name: System.Debug value: 'false' @@ -19,10 +19,34 @@ pool: vmImage: 'ubuntu-latest' stages: - - stage: 'Build_${{ variables.appName }}' - displayName: 'Build_${{ variables.appName }}' + - stage: 'Docker_Push_${{ variables.appName }}' + displayName: 'Docker_Push_${{ variables.appName }}' jobs: - template: ../templates/docker-build-push-jobs.yml + parameters: + JobName: 'Docker_Push_${{ variables.appName }}' + solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' + buildConfiguration: 'Release' + backendProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.Presentation' + shouldRunUnitTests: false + shouldRunIntegrationTests: true + integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj' + dockerRegistryUrl: 'docker.io/kaminome' + dockerBuildParameterUrl: 'https://auth-eventtriangle.razumovsky.me/' + imageRepository: 'auth-service' + dockerfilePath: '$(System.DefaultWorkingDirectory)/src/authorization/Dockerfile' + dockerServiceConnection: 'Docker_Hub_Connection' + shouldPushToAcr: true + acrRegistryUrl: 'acrsharedd01.azurecr.io' + acrServiceConnection: 'Azure_ACR_Connection' + sonarCloudEnabled: true + sonarCloudServiceConnection: 'SonarCloud_Service_Connection' + workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' + + - stage: 'Build_Test_Scan_${{ variables.appName }}' + displayName: 'Build_Test_Scan_${{ variables.appName }}' + jobs: + - template: ../templates/build-test-scan-jobs.yml parameters: JobName: 'Build_${{ variables.appName }}' solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' diff --git a/azure-pipelines/build/build-consumer.yml b/azure-pipelines/build/build-consumer.yml index 13e7cbe..c862b97 100644 --- a/azure-pipelines/build/build-consumer.yml +++ b/azure-pipelines/build/build-consumer.yml @@ -11,7 +11,7 @@ pr: none variables: - name: appName - value: 'ConsumerAPI' + value: 'Consumer' - name: System.Debug value: 'false' @@ -19,12 +19,35 @@ pool: vmImage: 'ubuntu-latest' stages: - - stage: 'Build_${{ variables.appName }}' - displayName: 'Build_${{ variables.appName }}' + - stage: 'Docker_Push_${{ variables.appName }}' + displayName: 'Docker_Push_${{ variables.appName }}' jobs: - template: ../templates/docker-build-push-jobs.yml parameters: - JobName: 'Build_${{ variables.appName }}' + JobName: 'Docker_Push_${{ variables.appName }}' + solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' + buildConfiguration: 'Release' + backendProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.Presentation' + unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.UnitTests/EventTriangleAPI.Consumer.UnitTests.csproj' + shouldRunUnitTests: true + shouldRunIntegrationTests: true + integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.IntegrationTests/EventTriangleAPI.Consumer.IntegrationTests.csproj' + dockerRegistryUrl: 'docker.io/kaminome' + imageRepository: 'consumer-service' + dockerfilePath: '$(System.DefaultWorkingDirectory)/src/consumer/Dockerfile' + dockerServiceConnection: 'Docker_Hub_Connection' + shouldPushToAcr: true + acrRegistryUrl: 'acrsharedd01.azurecr.io' + acrServiceConnection: 'Azure_ACR_Connection' + sonarCloudEnabled: false + workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' + + - stage: 'Build_Test_Scan_${{ variables.appName }}' + displayName: 'Build_Test_Scan_${{ variables.appName }}' + jobs: + - template: ../templates/build-test-scan-jobs.yml + parameters: + JobName: 'Build_Test_Scan_${{ variables.appName }}' solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' buildConfiguration: 'Release' backendProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.Presentation' diff --git a/azure-pipelines/build/build-sender.yml b/azure-pipelines/build/build-sender.yml index c4754e7..71b1288 100644 --- a/azure-pipelines/build/build-sender.yml +++ b/azure-pipelines/build/build-sender.yml @@ -11,7 +11,7 @@ pr: none variables: - name: appName - value: 'SenderAPI' + value: 'Sender' - name: System.Debug value: 'false' @@ -19,12 +19,12 @@ pool: vmImage: 'ubuntu-latest' stages: - - stage: 'Build_${{ variables.appName }}' - displayName: 'Build_${{ variables.appName }}' + - stage: 'Docker_Push_${{ variables.appName }}' + displayName: 'Docker_Push_${{ variables.appName }}' jobs: - template: ../templates/docker-build-push-jobs.yml parameters: - JobName: 'Build_${{ variables.appName }}' + JobName: 'Docker_Push_${{ variables.appName }}' solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' buildConfiguration: 'Release' backendProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.Presentation' diff --git a/azure-pipelines/pr-validation/pr-validation-auth.yml b/azure-pipelines/pr-validation/pr-validation-auth.yml index 858ff11..6631ff5 100644 --- a/azure-pipelines/pr-validation/pr-validation-auth.yml +++ b/azure-pipelines/pr-validation/pr-validation-auth.yml @@ -59,12 +59,12 @@ stages: - template: ../templates/docker-build-push-jobs.yml parameters: JobName: 'Docker_Push_${{ variables.appName }}' - solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' - buildConfiguration: 'Release' - backendProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.Presentation' - shouldRunUnitTests: false - shouldRunIntegrationTests: true - integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj' + #solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' + #buildConfiguration: 'Release' + #backendProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.Presentation' + #shouldRunUnitTests: false + #shouldRunIntegrationTests: true + #integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj' dockerRegistryUrl: 'docker.io/kaminome' dockerBuildParameterUrl: 'https://auth-eventtriangle.razumovsky.me/' imageRepository: 'auth-service' diff --git a/azure-pipelines/pr-validation/pr-validation-consumer.yml b/azure-pipelines/pr-validation/pr-validation-consumer.yml index 0397001..6124278 100644 --- a/azure-pipelines/pr-validation/pr-validation-consumer.yml +++ b/azure-pipelines/pr-validation/pr-validation-consumer.yml @@ -59,13 +59,13 @@ stages: - template: ../templates/docker-build-push-jobs.yml parameters: JobName: 'Docker_Push_${{ variables.appName }}' - solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' - buildConfiguration: 'Release' - backendProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.Presentation' - unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.UnitTests/EventTriangleAPI.Consumer.UnitTests.csproj' - shouldRunUnitTests: true - shouldRunIntegrationTests: true - integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.IntegrationTests/EventTriangleAPI.Consumer.IntegrationTests.csproj' + #solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' + #buildConfiguration: 'Release' + #backendProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.Presentation' + #unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.UnitTests/EventTriangleAPI.Consumer.UnitTests.csproj' + #shouldRunUnitTests: true + #shouldRunIntegrationTests: true + #integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.IntegrationTests/EventTriangleAPI.Consumer.IntegrationTests.csproj' dockerRegistryUrl: 'docker.io/kaminome' imageRepository: 'consumer-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/consumer/Dockerfile' diff --git a/azure-pipelines/pr-validation/pr-validation-sender.yml b/azure-pipelines/pr-validation/pr-validation-sender.yml index 7a52269..fe1e3ed 100644 --- a/azure-pipelines/pr-validation/pr-validation-sender.yml +++ b/azure-pipelines/pr-validation/pr-validation-sender.yml @@ -59,13 +59,13 @@ stages: - template: ../templates/docker-build-push-jobs.yml parameters: JobName: 'Docker_Push_${{ variables.appName }}' - solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' - buildConfiguration: 'Release' - backendProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.Presentation' - unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.UnitTests/EventTriangleAPI.Sender.UnitTests.csproj' - shouldRunIntegrationTests: true - shouldRunUnitTests: true - integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.IntegrationTests/EventTriangleAPI.Sender.IntegrationTests.csproj' + #solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' + #buildConfiguration: 'Release' + #backendProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.Presentation' + #unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.UnitTests/EventTriangleAPI.Sender.UnitTests.csproj' + #shouldRunIntegrationTests: true + #shouldRunUnitTests: true + #integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.IntegrationTests/EventTriangleAPI.Sender.IntegrationTests.csproj' dockerRegistryUrl: 'docker.io/kaminome' imageRepository: 'sender-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/sender/Dockerfile' diff --git a/azure-pipelines/templates/docker-build-push-jobs.yml b/azure-pipelines/templates/docker-build-push-jobs.yml index 7a87962..180d5e5 100644 --- a/azure-pipelines/templates/docker-build-push-jobs.yml +++ b/azure-pipelines/templates/docker-build-push-jobs.yml @@ -8,36 +8,36 @@ parameters: default: '$(System.DefaultWorkingDirectory)/src' type: string - - name: solution - displayName: 'Solution file path' - type: string + # - name: solution + # displayName: 'Solution file path' + # type: string - - name: buildConfiguration - displayName: 'Build Configuration' - default: 'Release' - type: string + # - name: buildConfiguration + # displayName: 'Build Configuration' + # default: 'Release' + # type: string - - name: backendProjectPath - displayName: 'Backend project path' - type: string + # - name: backendProjectPath + # displayName: 'Backend project path' + # type: string - - name: unitTestsProjectPath - displayName: 'Unit tests project path' - default: '' - type: string + # - name: unitTestsProjectPath + # displayName: 'Unit tests project path' + # default: '' + # type: string - - name: shouldRunUnitTests - displayName: 'Flag should run unit tests' - default: true - type: boolean + # - name: shouldRunUnitTests + # displayName: 'Flag should run unit tests' + # default: true + # type: boolean - - name: shouldRunIntegrationTests - displayName: 'Flag should run integration tests' - type: boolean + # - name: shouldRunIntegrationTests + # displayName: 'Flag should run integration tests' + # type: boolean - - name: integrationTestsProjectPath - displayName: 'Integration tests project path' - type: string + # - name: integrationTestsProjectPath + # displayName: 'Integration tests project path' + # type: string - name: gitVersionVersion displayName: 'GitVersion version' @@ -81,17 +81,17 @@ parameters: default: 'https://auth.eventtriangle.razumovsky.me/' type: string - - name: dotnetSdkVersion - type: string - default: '10.x' + # - name: dotnetSdkVersion + # type: string + # default: '10.x' - - name: sonarCloudEnabled - type: boolean - default: false + # - name: sonarCloudEnabled + # type: boolean + # default: false - - name: sonarCloudServiceConnection - type: string - default: SonarCloud_Service_Connection + # - name: sonarCloudServiceConnection + # type: string + # default: SonarCloud_Service_Connection jobs: - job: ${{ parameters.JobName }} From 34ea13f536b371367eedd7d9c239f33a7e023a8c Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 22:38:36 +0200 Subject: [PATCH 17/32] pr validation: remove commented code --- .../pr-validation/pr-validation-auth.yml | 6 - .../pr-validation/pr-validation-consumer.yml | 7 - .../pr-validation/pr-validation-sender.yml | 7 - .../templates/docker-build-push-jobs.yml | 125 +----------------- 4 files changed, 1 insertion(+), 144 deletions(-) diff --git a/azure-pipelines/pr-validation/pr-validation-auth.yml b/azure-pipelines/pr-validation/pr-validation-auth.yml index 6631ff5..d63edab 100644 --- a/azure-pipelines/pr-validation/pr-validation-auth.yml +++ b/azure-pipelines/pr-validation/pr-validation-auth.yml @@ -59,12 +59,6 @@ stages: - template: ../templates/docker-build-push-jobs.yml parameters: JobName: 'Docker_Push_${{ variables.appName }}' - #solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' - #buildConfiguration: 'Release' - #backendProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.Presentation' - #shouldRunUnitTests: false - #shouldRunIntegrationTests: true - #integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj' dockerRegistryUrl: 'docker.io/kaminome' dockerBuildParameterUrl: 'https://auth-eventtriangle.razumovsky.me/' imageRepository: 'auth-service' diff --git a/azure-pipelines/pr-validation/pr-validation-consumer.yml b/azure-pipelines/pr-validation/pr-validation-consumer.yml index 6124278..19d8fff 100644 --- a/azure-pipelines/pr-validation/pr-validation-consumer.yml +++ b/azure-pipelines/pr-validation/pr-validation-consumer.yml @@ -59,13 +59,6 @@ stages: - template: ../templates/docker-build-push-jobs.yml parameters: JobName: 'Docker_Push_${{ variables.appName }}' - #solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' - #buildConfiguration: 'Release' - #backendProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.Presentation' - #unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.UnitTests/EventTriangleAPI.Consumer.UnitTests.csproj' - #shouldRunUnitTests: true - #shouldRunIntegrationTests: true - #integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.IntegrationTests/EventTriangleAPI.Consumer.IntegrationTests.csproj' dockerRegistryUrl: 'docker.io/kaminome' imageRepository: 'consumer-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/consumer/Dockerfile' diff --git a/azure-pipelines/pr-validation/pr-validation-sender.yml b/azure-pipelines/pr-validation/pr-validation-sender.yml index fe1e3ed..d8bd536 100644 --- a/azure-pipelines/pr-validation/pr-validation-sender.yml +++ b/azure-pipelines/pr-validation/pr-validation-sender.yml @@ -59,13 +59,6 @@ stages: - template: ../templates/docker-build-push-jobs.yml parameters: JobName: 'Docker_Push_${{ variables.appName }}' - #solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' - #buildConfiguration: 'Release' - #backendProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.Presentation' - #unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.UnitTests/EventTriangleAPI.Sender.UnitTests.csproj' - #shouldRunIntegrationTests: true - #shouldRunUnitTests: true - #integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.IntegrationTests/EventTriangleAPI.Sender.IntegrationTests.csproj' dockerRegistryUrl: 'docker.io/kaminome' imageRepository: 'sender-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/sender/Dockerfile' diff --git a/azure-pipelines/templates/docker-build-push-jobs.yml b/azure-pipelines/templates/docker-build-push-jobs.yml index 180d5e5..2570b62 100644 --- a/azure-pipelines/templates/docker-build-push-jobs.yml +++ b/azure-pipelines/templates/docker-build-push-jobs.yml @@ -8,37 +8,6 @@ parameters: default: '$(System.DefaultWorkingDirectory)/src' type: string - # - name: solution - # displayName: 'Solution file path' - # type: string - - # - name: buildConfiguration - # displayName: 'Build Configuration' - # default: 'Release' - # type: string - - # - name: backendProjectPath - # displayName: 'Backend project path' - # type: string - - # - name: unitTestsProjectPath - # displayName: 'Unit tests project path' - # default: '' - # type: string - - # - name: shouldRunUnitTests - # displayName: 'Flag should run unit tests' - # default: true - # type: boolean - - # - name: shouldRunIntegrationTests - # displayName: 'Flag should run integration tests' - # type: boolean - - # - name: integrationTestsProjectPath - # displayName: 'Integration tests project path' - # type: string - - name: gitVersionVersion displayName: 'GitVersion version' default: '6.x' @@ -69,7 +38,7 @@ parameters: type: string - name: dockerServiceConnection - displayName: 'Docker container registry service connection in Azure DevOps.' + displayName: 'DockerHub service connection in Azure DevOps.' type: string - name: acrServiceConnection @@ -81,18 +50,6 @@ parameters: default: 'https://auth.eventtriangle.razumovsky.me/' type: string - # - name: dotnetSdkVersion - # type: string - # default: '10.x' - - # - name: sonarCloudEnabled - # type: boolean - # default: false - - # - name: sonarCloudServiceConnection - # type: string - # default: SonarCloud_Service_Connection - jobs: - job: ${{ parameters.JobName }} displayName: ${{ parameters.JobName }} @@ -100,13 +57,6 @@ jobs: - checkout: self fetchDepth: 0 - # - task: UseDotNet@2 - # displayName: 'Install .NET SDK ${{ parameters.dotnetSdkVersion }}' - # condition: succeeded() - # inputs: - # packageType: 'sdk' - # version: '${{ parameters.dotnetSdkVersion }}' - - task: gitversion-setup@4.5.0 displayName: 'GitVersion Setup' condition: succeeded() @@ -137,79 +87,6 @@ jobs: displayName: Debug environment condition: succeeded() - # - task: PowerShell@2 - # displayName: 'Debug branch condition' - # condition: ne(variables['Build.SourceBranchName'], 'main') - # inputs: - # targetType: 'inline' - # script: | - # Write-Host "Running because branch is NOT main" - # Write-Host "Branch: $env:BUILD_SOURCEBRANCHNAME" - - # - task: DotNetCoreCLI@2 - # displayName: 'Dotnet restore' - # condition: succeeded() - # inputs: - # command: 'restore' - # projects: '${{ parameters.solution }}' - # arguments: '--verbosity minimal' - # nugetConfigPath: 'nuget.config' - - # - task: SonarCloudPrepare@4 - # condition: and( - # succeeded(), - # ${{ parameters.sonarCloudEnabled }}, - # eq(variables['Build.SourceBranchName'], 'main')) - # inputs: - # SonarCloud: ${{ parameters.sonarCloudServiceConnection }} - # organization: event-triangle - # scannerMode: dotnet - # projectKey: event-triangle-api - # projectName: eventtriangleapi - # extraProperties: | - # sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/**/*.trx - # sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/*opencover.xml - # sonar.exclusions=**/Properties/**, **/bin/**, **/obj/**, **/Migrations/** - - # - task: DotNetCoreCLI@2 - # displayName: 'Build solution' - # condition: succeeded() - # inputs: - # command: 'build' - # projects: '${{ parameters.solution }}' - # arguments: '-c ${{ parameters.buildConfiguration }} -p:Version=$(version_step.semVer) --no-restore' - - # - task: SonarCloudAnalyze@4 - # condition: and( - # succeeded(), - # ${{ parameters.sonarCloudEnabled }}, - # eq(variables['Build.SourceBranchName'], 'main')) - # inputs: {} - - # - task: SonarCloudPublish@4 - # condition: and( - # succeeded(), - # ${{ parameters.sonarCloudEnabled }}, - # eq(variables['Build.SourceBranchName'], 'main')) - # inputs: - # pollingTimeoutSec: "300" - - # - task: DotnetCoreCLI@2 - # displayName: 'Run unit tests' - # condition: and(succeeded(), eq(${{ parameters.shouldRunUnitTests }}, true)) - # inputs: - # command: 'test' - # projects: '${{ parameters.unitTestsProjectPath }}' - # arguments: '--no-build --configuration ${{ parameters.buildConfiguration }} --collect "Code Coverage"' - - # - task: DotNetCoreCLI@2 - # displayName: 'Run integration tests' - # condition: and(succeeded(), eq(${{ parameters.shouldRunIntegrationTests }}, true)) - # inputs: - # command: 'test' - # projects: '${{ parameters.integrationTestsProjectPath }}' - # arguments: '--no-build --configuration ${{ parameters.buildConfiguration }} --collect "Code Coverage"' - - task: PowerShell@2 displayName: 'Build Docker Image' condition: succeeded() From 48bd1cf666da5ab1b1023aad65493b3287d4f88d Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 23:17:22 +0200 Subject: [PATCH 18/32] build pipelines --- azure-pipelines/build/build-auth.yml | 34 +++++----- azure-pipelines/build/build-consumer.yml | 32 +++++----- azure-pipelines/build/build-sender.yml | 39 ++++++++--- .../templates/build-test-scan-jobs.yml | 64 +++++++++---------- 4 files changed, 96 insertions(+), 73 deletions(-) diff --git a/azure-pipelines/build/build-auth.yml b/azure-pipelines/build/build-auth.yml index f7e6bc1..f103af7 100644 --- a/azure-pipelines/build/build-auth.yml +++ b/azure-pipelines/build/build-auth.yml @@ -25,12 +25,12 @@ stages: - template: ../templates/docker-build-push-jobs.yml parameters: JobName: 'Docker_Push_${{ variables.appName }}' - solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' - buildConfiguration: 'Release' - backendProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.Presentation' - shouldRunUnitTests: false - shouldRunIntegrationTests: true - integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj' + #solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' + #buildConfiguration: 'Release' + #backendProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.Presentation' + #shouldRunUnitTests: false + #shouldRunIntegrationTests: true + #integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj' dockerRegistryUrl: 'docker.io/kaminome' dockerBuildParameterUrl: 'https://auth-eventtriangle.razumovsky.me/' imageRepository: 'auth-service' @@ -39,8 +39,8 @@ stages: shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' - sonarCloudEnabled: true - sonarCloudServiceConnection: 'SonarCloud_Service_Connection' + #sonarCloudEnabled: true + #sonarCloudServiceConnection: 'SonarCloud_Service_Connection' workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' - stage: 'Build_Test_Scan_${{ variables.appName }}' @@ -55,14 +55,14 @@ stages: shouldRunUnitTests: false shouldRunIntegrationTests: true integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj' - dockerRegistryUrl: 'docker.io/kaminome' - dockerBuildParameterUrl: 'https://auth-eventtriangle.razumovsky.me/' - imageRepository: 'auth-service' - dockerfilePath: '$(System.DefaultWorkingDirectory)/src/authorization/Dockerfile' - dockerServiceConnection: 'Docker_Hub_Connection' - shouldPushToAcr: true - acrRegistryUrl: 'acrsharedd01.azurecr.io' - acrServiceConnection: 'Azure_ACR_Connection' + #dockerRegistryUrl: 'docker.io/kaminome' + #dockerBuildParameterUrl: 'https://auth-eventtriangle.razumovsky.me/' + #imageRepository: 'auth-service' + #dockerfilePath: '$(System.DefaultWorkingDirectory)/src/authorization/Dockerfile' + #dockerServiceConnection: 'Docker_Hub_Connection' + #shouldPushToAcr: true + #acrRegistryUrl: 'acrsharedd01.azurecr.io' + #acrServiceConnection: 'Azure_ACR_Connection' sonarCloudEnabled: true sonarCloudServiceConnection: 'SonarCloud_Service_Connection' - workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' + #workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' diff --git a/azure-pipelines/build/build-consumer.yml b/azure-pipelines/build/build-consumer.yml index c862b97..d2a9d78 100644 --- a/azure-pipelines/build/build-consumer.yml +++ b/azure-pipelines/build/build-consumer.yml @@ -25,13 +25,13 @@ stages: - template: ../templates/docker-build-push-jobs.yml parameters: JobName: 'Docker_Push_${{ variables.appName }}' - solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' - buildConfiguration: 'Release' - backendProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.Presentation' - unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.UnitTests/EventTriangleAPI.Consumer.UnitTests.csproj' - shouldRunUnitTests: true - shouldRunIntegrationTests: true - integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.IntegrationTests/EventTriangleAPI.Consumer.IntegrationTests.csproj' + #solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' + #buildConfiguration: 'Release' + #backendProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.Presentation' + #unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.UnitTests/EventTriangleAPI.Consumer.UnitTests.csproj' + #shouldRunUnitTests: true + #shouldRunIntegrationTests: true + #integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.IntegrationTests/EventTriangleAPI.Consumer.IntegrationTests.csproj' dockerRegistryUrl: 'docker.io/kaminome' imageRepository: 'consumer-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/consumer/Dockerfile' @@ -39,7 +39,7 @@ stages: shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' - sonarCloudEnabled: false + #sonarCloudEnabled: false workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' - stage: 'Build_Test_Scan_${{ variables.appName }}' @@ -55,12 +55,12 @@ stages: shouldRunUnitTests: true shouldRunIntegrationTests: true integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.IntegrationTests/EventTriangleAPI.Consumer.IntegrationTests.csproj' - dockerRegistryUrl: 'docker.io/kaminome' - imageRepository: 'consumer-service' - dockerfilePath: '$(System.DefaultWorkingDirectory)/src/consumer/Dockerfile' - dockerServiceConnection: 'Docker_Hub_Connection' - shouldPushToAcr: true - acrRegistryUrl: 'acrsharedd01.azurecr.io' - acrServiceConnection: 'Azure_ACR_Connection' + #dockerRegistryUrl: 'docker.io/kaminome' + #imageRepository: 'consumer-service' + #dockerfilePath: '$(System.DefaultWorkingDirectory)/src/consumer/Dockerfile' + #dockerServiceConnection: 'Docker_Hub_Connection' + #shouldPushToAcr: true + #acrRegistryUrl: 'acrsharedd01.azurecr.io' + #acrServiceConnection: 'Azure_ACR_Connection' sonarCloudEnabled: false - workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' + #workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' diff --git a/azure-pipelines/build/build-sender.yml b/azure-pipelines/build/build-sender.yml index 71b1288..8c3baff 100644 --- a/azure-pipelines/build/build-sender.yml +++ b/azure-pipelines/build/build-sender.yml @@ -25,13 +25,13 @@ stages: - template: ../templates/docker-build-push-jobs.yml parameters: JobName: 'Docker_Push_${{ variables.appName }}' - solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' - buildConfiguration: 'Release' - backendProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.Presentation' - unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.UnitTests/EventTriangleAPI.Sender.UnitTests.csproj' - shouldRunIntegrationTests: true - shouldRunUnitTests: true - integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.IntegrationTests/EventTriangleAPI.Sender.IntegrationTests.csproj' + #solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' + #buildConfiguration: 'Release' + #backendProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.Presentation' + #unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.UnitTests/EventTriangleAPI.Sender.UnitTests.csproj' + #shouldRunIntegrationTests: true + #shouldRunUnitTests: true + #integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.IntegrationTests/EventTriangleAPI.Sender.IntegrationTests.csproj' dockerRegistryUrl: 'docker.io/kaminome' imageRepository: 'sender-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/sender/Dockerfile' @@ -39,5 +39,28 @@ stages: shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' - sonarCloudEnabled: false + #sonarCloudEnabled: false workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' + + - stage: 'Build_Test_Scan_${{ variables.appName }}' + displayName: 'Build_Test_Scan_${{ variables.appName }}' + jobs: + - template: ../templates/build-test-scan-jobs.yml + parameters: + JobName: 'Build_Test_Scan_${{ variables.appName }}' + solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' + buildConfiguration: 'Release' + backendProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.Presentation' + unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.UnitTests/EventTriangleAPI.Sender.UnitTests.csproj' + shouldRunIntegrationTests: true + shouldRunUnitTests: true + integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.IntegrationTests/EventTriangleAPI.Sender.IntegrationTests.csproj' + #dockerRegistryUrl: 'docker.io/kaminome' + #imageRepository: 'sender-service' + #dockerfilePath: '$(System.DefaultWorkingDirectory)/src/sender/Dockerfile' + #dockerServiceConnection: 'Docker_Hub_Connection' + #shouldPushToAcr: true + #acrRegistryUrl: 'acrsharedd01.azurecr.io' + #acrServiceConnection: 'Azure_ACR_Connection' + sonarCloudEnabled: false + #workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' diff --git a/azure-pipelines/templates/build-test-scan-jobs.yml b/azure-pipelines/templates/build-test-scan-jobs.yml index 1471fe0..7fe0038 100644 --- a/azure-pipelines/templates/build-test-scan-jobs.yml +++ b/azure-pipelines/templates/build-test-scan-jobs.yml @@ -3,10 +3,10 @@ parameters: displayName: 'Job Name' type: string - - name: workingDirectoryForDocker - displayName: 'Working directory for Docker Build' - default: '$(System.DefaultWorkingDirectory)/src' - type: string + # - name: workingDirectoryForDocker + # displayName: 'Working directory for Docker Build' + # default: '$(System.DefaultWorkingDirectory)/src' + # type: string - name: solution displayName: 'Solution file path' @@ -44,42 +44,42 @@ parameters: default: '6.x' type: string - - name: dockerRegistryUrl - type: string - displayName: 'DockerHub Registry URL. For Docker Hub it is: docker.io/kaminome.' + # - name: dockerRegistryUrl + # type: string + # displayName: 'DockerHub Registry URL. For Docker Hub it is: docker.io/kaminome.' - - name: shouldPushToDockerHub - type: boolean - default: false + # - name: shouldPushToDockerHub + # type: boolean + # default: false - - name: shouldPushToAcr - type: boolean - default: false + # - name: shouldPushToAcr + # type: boolean + # default: false - - name: acrRegistryUrl - type: string - displayName: 'ACR Registry URL. For ACR it is FQDN URL of container registry: azuredevopsacrd01.azurecr.io' + # - name: acrRegistryUrl + # type: string + # displayName: 'ACR Registry URL. For ACR it is FQDN URL of container registry: azuredevopsacrd01.azurecr.io' - - name: imageRepository - displayName: 'Image Repository name' - type: string + # - name: imageRepository + # displayName: 'Image Repository name' + # type: string - - name: dockerfilePath - displayName: 'Dockerfile path' - type: string + # - name: dockerfilePath + # displayName: 'Dockerfile path' + # type: string - - name: dockerServiceConnection - displayName: 'Docker container registry service connection in Azure DevOps.' - type: string + # - name: dockerServiceConnection + # displayName: 'Docker container registry service connection in Azure DevOps.' + # type: string - - name: acrServiceConnection - displayName: 'Azure container registry service connection in Azure DevOps.' - type: string + # - name: acrServiceConnection + # displayName: 'Azure container registry service connection in Azure DevOps.' + # type: string - - name: dockerBuildParameterUrl - displayName: 'Build parameter for Docker: Base URL' - default: 'https://auth.eventtriangle.razumovsky.me/' - type: string + # - name: dockerBuildParameterUrl + # displayName: 'Build parameter for Docker: Base URL' + # default: 'https://auth.eventtriangle.razumovsky.me/' + # type: string - name: dotnetSdkVersion type: string From 4abea83dfcfbcd62a3ef4f4801551bf3bff97de0 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 23:36:11 +0200 Subject: [PATCH 19/32] remove commented code --- azure-pipelines/build/build-auth.yml | 17 ---- azure-pipelines/build/build-consumer.yml | 16 ---- azure-pipelines/build/build-sender.yml | 16 ---- .../templates/build-test-scan-jobs.yml | 92 ------------------- 4 files changed, 141 deletions(-) diff --git a/azure-pipelines/build/build-auth.yml b/azure-pipelines/build/build-auth.yml index f103af7..43602ba 100644 --- a/azure-pipelines/build/build-auth.yml +++ b/azure-pipelines/build/build-auth.yml @@ -25,12 +25,6 @@ stages: - template: ../templates/docker-build-push-jobs.yml parameters: JobName: 'Docker_Push_${{ variables.appName }}' - #solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' - #buildConfiguration: 'Release' - #backendProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.Presentation' - #shouldRunUnitTests: false - #shouldRunIntegrationTests: true - #integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj' dockerRegistryUrl: 'docker.io/kaminome' dockerBuildParameterUrl: 'https://auth-eventtriangle.razumovsky.me/' imageRepository: 'auth-service' @@ -39,8 +33,6 @@ stages: shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' - #sonarCloudEnabled: true - #sonarCloudServiceConnection: 'SonarCloud_Service_Connection' workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' - stage: 'Build_Test_Scan_${{ variables.appName }}' @@ -55,14 +47,5 @@ stages: shouldRunUnitTests: false shouldRunIntegrationTests: true integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/authorization/EventTriangleAPI.Authorization.IntegrationTests/EventTriangleAPI.Authorization.IntegrationTests.csproj' - #dockerRegistryUrl: 'docker.io/kaminome' - #dockerBuildParameterUrl: 'https://auth-eventtriangle.razumovsky.me/' - #imageRepository: 'auth-service' - #dockerfilePath: '$(System.DefaultWorkingDirectory)/src/authorization/Dockerfile' - #dockerServiceConnection: 'Docker_Hub_Connection' - #shouldPushToAcr: true - #acrRegistryUrl: 'acrsharedd01.azurecr.io' - #acrServiceConnection: 'Azure_ACR_Connection' sonarCloudEnabled: true sonarCloudServiceConnection: 'SonarCloud_Service_Connection' - #workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' diff --git a/azure-pipelines/build/build-consumer.yml b/azure-pipelines/build/build-consumer.yml index d2a9d78..a30ee53 100644 --- a/azure-pipelines/build/build-consumer.yml +++ b/azure-pipelines/build/build-consumer.yml @@ -25,13 +25,6 @@ stages: - template: ../templates/docker-build-push-jobs.yml parameters: JobName: 'Docker_Push_${{ variables.appName }}' - #solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' - #buildConfiguration: 'Release' - #backendProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.Presentation' - #unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.UnitTests/EventTriangleAPI.Consumer.UnitTests.csproj' - #shouldRunUnitTests: true - #shouldRunIntegrationTests: true - #integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.IntegrationTests/EventTriangleAPI.Consumer.IntegrationTests.csproj' dockerRegistryUrl: 'docker.io/kaminome' imageRepository: 'consumer-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/consumer/Dockerfile' @@ -39,7 +32,6 @@ stages: shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' - #sonarCloudEnabled: false workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' - stage: 'Build_Test_Scan_${{ variables.appName }}' @@ -55,12 +47,4 @@ stages: shouldRunUnitTests: true shouldRunIntegrationTests: true integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/consumer/EventTriangleAPI.Consumer.IntegrationTests/EventTriangleAPI.Consumer.IntegrationTests.csproj' - #dockerRegistryUrl: 'docker.io/kaminome' - #imageRepository: 'consumer-service' - #dockerfilePath: '$(System.DefaultWorkingDirectory)/src/consumer/Dockerfile' - #dockerServiceConnection: 'Docker_Hub_Connection' - #shouldPushToAcr: true - #acrRegistryUrl: 'acrsharedd01.azurecr.io' - #acrServiceConnection: 'Azure_ACR_Connection' sonarCloudEnabled: false - #workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' diff --git a/azure-pipelines/build/build-sender.yml b/azure-pipelines/build/build-sender.yml index 8c3baff..9244dd0 100644 --- a/azure-pipelines/build/build-sender.yml +++ b/azure-pipelines/build/build-sender.yml @@ -25,13 +25,6 @@ stages: - template: ../templates/docker-build-push-jobs.yml parameters: JobName: 'Docker_Push_${{ variables.appName }}' - #solution: '$(System.DefaultWorkingDirectory)/EventTriangleAPI.sln' - #buildConfiguration: 'Release' - #backendProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.Presentation' - #unitTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.UnitTests/EventTriangleAPI.Sender.UnitTests.csproj' - #shouldRunIntegrationTests: true - #shouldRunUnitTests: true - #integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.IntegrationTests/EventTriangleAPI.Sender.IntegrationTests.csproj' dockerRegistryUrl: 'docker.io/kaminome' imageRepository: 'sender-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/sender/Dockerfile' @@ -39,7 +32,6 @@ stages: shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' - #sonarCloudEnabled: false workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' - stage: 'Build_Test_Scan_${{ variables.appName }}' @@ -55,12 +47,4 @@ stages: shouldRunIntegrationTests: true shouldRunUnitTests: true integrationTestsProjectPath: '$(System.DefaultWorkingDirectory)/src/sender/EventTriangleAPI.Sender.IntegrationTests/EventTriangleAPI.Sender.IntegrationTests.csproj' - #dockerRegistryUrl: 'docker.io/kaminome' - #imageRepository: 'sender-service' - #dockerfilePath: '$(System.DefaultWorkingDirectory)/src/sender/Dockerfile' - #dockerServiceConnection: 'Docker_Hub_Connection' - #shouldPushToAcr: true - #acrRegistryUrl: 'acrsharedd01.azurecr.io' - #acrServiceConnection: 'Azure_ACR_Connection' sonarCloudEnabled: false - #workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' diff --git a/azure-pipelines/templates/build-test-scan-jobs.yml b/azure-pipelines/templates/build-test-scan-jobs.yml index 7fe0038..d9ea408 100644 --- a/azure-pipelines/templates/build-test-scan-jobs.yml +++ b/azure-pipelines/templates/build-test-scan-jobs.yml @@ -3,11 +3,6 @@ parameters: displayName: 'Job Name' type: string - # - name: workingDirectoryForDocker - # displayName: 'Working directory for Docker Build' - # default: '$(System.DefaultWorkingDirectory)/src' - # type: string - - name: solution displayName: 'Solution file path' type: string @@ -44,43 +39,6 @@ parameters: default: '6.x' type: string - # - name: dockerRegistryUrl - # type: string - # displayName: 'DockerHub Registry URL. For Docker Hub it is: docker.io/kaminome.' - - # - name: shouldPushToDockerHub - # type: boolean - # default: false - - # - name: shouldPushToAcr - # type: boolean - # default: false - - # - name: acrRegistryUrl - # type: string - # displayName: 'ACR Registry URL. For ACR it is FQDN URL of container registry: azuredevopsacrd01.azurecr.io' - - # - name: imageRepository - # displayName: 'Image Repository name' - # type: string - - # - name: dockerfilePath - # displayName: 'Dockerfile path' - # type: string - - # - name: dockerServiceConnection - # displayName: 'Docker container registry service connection in Azure DevOps.' - # type: string - - # - name: acrServiceConnection - # displayName: 'Azure container registry service connection in Azure DevOps.' - # type: string - - # - name: dockerBuildParameterUrl - # displayName: 'Build parameter for Docker: Base URL' - # default: 'https://auth.eventtriangle.razumovsky.me/' - # type: string - - name: dotnetSdkVersion type: string default: '10.x' @@ -137,15 +95,6 @@ jobs: displayName: Debug environment condition: succeeded() - # - task: PowerShell@2 - # displayName: 'Debug branch condition' - # condition: ne(variables['Build.SourceBranchName'], 'main') - # inputs: - # targetType: 'inline' - # script: | - # Write-Host "Running because branch is NOT main" - # Write-Host "Branch: $env:BUILD_SOURCEBRANCHNAME" - - task: DotNetCoreCLI@2 displayName: 'Dotnet restore' condition: succeeded() @@ -209,44 +158,3 @@ jobs: command: 'test' projects: '${{ parameters.integrationTestsProjectPath }}' arguments: '--no-build --configuration ${{ parameters.buildConfiguration }} --collect "Code Coverage"' - - # - task: PowerShell@2 - # displayName: 'Build Docker Image' - # condition: succeeded() - # inputs: - # targetType: 'filePath' - # filePath: '$(System.DefaultWorkingDirectory)/scripts/Build-Docker.ps1' - # arguments: "-DockerRegistryUrl ${{ parameters.dockerRegistryUrl }} - # -ImageRepository ${{ parameters.imageRepository }} - # -AcrRegistryUrl ${{ parameters.acrRegistryUrl }} - # -DockerBuildParameterUrl ${{ parameters.dockerBuildParameterUrl }} - # -DockerfilePath ${{ parameters.dockerfilePath }} - # -GitVersion $(version_step.semVer) - # -WorkingDirectory ${{ parameters.workingDirectoryForDocker }} - # -CommitSha $(version_step.ShortSha)" - # errorActionPreference: 'stop' - # pwsh: true - - # - task: Docker@2 - # displayName: 'Push to DockerHub' - # condition: and(succeeded(), eq(${{ parameters.shouldPushToDockerHub }}, true)) - # inputs: - # command: push - # containerRegistry: ${{ parameters.dockerServiceConnection }} - # repository: ${{ parameters.dockerRegistryUrl }}/${{ parameters.imageRepository }} - # tags: | - # $(version_step.semVer) - # $(version_step.semVer)-$(version_step.ShortSha) - # latest - - # - task: Docker@2 - # displayName: 'Push to ACR' - # condition: and(succeeded(), eq(${{ parameters.shouldPushToAcr }}, true)) - # inputs: - # command: push - # containerRegistry: ${{ parameters.acrServiceConnection }} - # repository: ${{ parameters.imageRepository }} - # tags: | - # $(version_step.semVer) - # $(version_step.semVer)-$(version_step.ShortSha) - # latest From 61cebe4baa4829d62294671b44500bfede50de5f Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 23:40:09 +0200 Subject: [PATCH 20/32] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2a0933..7f94e09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec - Upgrade .NET version to 10 - Organize ports for apps, containers, services - Run sonar scan only on auth service CI, skip other services +- Ignore docker compose file for azure devops CI +- Skip CI if updates was only in MD files (trigger update) +- DockerFiles optimization for faster builds +- Split CI by separate Jobs to speed up builds ## [1.0.0] - 18-Apr-2026 From a9d07fd1e254c2893dc2f63946e15584cfbe25a5 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Mon, 20 Apr 2026 23:46:10 +0200 Subject: [PATCH 21/32] remove docker build app base url --- azure-pipelines/build/build-auth.yml | 1 - azure-pipelines/pr-validation/pr-validation-auth.yml | 1 - azure-pipelines/templates/docker-build-push-jobs.yml | 6 ------ scripts/Build-Docker.ps1 | 7 +------ src/authorization/Dockerfile | 3 --- 5 files changed, 1 insertion(+), 17 deletions(-) diff --git a/azure-pipelines/build/build-auth.yml b/azure-pipelines/build/build-auth.yml index 43602ba..2250833 100644 --- a/azure-pipelines/build/build-auth.yml +++ b/azure-pipelines/build/build-auth.yml @@ -26,7 +26,6 @@ stages: parameters: JobName: 'Docker_Push_${{ variables.appName }}' dockerRegistryUrl: 'docker.io/kaminome' - dockerBuildParameterUrl: 'https://auth-eventtriangle.razumovsky.me/' imageRepository: 'auth-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/authorization/Dockerfile' dockerServiceConnection: 'Docker_Hub_Connection' diff --git a/azure-pipelines/pr-validation/pr-validation-auth.yml b/azure-pipelines/pr-validation/pr-validation-auth.yml index d63edab..8f97b79 100644 --- a/azure-pipelines/pr-validation/pr-validation-auth.yml +++ b/azure-pipelines/pr-validation/pr-validation-auth.yml @@ -60,7 +60,6 @@ stages: parameters: JobName: 'Docker_Push_${{ variables.appName }}' dockerRegistryUrl: 'docker.io/kaminome' - dockerBuildParameterUrl: 'https://auth-eventtriangle.razumovsky.me/' imageRepository: 'auth-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/authorization/Dockerfile' dockerServiceConnection: 'Docker_Hub_Connection' diff --git a/azure-pipelines/templates/docker-build-push-jobs.yml b/azure-pipelines/templates/docker-build-push-jobs.yml index 2570b62..c1d0f21 100644 --- a/azure-pipelines/templates/docker-build-push-jobs.yml +++ b/azure-pipelines/templates/docker-build-push-jobs.yml @@ -45,11 +45,6 @@ parameters: displayName: 'Azure container registry service connection in Azure DevOps.' type: string - - name: dockerBuildParameterUrl - displayName: 'Build parameter for Docker: Base URL' - default: 'https://auth.eventtriangle.razumovsky.me/' - type: string - jobs: - job: ${{ parameters.JobName }} displayName: ${{ parameters.JobName }} @@ -96,7 +91,6 @@ jobs: arguments: "-DockerRegistryUrl ${{ parameters.dockerRegistryUrl }} -ImageRepository ${{ parameters.imageRepository }} -AcrRegistryUrl ${{ parameters.acrRegistryUrl }} - -DockerBuildParameterUrl ${{ parameters.dockerBuildParameterUrl }} -DockerfilePath ${{ parameters.dockerfilePath }} -GitVersion $(version_step.semVer) -WorkingDirectory ${{ parameters.workingDirectoryForDocker }} diff --git a/scripts/Build-Docker.ps1 b/scripts/Build-Docker.ps1 index bd738ed..6c6ba11 100644 --- a/scripts/Build-Docker.ps1 +++ b/scripts/Build-Docker.ps1 @@ -8,9 +8,6 @@ param ( [Parameter(Mandatory = $true)] [string]$AcrRegistryUrl, - [Parameter(Mandatory = $true)] - [string]$DockerBuildParameterUrl, - [Parameter(Mandatory = $true)] [string]$DockerfilePath, @@ -52,8 +49,7 @@ Write-Output "ACR_SHA_IMAGE: $ACR_SHA_TAG" $sw = [System.Diagnostics.Stopwatch]::StartNew() # Build the Docker image -docker build --build-arg FRONT_API_URL="$DockerBuildParameterUrl" ` - --build-arg VERSION="$gitVersion" ` +docker build --build-arg VERSION="$gitVersion" ` -t "$GIT_VERSION_IMAGE" ` -f "$DockerfilePath" . @@ -79,7 +75,6 @@ Set-Location $InitDirectory # -DockerRegistryUrl "docker.io/kaminome"` # -ImageRepository "auth-service" ` # -AcrRegistryUrl "azuredevopsacrd01.azurecr.io" ` -# -DockerBuildParameterUrl "https://auth-eventtriangle.razumovsky.me/" ` # -DockerfilePath "E:\RiderProjects\02_DOTNET_PROJECTS\EventTriangleAPI\src\authorization\Dockerfile" ` # -GitVersion "1.0.0" ` # -CommitSha "8e33ce9" ` diff --git a/src/authorization/Dockerfile b/src/authorization/Dockerfile index 724bc17..61b41a2 100644 --- a/src/authorization/Dockerfile +++ b/src/authorization/Dockerfile @@ -23,9 +23,6 @@ RUN npm ci COPY authorization/EventTriangle.Client/src ./src -ARG FRONT_API_URL -RUN sed -i "s|https://localhost:7000/|$FRONT_API_URL|" ./src/assets/config/config.json - RUN npm run build -- --output-path dist/client ####################################################################################################### From dacc95c6f7515d75913bca1758b630b3a80908e1 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Tue, 21 Apr 2026 01:01:55 +0200 Subject: [PATCH 22/32] try config fix --- .../EventTriangleAPI.Authorization.Presentation/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/authorization/EventTriangleAPI.Authorization.Presentation/Program.cs b/src/authorization/EventTriangleAPI.Authorization.Presentation/Program.cs index dde6d80..dd271ed 100644 --- a/src/authorization/EventTriangleAPI.Authorization.Presentation/Program.cs +++ b/src/authorization/EventTriangleAPI.Authorization.Presentation/Program.cs @@ -113,9 +113,10 @@ app.UseAuthorization(); -app.MapReverseProxy(); app.MapControllers(); +app.MapReverseProxy(); + app.MigrateDatabase(); app.Map(SpaRouting.Transactions, config => config.UseSpa(spa => spa.Options.SourcePath = "/wwwroot")); From b73d45ee54ad1e8ea8926f7a81d2ca7e98a98bfe Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Tue, 21 Apr 2026 08:53:28 +0200 Subject: [PATCH 23/32] docker build kit | push to dockerhub --- azure-pipelines/build/build-auth.yml | 1 + azure-pipelines/build/build-consumer.yml | 1 + azure-pipelines/build/build-sender.yml | 1 + azure-pipelines/pr-validation/pr-validation-auth.yml | 1 + azure-pipelines/pr-validation/pr-validation-consumer.yml | 1 + azure-pipelines/pr-validation/pr-validation-sender.yml | 1 + scripts/Build-Docker.ps1 | 3 +++ 7 files changed, 9 insertions(+) diff --git a/azure-pipelines/build/build-auth.yml b/azure-pipelines/build/build-auth.yml index 2250833..a32c243 100644 --- a/azure-pipelines/build/build-auth.yml +++ b/azure-pipelines/build/build-auth.yml @@ -30,6 +30,7 @@ stages: dockerfilePath: '$(System.DefaultWorkingDirectory)/src/authorization/Dockerfile' dockerServiceConnection: 'Docker_Hub_Connection' shouldPushToAcr: true + shouldPushToDockerHub: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' workingDirectoryForDocker: '$(System.DefaultWorkingDirectory)/src' diff --git a/azure-pipelines/build/build-consumer.yml b/azure-pipelines/build/build-consumer.yml index a30ee53..3776db8 100644 --- a/azure-pipelines/build/build-consumer.yml +++ b/azure-pipelines/build/build-consumer.yml @@ -29,6 +29,7 @@ stages: imageRepository: 'consumer-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/consumer/Dockerfile' dockerServiceConnection: 'Docker_Hub_Connection' + shouldPushToDockerHub: true shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' diff --git a/azure-pipelines/build/build-sender.yml b/azure-pipelines/build/build-sender.yml index 9244dd0..e1da39f 100644 --- a/azure-pipelines/build/build-sender.yml +++ b/azure-pipelines/build/build-sender.yml @@ -29,6 +29,7 @@ stages: imageRepository: 'sender-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/sender/Dockerfile' dockerServiceConnection: 'Docker_Hub_Connection' + shouldPushToDockerHub: true shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' diff --git a/azure-pipelines/pr-validation/pr-validation-auth.yml b/azure-pipelines/pr-validation/pr-validation-auth.yml index 8f97b79..8b2a5b2 100644 --- a/azure-pipelines/pr-validation/pr-validation-auth.yml +++ b/azure-pipelines/pr-validation/pr-validation-auth.yml @@ -63,6 +63,7 @@ stages: imageRepository: 'auth-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/authorization/Dockerfile' dockerServiceConnection: 'Docker_Hub_Connection' + shouldPushToDockerHub: true shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' diff --git a/azure-pipelines/pr-validation/pr-validation-consumer.yml b/azure-pipelines/pr-validation/pr-validation-consumer.yml index 19d8fff..f84543a 100644 --- a/azure-pipelines/pr-validation/pr-validation-consumer.yml +++ b/azure-pipelines/pr-validation/pr-validation-consumer.yml @@ -63,6 +63,7 @@ stages: imageRepository: 'consumer-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/consumer/Dockerfile' dockerServiceConnection: 'Docker_Hub_Connection' + shouldPushToDockerHub: true shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' diff --git a/azure-pipelines/pr-validation/pr-validation-sender.yml b/azure-pipelines/pr-validation/pr-validation-sender.yml index d8bd536..fd265e2 100644 --- a/azure-pipelines/pr-validation/pr-validation-sender.yml +++ b/azure-pipelines/pr-validation/pr-validation-sender.yml @@ -63,6 +63,7 @@ stages: imageRepository: 'sender-service' dockerfilePath: '$(System.DefaultWorkingDirectory)/src/sender/Dockerfile' dockerServiceConnection: 'Docker_Hub_Connection' + shouldPushToDockerHub: true shouldPushToAcr: true acrRegistryUrl: 'acrsharedd01.azurecr.io' acrServiceConnection: 'Azure_ACR_Connection' diff --git a/scripts/Build-Docker.ps1 b/scripts/Build-Docker.ps1 index 6c6ba11..fc8f90e 100644 --- a/scripts/Build-Docker.ps1 +++ b/scripts/Build-Docker.ps1 @@ -23,6 +23,9 @@ param ( $ErrorActionPreference = "Stop" +# Variable to use modern Docker BuildKit +$env:DOCKER_BUILDKIT = "1" + $InitDirectory = Get-Location Write-Output "Changing directory to $WorkingDirectory" From 33e549afa8d7a31b72db69069339938f32225f51 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Tue, 21 Apr 2026 08:55:30 +0200 Subject: [PATCH 24/32] use docker buildx --- scripts/Build-Docker.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Build-Docker.ps1 b/scripts/Build-Docker.ps1 index fc8f90e..d0d181f 100644 --- a/scripts/Build-Docker.ps1 +++ b/scripts/Build-Docker.ps1 @@ -52,7 +52,7 @@ Write-Output "ACR_SHA_IMAGE: $ACR_SHA_TAG" $sw = [System.Diagnostics.Stopwatch]::StartNew() # Build the Docker image -docker build --build-arg VERSION="$gitVersion" ` +docker buildx build --load --build-arg VERSION="$gitVersion" ` -t "$GIT_VERSION_IMAGE" ` -f "$DockerfilePath" . From 8869feab7df84303394e47a0989dcededd46b644 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Tue, 21 Apr 2026 09:03:24 +0200 Subject: [PATCH 25/32] use docker cache --- scripts/Build-Docker.ps1 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/Build-Docker.ps1 b/scripts/Build-Docker.ps1 index d0d181f..be0ef22 100644 --- a/scripts/Build-Docker.ps1 +++ b/scripts/Build-Docker.ps1 @@ -49,12 +49,18 @@ Write-Output "ACR_GIT_VERSION_IMAGE: $ACR_GIT_VERSION_IMAGE" Write-Output "ACR_LATEST_VERSION_IMAGE: $ACR_LATEST_VERSION_IMAGE" Write-Output "ACR_SHA_IMAGE: $ACR_SHA_TAG" +# Try to pull cache image +docker pull "$LATEST_VERSION_IMAGE" 2>$null + $sw = [System.Diagnostics.Stopwatch]::StartNew() # Build the Docker image -docker buildx build --load --build-arg VERSION="$gitVersion" ` - -t "$GIT_VERSION_IMAGE" ` - -f "$DockerfilePath" . +docker buildx build --load ` + --build-arg VERSION="$gitVersion" ` + --cache-from "type=registry,ref=$LATEST_VERSION_IMAGE" ` + --cache-to "type=inline" ` + -t "$GIT_VERSION_IMAGE" ` + -f "$DockerfilePath" . $sw.Stop() Write-Host "Docker build occupied: $($sw.Elapsed.TotalSeconds)" From 862ba255fbf63cca258d58e85b4ae755b508b85b Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Tue, 21 Apr 2026 09:09:14 +0200 Subject: [PATCH 26/32] use docker cache --- scripts/Build-Docker.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/Build-Docker.ps1 b/scripts/Build-Docker.ps1 index be0ef22..0418e0e 100644 --- a/scripts/Build-Docker.ps1 +++ b/scripts/Build-Docker.ps1 @@ -59,6 +59,7 @@ docker buildx build --load ` --build-arg VERSION="$gitVersion" ` --cache-from "type=registry,ref=$LATEST_VERSION_IMAGE" ` --cache-to "type=inline" ` + --build-arg BUILDKIT_INLINE_CACHE=1 ` -t "$GIT_VERSION_IMAGE" ` -f "$DockerfilePath" . From 6fa42a9a17f889bac940de3f2820216c5cf548fa Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Tue, 21 Apr 2026 09:15:42 +0200 Subject: [PATCH 27/32] docker build script --- scripts/Build-Docker.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/Build-Docker.ps1 b/scripts/Build-Docker.ps1 index 0418e0e..5df1567 100644 --- a/scripts/Build-Docker.ps1 +++ b/scripts/Build-Docker.ps1 @@ -23,6 +23,12 @@ param ( $ErrorActionPreference = "Stop" +Write-Host "================================================================================" + +docker --version + +Write-Host "================================================================================" + # Variable to use modern Docker BuildKit $env:DOCKER_BUILDKIT = "1" @@ -41,6 +47,9 @@ $ACR_LATEST_VERSION_IMAGE = "$AcrRegistryUrl/$ImageRepository`:latest" $ACR_SHA_TAG = "$AcrRegistryUrl/$ImageRepository`:$GitVersion-$CommitSha" # Output image tags + +Write-Host "================================================================================" + Write-Output "DOCKERHUB_GIT_VERSION_IMAGE: $GIT_VERSION_IMAGE" Write-Output "DOCKERHUB_GIT_LATEST_VERSION_IMAGE: $LATEST_VERSION_IMAGE" Write-Output "DOCKERHUB_SHA_VERSION_IMAGE: $SHA_TAG" @@ -49,6 +58,8 @@ Write-Output "ACR_GIT_VERSION_IMAGE: $ACR_GIT_VERSION_IMAGE" Write-Output "ACR_LATEST_VERSION_IMAGE: $ACR_LATEST_VERSION_IMAGE" Write-Output "ACR_SHA_IMAGE: $ACR_SHA_TAG" +Write-Host "================================================================================" + # Try to pull cache image docker pull "$LATEST_VERSION_IMAGE" 2>$null @@ -59,7 +70,6 @@ docker buildx build --load ` --build-arg VERSION="$gitVersion" ` --cache-from "type=registry,ref=$LATEST_VERSION_IMAGE" ` --cache-to "type=inline" ` - --build-arg BUILDKIT_INLINE_CACHE=1 ` -t "$GIT_VERSION_IMAGE" ` -f "$DockerfilePath" . From 1dd335596de407210d1851206b440522e4af5b21 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Tue, 21 Apr 2026 09:33:02 +0200 Subject: [PATCH 28/32] docker build script --- scripts/Build-Docker.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/Build-Docker.ps1 b/scripts/Build-Docker.ps1 index 5df1567..9ca21cc 100644 --- a/scripts/Build-Docker.ps1 +++ b/scripts/Build-Docker.ps1 @@ -69,7 +69,6 @@ $sw = [System.Diagnostics.Stopwatch]::StartNew() docker buildx build --load ` --build-arg VERSION="$gitVersion" ` --cache-from "type=registry,ref=$LATEST_VERSION_IMAGE" ` - --cache-to "type=inline" ` -t "$GIT_VERSION_IMAGE" ` -f "$DockerfilePath" . From e4226dd94ed84308e10a9f107fd62850cc1c8fd6 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Tue, 21 Apr 2026 10:02:32 +0200 Subject: [PATCH 29/32] try optimize build --- scripts/Build-Docker.ps1 | 1 + src/.dockerignore | 16 +++++ src/authorization/Dockerfile | 68 ++++++++++++------- .../EventTriangle.Client/src/assets/.gitkeep | 0 4 files changed, 59 insertions(+), 26 deletions(-) delete mode 100644 src/authorization/EventTriangle.Client/src/assets/.gitkeep diff --git a/scripts/Build-Docker.ps1 b/scripts/Build-Docker.ps1 index 9ca21cc..5df1567 100644 --- a/scripts/Build-Docker.ps1 +++ b/scripts/Build-Docker.ps1 @@ -69,6 +69,7 @@ $sw = [System.Diagnostics.Stopwatch]::StartNew() docker buildx build --load ` --build-arg VERSION="$gitVersion" ` --cache-from "type=registry,ref=$LATEST_VERSION_IMAGE" ` + --cache-to "type=inline" ` -t "$GIT_VERSION_IMAGE" ` -f "$DockerfilePath" . diff --git a/src/.dockerignore b/src/.dockerignore index ac752ee..5e438fe 100644 --- a/src/.dockerignore +++ b/src/.dockerignore @@ -20,12 +20,16 @@ *.user *.userosscache *.sln.docstates +**/.editorconfig +*.sln +*.config # ========================= # Git # ========================= .git/ .gitignore +.gitattributes # ========================= # Logs / temp @@ -45,3 +49,15 @@ Thumbs.db # ========================= **/*Tests/ **/*.Test*/ + +# ========================= +# OTHER +# ========================= +**/bin +**/obj +**/.vs +**/.vscode +**/*.md +**/docker-compose* +.git +**/scripts diff --git a/src/authorization/Dockerfile b/src/authorization/Dockerfile index 61b41a2..cb999a8 100644 --- a/src/authorization/Dockerfile +++ b/src/authorization/Dockerfile @@ -1,19 +1,19 @@ +####################################################################################################### +# BASE RUNTIME +####################################################################################################### FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base - -ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true - WORKDIR /app - EXPOSE 8080 +ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true ####################################################################################################### -# BUILD ANGULAR +# ANGULAR BUILD (CACHE OPTIMIZED) ####################################################################################################### +FROM node:18.15.0-alpine AS angular -FROM node:18.15.0-alpine AS angularBuild - -WORKDIR /angular/EventTriangle.Client +WORKDIR /app/client +# 1. dependency layer (VERY STABLE) COPY authorization/EventTriangle.Client/package.json ./ COPY authorization/EventTriangle.Client/package-lock.json ./ COPY authorization/EventTriangle.Client/angular.json ./ @@ -21,41 +21,57 @@ COPY authorization/EventTriangle.Client/tsconfig*.json ./ RUN npm ci +# 2. source layer (changes often) COPY authorization/EventTriangle.Client/src ./src +COPY authorization/EventTriangle.Client/src/assets ./assets +COPY authorization/EventTriangle.Client/src/favicon.png ./src/favicon.png -RUN npm run build -- --output-path dist/client +RUN npm run build -- --configuration production --output-path dist/client ####################################################################################################### -# BUILD DOTNET +# DOTNET RESTORE LAYER (MOST IMPORTANT CACHE LAYER) ####################################################################################################### +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS restore +WORKDIR /src -FROM mcr.microsoft.com/dotnet/sdk:10.0 AS publish - +# ONLY csproj files first (MAXIMUM CACHE HIT RATE) WORKDIR /src -COPY ["authorization/EventTriangleAPI.Authorization.BusinessLogic/EventTriangleAPI.Authorization.BusinessLogic.csproj", "authorization/EventTriangleAPI.Authorization.BusinessLogic/"] -COPY ["authorization/EventTriangleAPI.Authorization.Domain/EventTriangleAPI.Authorization.Domain.csproj", "authorization/EventTriangleAPI.Authorization.Domain/"] -COPY ["authorization/EventTriangleAPI.Authorization.Persistence/EventTriangleAPI.Authorization.Persistence.csproj", "authorization/EventTriangleAPI.Authorization.Persistence/"] -COPY ["authorization/EventTriangleAPI.Authorization.Presentation/EventTriangleAPI.Authorization.Presentation.csproj", "authorization/EventTriangleAPI.Authorization.Presentation/"] -COPY ["shared/EventTriangleAPI.Shared.Application/EventTriangleAPI.Shared.Application.csproj", "shared/EventTriangleAPI.Shared.Application/"] -COPY ["shared/EventTriangleAPI.Shared.DTO/EventTriangleAPI.Shared.DTO.csproj", "shared/EventTriangleAPI.Shared.DTO/"] +COPY authorization/EventTriangleAPI.Authorization.BusinessLogic/*.csproj authorization/EventTriangleAPI.Authorization.BusinessLogic/ +COPY authorization/EventTriangleAPI.Authorization.Domain/*.csproj authorization/EventTriangleAPI.Authorization.Domain/ +COPY authorization/EventTriangleAPI.Authorization.Persistence/*.csproj authorization/EventTriangleAPI.Authorization.Persistence/ +COPY authorization/EventTriangleAPI.Authorization.Presentation/*.csproj authorization/EventTriangleAPI.Authorization.Presentation/ + +COPY shared/EventTriangleAPI.Shared.Application/*.csproj shared/EventTriangleAPI.Shared.Application/ +COPY shared/EventTriangleAPI.Shared.DTO/*.csproj shared/EventTriangleAPI.Shared.DTO/ -RUN dotnet restore "authorization/EventTriangleAPI.Authorization.Presentation/EventTriangleAPI.Authorization.Presentation.csproj" +RUN dotnet restore authorization/EventTriangleAPI.Authorization.Presentation/EventTriangleAPI.Authorization.Presentation.csproj + +####################################################################################################### +# DOTNET BUILD + PUBLISH +####################################################################################################### +FROM restore AS build -COPY . . +# NOW source code (this invalidates only build, not restore) +COPY authorization/ authorization/ +COPY shared/ shared/ -WORKDIR "authorization/EventTriangleAPI.Authorization.Presentation" +WORKDIR /src/authorization/EventTriangleAPI.Authorization.Presentation ARG VERSION -RUN dotnet publish "EventTriangleAPI.Authorization.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false +RUN dotnet publish -c Release \ + -p:Version=$VERSION \ + -o /app/publish \ + /p:UseAppHost=false ####################################################################################################### -# CREATE FINAL ARTIFACT +# FINAL IMAGE ####################################################################################################### - FROM base AS final WORKDIR /app -COPY --from=publish /app/publish . -COPY --from=angularBuild "/angular/EventTriangle.Client/dist/client" wwwroot + +COPY --from=build /app/publish . +COPY --from=angular /app/client/dist/client wwwroot + ENTRYPOINT ["dotnet", "EventTriangleAPI.Authorization.Presentation.dll"] diff --git a/src/authorization/EventTriangle.Client/src/assets/.gitkeep b/src/authorization/EventTriangle.Client/src/assets/.gitkeep deleted file mode 100644 index e69de29..0000000 From 6dac02ef32168dd79e338e248b6b12c75eac2c32 Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Tue, 21 Apr 2026 11:26:47 +0200 Subject: [PATCH 30/32] remove version argument docker --- scripts/Build-Docker.ps1 | 1 - src/authorization/Dockerfile | 5 +---- src/consumer/Dockerfile | 2 +- src/sender/Dockerfile | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/Build-Docker.ps1 b/scripts/Build-Docker.ps1 index 5df1567..2d6d2ee 100644 --- a/scripts/Build-Docker.ps1 +++ b/scripts/Build-Docker.ps1 @@ -70,7 +70,6 @@ docker buildx build --load ` --build-arg VERSION="$gitVersion" ` --cache-from "type=registry,ref=$LATEST_VERSION_IMAGE" ` --cache-to "type=inline" ` - -t "$GIT_VERSION_IMAGE" ` -f "$DockerfilePath" . $sw.Stop() diff --git a/src/authorization/Dockerfile b/src/authorization/Dockerfile index cb999a8..215458b 100644 --- a/src/authorization/Dockerfile +++ b/src/authorization/Dockerfile @@ -60,10 +60,7 @@ WORKDIR /src/authorization/EventTriangleAPI.Authorization.Presentation ARG VERSION -RUN dotnet publish -c Release \ - -p:Version=$VERSION \ - -o /app/publish \ - /p:UseAppHost=false +RUN dotnet publish -c Release -o /app/publish /p:UseAppHost=false ####################################################################################################### # FINAL IMAGE diff --git a/src/consumer/Dockerfile b/src/consumer/Dockerfile index 0624b36..77bc7df 100644 --- a/src/consumer/Dockerfile +++ b/src/consumer/Dockerfile @@ -16,7 +16,7 @@ RUN dotnet restore "consumer/EventTriangleAPI.Consumer.Presentation/EventTriangl COPY . . WORKDIR "consumer/EventTriangleAPI.Consumer.Presentation" ARG VERSION -RUN dotnet publish "EventTriangleAPI.Consumer.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false +RUN dotnet publish "EventTriangleAPI.Consumer.Presentation.csproj" -c Release -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app diff --git a/src/sender/Dockerfile b/src/sender/Dockerfile index f05f7a3..4e45b1b 100644 --- a/src/sender/Dockerfile +++ b/src/sender/Dockerfile @@ -19,7 +19,7 @@ RUN dotnet restore "sender/EventTriangleAPI.Sender.Presentation/EventTriangleAPI COPY . . WORKDIR "sender/EventTriangleAPI.Sender.Presentation" ARG VERSION -RUN dotnet publish "EventTriangleAPI.Sender.Presentation.csproj" -c Release -p:Version=$VERSION -o /app/publish /p:UseAppHost=false +RUN dotnet publish "EventTriangleAPI.Sender.Presentation.csproj" -c Release -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app From b343c7f016d5d2d2d5b02feee0cb2d7a8ccf478e Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Tue, 21 Apr 2026 11:31:39 +0200 Subject: [PATCH 31/32] fix build script --- scripts/Build-Docker.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Build-Docker.ps1 b/scripts/Build-Docker.ps1 index 2d6d2ee..1ce5a8f 100644 --- a/scripts/Build-Docker.ps1 +++ b/scripts/Build-Docker.ps1 @@ -67,9 +67,9 @@ $sw = [System.Diagnostics.Stopwatch]::StartNew() # Build the Docker image docker buildx build --load ` - --build-arg VERSION="$gitVersion" ` --cache-from "type=registry,ref=$LATEST_VERSION_IMAGE" ` --cache-to "type=inline" ` + -t "$GIT_VERSION_IMAGE" ` -f "$DockerfilePath" . $sw.Stop() From 9267e1626fb36dd68c18bdd08f436c9d1ce30a7c Mon Sep 17 00:00:00 2001 From: Petro Kolosov Date: Tue, 21 Apr 2026 12:26:29 +0200 Subject: [PATCH 32/32] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f94e09..440f651 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec - Skip CI if updates was only in MD files (trigger update) - DockerFiles optimization for faster builds - Split CI by separate Jobs to speed up builds +- Use Docker cache in CI +- Transform Frontend URL by using volume mount and configmaps ## [1.0.0] - 18-Apr-2026