feat(templateTaskGenerator): настройки развертывания CI/CD

This commit is contained in:
Mikhail Kuznetsov
2025-08-26 12:19:55 +10:00
parent 446a5579f3
commit 0c2bcd188b
6 changed files with 116 additions and 5 deletions

View File

@@ -14,6 +14,7 @@ variables:
PROD_TEMPLATE_DISTRIBOTOR: "parr/parr-template-distributor"
PROD_TEMPLATE_ACTIVATOR: "parr/parr-template-activator"
PROD_TEMPLATE_GENERATOR: "parr/parr-template-generator"
PROD_TEMPLATE_TASK_GENERATOR: "parr/parr-template-task-generator"
PROD_JOB_AUTO_CONTROL: "parr/parr-job-auto-control"
stages:
@@ -688,7 +689,6 @@ prod_template_generator_build:
tags:
- docker
prod_template_generator_deploy:
stage: deploy
environment:
@@ -708,6 +708,53 @@ prod_template_generator_deploy:
- ${RUNNER}
### TEMPLATE TASK GENERATOR PROD ###
prod_template_task_generator_build:
stage: build
only:
- /^ttg[0-9]+\.[0-9]+\.[0-9]+$/
except:
- branches
services:
- name: docker:20.10.21-dind
command: [
"--insecure-registry=10.99.253.167:8090",
"--registry-mirror=http://10.99.253.167:8090",
"--insecure-registry=harbor.dvgd.rzd",
"--tls=false"
]
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
script:
- APP_VERSION=$(echo $CI_COMMIT_TAG | tr -d ttg)
- IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/ttg/v/g')
- docker build -t $REPO/$PROD_TEMPLATE_TASK_GENERATOR:$IMAGE_VERSION -t $REPO/$PROD_TEMPLATE_TASK_GENERATOR:latest -t $PROD_TEMPLATE_TASK_GENERATOR:$IMAGE_VERSION -t $PROD_TEMPLATE_TASK_GENERATOR:latest --build-arg app_version=$APP_VERSION -f PARR.TemplateTaskGeneratorWorker/Dockerfile .
- docker login -u $HARBOR_PUSH_USER -p $HARBOR_PUSH_PASS $REPO
- docker push --all-tags $REPO/$PROD_TEMPLATE_TASK_GENERATOR
tags:
- docker
prod_template_task_generator_deploy:
stage: deploy
environment:
name: parr-template-task-generator
only:
- /^ttg[0-9]+\.[0-9]+\.[0-9]+$/
except:
- branches
script:
- IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/ttg/v/g')
- docker login -u $HARBOR_PULL_USER -p $HARBOR_PULL_PASS $REPO
- tag=$IMAGE_VERSION docker stack deploy -c docker-compose.template-task-enerator.yml parr-template-task-generator --with-registry-auth
parallel:
matrix:
- RUNNER: shell-api-swarm-01
tags:
- ${RUNNER}
### JOB AUTO CONTROL PROD ###
prod_job_auto_control_build:
stage: build

View File

@@ -0,0 +1,33 @@
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
# This stage is used when running from VS in fast mode (Default for Debug configuration)
FROM 10.99.253.167:8090/dotnet/runtime:7.0 AS base
WORKDIR /app
# This stage is used to build the service project
FROM 10.99.253.167:8090/dotnet/sdk:7.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["NuGet.config", "."]
COPY ["TemplateTaskGeneratorWorker/PARR.TemplateTaskGeneratorWorker.csproj", "TemplateTaskGeneratorWorker/"]
COPY ["TemplateTaskGenerator/PARR.TemplateTaskGenerator.csproj", "TemplateTaskGenerator/"]
COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"]
COPY ["PARR.Common/PARR.Common.csproj", "PARR.Common/"]
COPY ["PARR.Constants/PARR.Constants.csproj", "PARR.Constants/"]
COPY ["PARR.DAL/PARR.DAL.csproj", "PARR.DAL/"]
RUN dotnet restore "./TemplateTaskGeneratorWorker/PARR.TemplateTaskGeneratorWorker.csproj"
COPY . .
WORKDIR "/src/TemplateTaskGeneratorWorker"
RUN dotnet build "./PARR.TemplateTaskGeneratorWorker.csproj" -c $BUILD_CONFIGURATION -o /app/build
# This stage is used to publish the service project to be copied to the final stage
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./PARR.TemplateTaskGeneratorWorker.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false /p:Version=$app_version
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "PARR.TemplateTaskGeneratorWorker.dll"]

View File

@@ -5,11 +5,13 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-TemplateTaskGeneratorWorker-31809d29-599f-4a6d-8700-45ea8d9e7649</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Elastic.CommonSchema.Serilog" Version="8.6.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />

View File

@@ -1,11 +1,14 @@
{
{
"profiles": {
"TemplateTaskGeneratorWorker": {
"commandName": "Project",
"dotnetRunMessages": true,
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": true
},
"Container (Dockerfile)": {
"commandName": "Docker"
}
}
}

View File

@@ -9,6 +9,7 @@
<DockerServiceName>parr.api</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.template-task-generator.yml" />
<None Include="docker-compose.template-generator.yml" />
<None Include="docker-compose.aihit-loader.yml" />
<None Include="docker-compose.aihit-relationships-syncer.yml" />

View File

@@ -0,0 +1,25 @@
version: '3.4'
#PARR TEMPLATE TASK GENERATOR
services:
parr-template-task-generator:
image: harbor.dvgd.rzd/parr/parr-template-task-generator:${tag-latest}
environment:
- ASPNETCORE_ENVIRONMENT=Production
- TZ=Europe/Moscow
logging:
driver: fluentd
options:
fluentd-address: dvgd-efk-01.dvgd.oao.rzd:24224
fluentd-retry-wait: '30s'
fluentd-max-retries: '30'
tag: parr.template-task-generator.serilog
deploy:
replicas: 1
networks:
parr-network:
networks:
parr-network:
driver: overlay
external: true