From 20b520eda1eb4299af11ebe85e0603974f001e74 Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Fri, 16 Dec 2022 17:57:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D0=BE=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B0=D1=85=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BD=D0=BE=D0=B2=D1=8B=D1=85=20=D0=B8=20=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D1=80=D1=8B=D1=85=20MR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../context/domain/entity/Pipeline.java | 5 ++- .../notify/pipeline/PipelineNotify.java | 1 + .../context/repository/ProjectRepository.java | 2 ++ .../context/service/ProjectService.java | 5 +-- .../core/service/impl/CleanServiceImpl.java | 6 ++++ .../service/impl/PipelineServiceImpl.java | 2 -- .../core/service/impl/ProjectServiceImpl.java | 13 ++++--- .../core/service/parser/DiscussionParser.java | 7 +++- .../service/parser/MergeRequestParser.java | 36 +++++++++---------- .../core/service/parser/PipelineParser.java | 31 ++++++++-------- .../data/impl/ProjectRepositoryImpl.java | 5 +++ .../gitlab/data/jpa/ProjectJpaRepository.java | 6 ++++ .../gitlab/scheduler/SchedulerService.java | 14 ++++---- gitlab-app/src/main/resources/application.yml | 6 +++- 14 files changed, 80 insertions(+), 59 deletions(-) diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Pipeline.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Pipeline.java index 5da5094..16b8bc1 100644 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Pipeline.java +++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Pipeline.java @@ -50,9 +50,8 @@ public class Pipeline { @Column(name = "web_url") private String webUrl; - @ManyToOne - @JoinColumn(name = "project_id") - private Project project; + @Column(name = "project_id") + private Long projectId; @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}) @JoinColumn(name = "person_id") diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/pipeline/PipelineNotify.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/pipeline/PipelineNotify.java index 28e7be1..95f986b 100644 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/pipeline/PipelineNotify.java +++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/pipeline/PipelineNotify.java @@ -11,6 +11,7 @@ import static dev.struchkov.haiti.utils.Strings.escapeMarkdown; /** * @author upagge 17.01.2021 */ +//TODO [16.12.2022|uPagge]: Нужно реализовать заполнение projectName public record PipelineNotify( Long pipelineId, String projectName, diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/ProjectRepository.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/ProjectRepository.java index 5130554..cd1c327 100644 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/ProjectRepository.java +++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/repository/ProjectRepository.java @@ -23,4 +23,6 @@ public interface ProjectRepository { Page findAllById(Pageable pagination); + Set findAllIds(); + } diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/ProjectService.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/ProjectService.java index 343e5c5..e3c1a13 100644 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/ProjectService.java +++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/service/ProjectService.java @@ -3,8 +3,6 @@ package dev.struchkov.bot.gitlab.context.service; import dev.struchkov.bot.gitlab.context.domain.ExistContainer; import dev.struchkov.bot.gitlab.context.domain.entity.Project; import lombok.NonNull; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; import java.util.List; import java.util.Set; @@ -20,12 +18,11 @@ public interface ProjectService { Project getByIdOrThrow(@NonNull Long projectId); - Page getAll(@NonNull Pageable pagination); - List createAll(List newProjects); boolean existsById(Long projectId); ExistContainer existsById(Set projectIds); + Set getAllIds(); } diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/CleanServiceImpl.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/CleanServiceImpl.java index e8628e5..2e0ccb6 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/CleanServiceImpl.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/CleanServiceImpl.java @@ -8,6 +8,7 @@ import dev.struchkov.bot.gitlab.context.service.CleanService; import dev.struchkov.bot.gitlab.context.service.MergeRequestsService; import dev.struchkov.bot.gitlab.context.service.PipelineService; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Service; @@ -24,6 +25,7 @@ import static dev.struchkov.bot.gitlab.context.domain.MergeRequestState.MERGED; * * @author upagge 08.02.2021 */ +@Slf4j @Service @RequiredArgsConstructor public class CleanServiceImpl implements CleanService { @@ -38,6 +40,7 @@ public class CleanServiceImpl implements CleanService { @Override public void cleanOldMergedRequests() { + log.debug("Старт очистки старых MR"); int page = 0; Page mergeRequestSheet = mergeRequestsService.getAll(MR_CLEAN_FILTER, PageRequest.of(page, COUNT)); @@ -50,10 +53,12 @@ public class CleanServiceImpl implements CleanService { mergeRequestSheet = mergeRequestsService.getAll(MR_CLEAN_FILTER, PageRequest.of(++page, COUNT)); } + log.debug("Конец очистки старых MR"); } @Override public void cleanOldPipelines() { + log.debug("Старт очистки старых пайплайнов"); int page = 0; final PipelineFilter filter = cleanPipelineFilter(); Page sheet = pipelineService.getAll(filter, PageRequest.of(page, COUNT)); @@ -67,6 +72,7 @@ public class CleanServiceImpl implements CleanService { sheet = pipelineService.getAll(filter, PageRequest.of(page, COUNT)); } + log.debug("Конец очистки старых пайплайнов"); } private PipelineFilter cleanPipelineFilter() { diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/PipelineServiceImpl.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/PipelineServiceImpl.java index 623ba15..dcb81f9 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/PipelineServiceImpl.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/PipelineServiceImpl.java @@ -61,7 +61,6 @@ public class PipelineServiceImpl implements PipelineService { PipelineNotify.builder() .newStatus(pipeline.getStatus().name()) .pipelineId(pipeline.getId()) - .projectName(pipeline.getProject().getName()) .refName(pipeline.getRef()) .webUrl(pipeline.getWebUrl()) .oldStatus(oldStatus) @@ -76,7 +75,6 @@ public class PipelineServiceImpl implements PipelineService { .orElseThrow(notFoundException("Pipeline не найден")); if (!oldPipeline.getUpdated().equals(pipeline.getUpdated())) { - pipeline.setProject(oldPipeline.getProject()); notifyNewPipeline(pipeline, oldPipeline.getStatus().name()); return repository.save(pipeline); } diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/ProjectServiceImpl.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/ProjectServiceImpl.java index 120f01d..2750f10 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/ProjectServiceImpl.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/ProjectServiceImpl.java @@ -10,8 +10,6 @@ import dev.struchkov.bot.gitlab.context.service.PersonService; import dev.struchkov.bot.gitlab.context.service.ProjectService; import lombok.NonNull; import lombok.RequiredArgsConstructor; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -60,11 +58,6 @@ public class ProjectServiceImpl implements ProjectService { .orElseThrow(notFoundException("Проект не найден")); } - @Override - public Page getAll(@NonNull Pageable pagination) { - return repository.findAllById(pagination); - } - @Override @Transactional public List createAll(List newProjects) { @@ -93,6 +86,12 @@ public class ProjectServiceImpl implements ProjectService { } } + @Override + @Transactional(readOnly = true) + public Set getAllIds() { + return repository.findAllIds(); + } + private void notifyAboutNewProject(Project newProject, String authorName) { notifyService.send( NewProjectNotify.builder() diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/DiscussionParser.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/DiscussionParser.java index b22a778..882710e 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/DiscussionParser.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/DiscussionParser.java @@ -12,6 +12,7 @@ import dev.struchkov.bot.gitlab.core.config.properties.PersonProperty; import dev.struchkov.bot.gitlab.sdk.domain.DiscussionJson; import dev.struchkov.haiti.utils.network.HttpParse; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.core.convert.ConversionService; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -39,6 +40,7 @@ import static dev.struchkov.haiti.utils.network.HttpParse.ACCEPT; * * @author upagge 11.02.2021 */ +@Slf4j @Component @RequiredArgsConstructor public class DiscussionParser { @@ -56,6 +58,7 @@ public class DiscussionParser { * Поиск новых обсуждений */ public void scanNewDiscussion() { + log.debug("Старт обработки новых дискуссий"); int page = 0; Page mergeRequestSheet = mergeRequestsService.getAll(PageRequest.of(page, COUNT)); @@ -68,6 +71,7 @@ public class DiscussionParser { mergeRequestSheet = mergeRequestsService.getAll(PageRequest.of(++page, COUNT)); } + log.debug("Конец обработки новых дискуссий"); } private void processingMergeRequest(MergeRequest mergeRequest) { @@ -151,6 +155,7 @@ public class DiscussionParser { * Сканирование старых обсуждений на предмет новых комментарие */ public void scanOldDiscussions() { + log.debug("Старт обработки старых дискуссий"); int page = 0; Page discussionPage = discussionService.getAll(PageRequest.of(page, COUNT)); @@ -183,7 +188,7 @@ public class DiscussionParser { discussionPage = discussionService.getAll(PageRequest.of(++page, COUNT)); } - + log.debug("Конец обработки старых дискуссий"); } private Optional getOldDiscussionJson(Discussion discussion) { diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/MergeRequestParser.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/MergeRequestParser.java index 61d171e..221f89e 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/MergeRequestParser.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/MergeRequestParser.java @@ -5,7 +5,6 @@ import dev.struchkov.bot.gitlab.context.domain.IdAndStatusPr; import dev.struchkov.bot.gitlab.context.domain.MergeRequestState; import dev.struchkov.bot.gitlab.context.domain.entity.MergeRequest; import dev.struchkov.bot.gitlab.context.domain.entity.Person; -import dev.struchkov.bot.gitlab.context.domain.entity.Project; import dev.struchkov.bot.gitlab.context.service.MergeRequestsService; import dev.struchkov.bot.gitlab.context.service.ProjectService; import dev.struchkov.bot.gitlab.core.config.properties.GitlabProperty; @@ -17,8 +16,6 @@ import dev.struchkov.haiti.utils.network.HttpParse; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.core.convert.ConversionService; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Service; import java.text.MessageFormat; @@ -51,6 +48,7 @@ public class MergeRequestParser { private final PersonProperty personProperty; public void parsingOldMergeRequest() { + log.debug("Старт обработки старых MR"); final Set existIds = mergeRequestsService.getAllId(OLD_STATUSES); final List mergeRequests = existIds.stream() @@ -68,27 +66,23 @@ public class MergeRequestParser { personMapping(mergeRequests); mergeRequestsService.updateAll(mergeRequests); } - + log.debug("Конец обработки старых MR"); } public void parsingNewMergeRequest() { - int page = 0; - Page projectSheet = projectService.getAll(PageRequest.of(page, COUNT)); + log.debug("Старт обработки новых MR"); + final Set projectIds = projectService.getAllIds(); - while (projectSheet.hasContent()) { - final List projects = projectSheet.getContent(); - - for (Project project : projects) { - projectProcessing(project); - } - - projectSheet = projectService.getAll(PageRequest.of(++page, COUNT)); + for (Long projectId : projectIds) { + projectProcessing(projectId); } + + log.debug("Конец обработки новых MR"); } - private void projectProcessing(Project project) { + private void projectProcessing(Long projectId) { int page = 1; - List mergeRequestJsons = getMergeRequestJsons(project, page); + List mergeRequestJsons = getMergeRequestJsons(projectId, page); while (checkNotEmpty(mergeRequestJsons)) { @@ -97,6 +91,7 @@ public class MergeRequestParser { .collect(Collectors.toSet()); final ExistContainer existContainer = mergeRequestsService.existsById(jsonIds); + log.trace("Из {} полученных MR не найдены в хранилище {}", jsonIds.size(), existContainer.getIdNoFound().size()); if (!existContainer.isAllFound()) { final List newMergeRequests = mergeRequestJsons.stream() .filter(json -> existContainer.getIdNoFound().contains(json.getId())) @@ -109,10 +104,11 @@ public class MergeRequestParser { personMapping(newMergeRequests); + log.trace("Пачка новых MR обработана и отправлена на сохранение. Количество: {} шт.", newMergeRequests.size()); mergeRequestsService.createAll(newMergeRequests); } - mergeRequestJsons = getMergeRequestJsons(project, page++); + mergeRequestJsons = getMergeRequestJsons(projectId, page++); } } @@ -154,11 +150,13 @@ public class MergeRequestParser { } } - private List getMergeRequestJsons(Project project, int page) { - return HttpParse.request(MessageFormat.format(gitlabProperty.getUrlPullRequestOpen(), project.getId(), page)) + private List getMergeRequestJsons(Long projectId, int page) { + final List jsons = HttpParse.request(MessageFormat.format(gitlabProperty.getUrlPullRequestOpen(), projectId, page)) .header(StringUtils.H_PRIVATE_TOKEN, personProperty.getToken()) .header(ACCEPT) .executeList(MergeRequestJson.class); + log.trace("Получено {} шт потенциально новых MR для проекта id:'{}' ", jsons.size(), projectId); + return jsons; } private Optional getMergeRequest(IdAndStatusPr existId) { diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/PipelineParser.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/PipelineParser.java index 08d2b14..79ff549 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/PipelineParser.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/PipelineParser.java @@ -3,7 +3,6 @@ package dev.struchkov.bot.gitlab.core.service.parser; import dev.struchkov.bot.gitlab.context.domain.ExistContainer; import dev.struchkov.bot.gitlab.context.domain.PipelineStatus; import dev.struchkov.bot.gitlab.context.domain.entity.Pipeline; -import dev.struchkov.bot.gitlab.context.domain.entity.Project; import dev.struchkov.bot.gitlab.context.service.PipelineService; import dev.struchkov.bot.gitlab.context.service.ProjectService; import dev.struchkov.bot.gitlab.core.config.properties.GitlabProperty; @@ -12,6 +11,7 @@ import dev.struchkov.bot.gitlab.core.utils.StringUtils; import dev.struchkov.bot.gitlab.sdk.domain.PipelineJson; import dev.struchkov.haiti.utils.network.HttpParse; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.core.convert.ConversionService; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -38,6 +38,7 @@ import static dev.struchkov.haiti.utils.network.HttpParse.ACCEPT; * * @author upagge 17.01.2021 */ +@Slf4j @Service @RequiredArgsConstructor public class PipelineParser { @@ -55,25 +56,21 @@ public class PipelineParser { private LocalDateTime lastUpdate = LocalDateTime.now(); public void scanNewPipeline() { + log.debug("Старт обработки новых папйплайнов"); int page = 0; - Page projectSheet = projectService.getAll(PageRequest.of(page, COUNT)); + final Set projectIds = projectService.getAllIds(); - while (projectSheet.hasContent()) { - final List projects = projectSheet.getContent(); - - for (Project project : projects) { - processingProject(project); - } - - projectSheet = projectService.getAll(PageRequest.of(++page, COUNT)); + for (Long projectId : projectIds) { + processingProject(projectId); } + log.debug("Конец обработки новых папйплайнов"); } - private void processingProject(Project project) { + private void processingProject(Long projectId) { int page = 1; LocalDateTime newLastUpdate = LocalDateTime.now(); - List pipelineJsons = getPipelineJsons(project.getId(), page, lastUpdate); + List pipelineJsons = getPipelineJsons(projectId, page, lastUpdate); while (checkNotEmpty(pipelineJsons)) { @@ -89,14 +86,14 @@ public class PipelineParser { for (Long newId : idsNotFound) { final Pipeline newPipeline = HttpParse.request( - MessageFormat.format(gitlabProperty.getUrlPipeline(), project.getId(), newId) + MessageFormat.format(gitlabProperty.getUrlPipeline(), projectId, newId) ) .header(ACCEPT) .header(StringUtils.H_PRIVATE_TOKEN, personProperty.getToken()) .execute(PipelineJson.class) .map(json -> { final Pipeline pipeline = conversionService.convert(json, Pipeline.class); - pipeline.setProject(project); + pipeline.setProjectId(projectId); return pipeline; }) .orElseThrow(convertException("Ошибка обновления Pipelines")); @@ -105,7 +102,7 @@ public class PipelineParser { } - pipelineJsons = getPipelineJsons(project.getId(), ++page, lastUpdate); + pipelineJsons = getPipelineJsons(projectId, ++page, lastUpdate); } lastUpdate = newLastUpdate; @@ -120,6 +117,7 @@ public class PipelineParser { } public void scanOldPipeline() { + log.debug("Старт обработки старых папйплайнов"); int page = 0; Page pipelineSheet = pipelineService.getAllByStatuses(oldStatus, PageRequest.of(page, COUNT)); @@ -128,7 +126,7 @@ public class PipelineParser { for (Pipeline pipeline : pipelines) { final Pipeline newPipeline = HttpParse.request( - MessageFormat.format(gitlabProperty.getUrlPipeline(), pipeline.getProject().getId(), pipeline.getId()) + MessageFormat.format(gitlabProperty.getUrlPipeline(), pipeline.getProjectId(), pipeline.getId()) ) .header(ACCEPT) .header(StringUtils.H_PRIVATE_TOKEN, personProperty.getToken()) @@ -141,6 +139,7 @@ public class PipelineParser { pipelineSheet = pipelineService.getAllByStatuses(oldStatus, PageRequest.of(++page, COUNT)); } + log.debug("Конец обработки старых папйплайнов"); } } diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/ProjectRepositoryImpl.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/ProjectRepositoryImpl.java index 6f7c5a3..e48418a 100644 --- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/ProjectRepositoryImpl.java +++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/impl/ProjectRepositoryImpl.java @@ -46,4 +46,9 @@ public class ProjectRepositoryImpl implements ProjectRepository { return jpaRepository.findAll(pagination); } + @Override + public Set findAllIds() { + return jpaRepository.findAllIds(); + } + } diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/ProjectJpaRepository.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/ProjectJpaRepository.java index 75d8989..eda1c9b 100644 --- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/ProjectJpaRepository.java +++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/ProjectJpaRepository.java @@ -2,10 +2,16 @@ package dev.struchkov.bot.gitlab.data.jpa; import dev.struchkov.bot.gitlab.context.domain.entity.Project; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.util.Set; /** * @author upagge 14.01.2021 */ public interface ProjectJpaRepository extends JpaRepository { + @Query("SELECT p.id FROM Project p") + Set findAllIds(); + } diff --git a/gitlab-app/src/main/java/dev/struchkov/bot/gitlab/scheduler/SchedulerService.java b/gitlab-app/src/main/java/dev/struchkov/bot/gitlab/scheduler/SchedulerService.java index f058b70..7d01fe0 100644 --- a/gitlab-app/src/main/java/dev/struchkov/bot/gitlab/scheduler/SchedulerService.java +++ b/gitlab-app/src/main/java/dev/struchkov/bot/gitlab/scheduler/SchedulerService.java @@ -24,14 +24,16 @@ public class SchedulerService { @Scheduled(cron = "0 */1 * * * *") public void newMergeRequest() { + log.debug("Запуск процесса обновления данных"); mergeRequestParser.parsingOldMergeRequest(); mergeRequestParser.parsingNewMergeRequest(); - pipelineParser.scanOldPipeline(); - pipelineParser.scanNewPipeline(); - discussionParser.scanOldDiscussions(); - discussionParser.scanNewDiscussion(); - cleanService.cleanOldPipelines(); - cleanService.cleanOldMergedRequests(); +// pipelineParser.scanOldPipeline(); +// pipelineParser.scanNewPipeline(); +// discussionParser.scanOldDiscussions(); +// discussionParser.scanNewDiscussion(); +// cleanService.cleanOldPipelines(); +// cleanService.cleanOldMergedRequests(); + log.debug("Конец процесса обновления данных"); } } diff --git a/gitlab-app/src/main/resources/application.yml b/gitlab-app/src/main/resources/application.yml index 200117b..2142301 100644 --- a/gitlab-app/src/main/resources/application.yml +++ b/gitlab-app/src/main/resources/application.yml @@ -1,3 +1,4 @@ + spring: datasource: url: ${DATASOURCE_URL} @@ -50,4 +51,7 @@ gitlab-bot: url-commit: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/commits?&page=1&per_page=1" url-new-note: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}/notes?body={3}" url-discussion: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions?&page={2,number,#}&per_page=100" - url-one-discussion: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}" \ No newline at end of file + url-one-discussion: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}" +logging: + level: + "dev.struchkov": trace \ No newline at end of file