feat(cicd): в cicd добавлен template matcher

This commit is contained in:
Mikhail Trubnikov
2025-11-20 14:24:03 +10:00
parent d90924bfa2
commit 7081e30734
6 changed files with 88 additions and 7 deletions

View File

@@ -16,6 +16,7 @@ variables:
PROD_TEMPLATE_GENERATOR: "parr/parr-template-generator" PROD_TEMPLATE_GENERATOR: "parr/parr-template-generator"
PROD_TEMPLATE_TASK_GENERATOR: "parr/parr-template-task-generator" PROD_TEMPLATE_TASK_GENERATOR: "parr/parr-template-task-generator"
PROD_JOB_AUTO_CONTROL: "parr/parr-job-auto-control" PROD_JOB_AUTO_CONTROL: "parr/parr-job-auto-control"
PROD_TEMPLATE_MATCHER: "parr/parr-template-matcher"
stages: stages:
- build - build
@@ -801,3 +802,53 @@ prod_job_auto_control_deploy:
- RUNNER: shell-api-swarm-01 - RUNNER: shell-api-swarm-01
tags: tags:
- ${RUNNER} - ${RUNNER}
### TEMPLATE MATCHER PROD ###
prod_template_matcher_build:
stage: build
only:
- /^tm[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 tm)
- IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/tm/v/g')
- docker build -t $REPO/$PROD_TEMPLATE_MATCHER:$IMAGE_VERSION -t $REPO/$PROD_TEMPLATE_MATCHER:latest -t $PROD_TEMPLATE_MATCHER:$IMAGE_VERSION -t $PROD_TEMPLATE_MATCHER:latest --build-arg app_version=$APP_VERSION -f PARR.TemplateMatcherWorker/Dockerfile .
- docker login -u $HARBOR_PUSH_USER -p $HARBOR_PUSH_PASS $REPO
- docker push --all-tags $REPO/$PROD_TEMPLATE_MATCHER
tags:
- docker
prod_template_matcher_deploy:
stage: deploy
environment:
name: parr-template-activator
only:
- /^tm[0-9]+\.[0-9]+\.[0-9]+$/
except:
- branches
script:
- IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/tm/v/g')
- docker login -u $HARBOR_PULL_USER -p $HARBOR_PULL_PASS $REPO
- tag=$IMAGE_VERSION docker stack deploy -c docker-compose.template-matcher.yml parr-template-matcher --with-registry-auth
parallel:
matrix:
- RUNNER: shell-api-swarm-01
tags:
- ${RUNNER}

View File

@@ -7,5 +7,8 @@
"Microsoft.Hosting.Lifetime": "Information" "Microsoft.Hosting.Lifetime": "Information"
} }
} }
},
"MqSettings": {
"HostName": "10.99.253.216"
} }
} }

View File

@@ -30,7 +30,7 @@
"RepeatEvery": "00:10:00" "RepeatEvery": "00:10:00"
}, },
"MqSettings": { "MqSettings": {
"HostName": "10.99.253.216", "HostName": "parr-rabbitmq",
"QueueName": "parr-aihit-data", "QueueName": "parr-aihit-data",
"User": "aihit_syncer", "User": "aihit_syncer",
"Password": "afsdgDGjhfiU76496as42!@", "Password": "afsdgDGjhfiU76496as42!@",

View File

@@ -1,6 +1,4 @@
using PARR.DAL.Models.Job; namespace PARR.API.Contracts.V1.Responses
namespace PARR.API.Contracts.V1.Responses
{ {
public class JobGroupBaseResponse public class JobGroupBaseResponse
{ {
@@ -20,7 +18,7 @@ namespace PARR.API.Contracts.V1.Responses
public DateTimeOffset ReferenceDate { get; set; } public DateTimeOffset ReferenceDate { get; set; }
public JobGroupTypeResponse GroupType { get; set; } public required JobGroupTypeResponse GroupType { get; set; }
// public bool IsAutoDistributionEnabled { get; set; } // public bool IsAutoDistributionEnabled { get; set; }

View File

@@ -46,7 +46,8 @@ namespace PARR.TemplateMatcher
var msg = JsonSerializer.Serialize(mqRequest); var msg = JsonSerializer.Serialize(mqRequest);
var result = new MqSendResult { IsSuccess = true };//TODO await mqService.SendAsync(mqSettings.TemplateGenerator, new[] { msg }); //var result = new MqSendResult { IsSuccess = true };
var result = await mqService.SendAsync(mqSettings.TemplateGenerator, new[] { msg });
if (result.IsSuccess) if (result.IsSuccess)
logger.LogInformation($"Отправлен запрос на создание шаблона: {msg}"); logger.LogInformation($"Отправлен запрос на создание шаблона: {msg}");

View File

@@ -0,0 +1,28 @@
version: '3.9'
#TEMPLATE MATCHER
services:
parr-template-matcher:
image: harbor.dvgd.rzd/parr/parr-template-matcher:${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: '10s'
fluentd-max-retries: '30'
fluentd-async: 'true'
fluentd-buffer-limit: '52428800'
tag: parr.template-matcher.serilog
deploy:
replicas: 4
networks:
- parr-network
networks:
parr-network:
driver: overlay
external: true