Добавил профиль local и вынес крон настройки в application.yml
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Struchkov Mark 2023-03-05 20:39:37 +03:00
parent 0e4939b351
commit 6dcd68655a
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6
2 changed files with 23 additions and 4 deletions

View File

@ -32,7 +32,7 @@ public class SchedulerService {
private final MergeRequestsService mergeRequestsService; private final MergeRequestsService mergeRequestsService;
private final DiscussionService discussionService; private final DiscussionService discussionService;
@Scheduled(cron = "0 0 */1 * * *") @Scheduled(cron = "${gitlab-bot.cron.scan.new-project}")
public void newProjects() { public void newProjects() {
log.info("Запуск процесса получение новых репозиториев c GitLab"); log.info("Запуск процесса получение новых репозиториев c GitLab");
if (!settingService.isFirstStart()) { if (!settingService.isFirstStart()) {
@ -46,7 +46,7 @@ public class SchedulerService {
log.info("Конец процесса получение новых репозиториев c GitLab"); log.info("Конец процесса получение новых репозиториев c GitLab");
} }
@Scheduled(cron = "0 */15 * * * *") @Scheduled(cron = "${gitlab-bot.cron.scan.new-merge-request}")
public void newMergeRequests() { public void newMergeRequests() {
log.info("Запуск процесса получение новых MR c GitLab"); log.info("Запуск процесса получение новых MR c GitLab");
if (!settingService.isFirstStart()) { if (!settingService.isFirstStart()) {
@ -55,7 +55,7 @@ public class SchedulerService {
log.info("Конец процесса получение новых MR c GitLab"); log.info("Конец процесса получение новых MR c GitLab");
} }
@Scheduled(cron = "0 */1 * * * *") @Scheduled(cron = "${gitlab-bot.cron.scan.general}")
public void newMergeRequest() { public void newMergeRequest() {
log.info("Запуск процесса обновления данных c GitLab"); log.info("Запуск процесса обновления данных c GitLab");
if (!settingService.isFirstStart()) { if (!settingService.isFirstStart()) {

View File

@ -37,6 +37,11 @@ telegram:
gitlab-bot: gitlab-bot:
version: 0.0.1-SNAPSHOT version: 0.0.1-SNAPSHOT
cron:
scan:
general: "0 */1 * * * *"
new-project: "0 0 */1 * * *"
new-merge-request: "0 */15 * * * *"
person: person:
telegram-id: ${TELEGRAM_PERSON_ID} telegram-id: ${TELEGRAM_PERSON_ID}
token: ${GITLAB_PERSONAL_TOKEN} token: ${GITLAB_PERSONAL_TOKEN}
@ -59,3 +64,17 @@ gitlab-bot:
new-note-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}/notes?body={3}" new-note-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}/notes?body={3}"
discussions-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions?&page={2,number,#}&per_page={3,number,#}" discussions-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions?&page={2,number,#}&per_page={3,number,#}"
discussion-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}" discussion-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}"
---
spring:
config:
activate:
on-profile: local
gitlab-bot:
version: 0.0.1-SNAPSHOT
cron:
scan:
general: "0 */1 * * * *"
new-project: "0 */1 * * * *"
new-merge-request: "0 */1 * * * *"