Выпилил тимсити
This commit is contained in:
parent
accbdda578
commit
290a49c263
@ -60,11 +60,6 @@
|
|||||||
<artifactId>telegram-bot</artifactId>
|
<artifactId>telegram-bot</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.sadtech.bot.gitlab</groupId>
|
|
||||||
<artifactId>teamcity-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.sadtech.bot.gitlab</groupId>
|
<groupId>org.sadtech.bot.gitlab</groupId>
|
||||||
<artifactId>gitlab-sdk</artifactId>
|
<artifactId>gitlab-sdk</artifactId>
|
||||||
|
@ -5,9 +5,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||||
|
|
||||||
@EnableJpaRepositories(basePackages = {"org.sadtech.bot.gitlab.data.jpa", "org.sadtech.bot.gitlab.teamcity.core.repository.jpa"})
|
@EnableJpaRepositories(basePackages = {"org.sadtech.bot.gitlab.data.jpa"})
|
||||||
@SpringBootApplication(scanBasePackages = "org.sadtech.bot.gitlab")
|
@SpringBootApplication(scanBasePackages = "org.sadtech.bot.gitlab")
|
||||||
@EntityScan(basePackages = {"org.sadtech.bot.gitlab.context.domain.entity", "org.sadtech.bot.gitlab.teamcity.core.domain.entity"})
|
@EntityScan(basePackages = {"org.sadtech.bot.gitlab.context.domain.entity"})
|
||||||
public class BitbucketbotApplication {
|
public class BitbucketbotApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -22,7 +22,7 @@ telegram-config:
|
|||||||
bot-username: ${TELEGRAM_BOT_USERNAME}
|
bot-username: ${TELEGRAM_BOT_USERNAME}
|
||||||
bot-token: ${TELEGRAM_BOT_TOKEN}
|
bot-token: ${TELEGRAM_BOT_TOKEN}
|
||||||
gitlab-bot:
|
gitlab-bot:
|
||||||
version: 0.0.2 Beta
|
version: 0.0.3 Beta
|
||||||
person:
|
person:
|
||||||
telegram-id: ${TELEGRAM_PERSON_ID}
|
telegram-id: ${TELEGRAM_PERSON_ID}
|
||||||
token: ${GITLAB_PERSONAL_TOKEN}
|
token: ${GITLAB_PERSONAL_TOKEN}
|
||||||
@ -39,8 +39,4 @@ gitlab-bot:
|
|||||||
url-note-api: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/notes/{2,number,#}"
|
url-note-api: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/notes/{2,number,#}"
|
||||||
url-pipelines: "${GITLAB_URL}/api/v4/projects/{0,number,#}/pipelines?&page={1,number,#}&per_page=100"
|
url-pipelines: "${GITLAB_URL}/api/v4/projects/{0,number,#}/pipelines?&page={1,number,#}&per_page=100"
|
||||||
url-pipeline: "${GITLAB_URL}/api/v4/projects/{0,number,#}/pipelines/{1,number,#}"
|
url-pipeline: "${GITLAB_URL}/api/v4/projects/{0,number,#}/pipelines/{1,number,#}"
|
||||||
url-commit: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/commits?&page=1&per_page=1"
|
url-commit: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/commits?&page=1&per_page=1"
|
||||||
teamcity:
|
|
||||||
token: ${TEAMCITY_ADMIN_TOKEN}
|
|
||||||
project-url: ${TEAMCITY_URL}/app/rest/projects
|
|
||||||
build-url: ${TEAMCITY_URL}/app/rest/builds/?locator=project:(id:{0}),branch:(default:any)
|
|
@ -73,21 +73,25 @@ public class MergeRequestsServiceImpl extends AbstractSimpleManagerService<Merge
|
|||||||
|
|
||||||
private void notifyNewPr(MergeRequest newMergeRequest) {
|
private void notifyNewPr(MergeRequest newMergeRequest) {
|
||||||
if (!personInformation.getId().equals(newMergeRequest.getAuthor().getId())) {
|
if (!personInformation.getId().equals(newMergeRequest.getAuthor().getId())) {
|
||||||
|
|
||||||
final String projectName = projectService.getById(newMergeRequest.getProjectId())
|
final String projectName = projectService.getById(newMergeRequest.getProjectId())
|
||||||
.orElseThrow(() -> new NotFoundException("Проект не найден"))
|
.orElseThrow(() -> new NotFoundException("Проект не найден"))
|
||||||
.getName();
|
.getName();
|
||||||
notifyService.send(
|
if (!newMergeRequest.isConflict()) {
|
||||||
NewPrNotify.builder()
|
notifyService.send(
|
||||||
.projectName(projectName)
|
NewPrNotify.builder()
|
||||||
.labels(newMergeRequest.getLabels())
|
.projectName(projectName)
|
||||||
.author(newMergeRequest.getAuthor().getName())
|
.labels(newMergeRequest.getLabels())
|
||||||
.description(newMergeRequest.getDescription())
|
.author(newMergeRequest.getAuthor().getName())
|
||||||
.title(newMergeRequest.getTitle())
|
.description(newMergeRequest.getDescription())
|
||||||
.url(newMergeRequest.getWebUrl())
|
.title(newMergeRequest.getTitle())
|
||||||
.targetBranch(newMergeRequest.getTargetBranch())
|
.url(newMergeRequest.getWebUrl())
|
||||||
.sourceBranch(newMergeRequest.getSourceBranch())
|
.targetBranch(newMergeRequest.getTargetBranch())
|
||||||
.build()
|
.sourceBranch(newMergeRequest.getSourceBranch())
|
||||||
);
|
.build()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,10 +106,7 @@ public class MergeRequestsServiceImpl extends AbstractSimpleManagerService<Merge
|
|||||||
mergeRequest.setNotification(oldMergeRequest.getNotification());
|
mergeRequest.setNotification(oldMergeRequest.getNotification());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (!oldMergeRequest.getUpdatedDate().equals(mergeRequest.getUpdatedDate())) {
|
||||||
!oldMergeRequest.getUpdatedDate().equals(mergeRequest.getUpdatedDate())
|
|
||||||
&& !personInformation.getId().equals(oldMergeRequest.getAuthor().getId())
|
|
||||||
) {
|
|
||||||
final Project project = projectService.getById(mergeRequest.getProjectId())
|
final Project project = projectService.getById(mergeRequest.getProjectId())
|
||||||
.orElseThrow(() -> new NotFoundException("Проект не найден"));
|
.orElseThrow(() -> new NotFoundException("Проект не найден"));
|
||||||
|
|
||||||
@ -165,7 +166,7 @@ public class MergeRequestsServiceImpl extends AbstractSimpleManagerService<Merge
|
|||||||
if (
|
if (
|
||||||
!oldMergeRequest.isConflict()
|
!oldMergeRequest.isConflict()
|
||||||
&& mergeRequest.isConflict()
|
&& mergeRequest.isConflict()
|
||||||
&& oldMergeRequest.getAuthor().getId().equals(personInformation.getId())
|
&& personInformation.getId().equals(oldMergeRequest.getAuthor().getId())
|
||||||
) {
|
) {
|
||||||
notifyService.send(
|
notifyService.send(
|
||||||
ConflictPrNotify.builder()
|
ConflictPrNotify.builder()
|
||||||
|
@ -60,17 +60,14 @@ public class TaskServiceImpl extends AbstractNoteService<Task> implements TaskSe
|
|||||||
final Task oldTask = taskRepository.findById(task.getId())
|
final Task oldTask = taskRepository.findById(task.getId())
|
||||||
.orElseThrow(() -> new NotFoundException("Задача не найдена"));
|
.orElseThrow(() -> new NotFoundException("Задача не найдена"));
|
||||||
|
|
||||||
if (!oldTask.getUpdated().equals(task.getUpdated())) {
|
task.setMergeRequest(oldTask.getMergeRequest());
|
||||||
|
task.setWebUrl(oldTask.getWebUrl());
|
||||||
|
task.setResponsible(oldTask.getResponsible());
|
||||||
|
|
||||||
task.setMergeRequest(oldTask.getMergeRequest());
|
notifyUpdateStatus(oldTask, task);
|
||||||
task.setWebUrl(oldTask.getWebUrl());
|
|
||||||
task.setResponsible(oldTask.getResponsible());
|
|
||||||
|
|
||||||
notifyUpdateStatus(oldTask, task);
|
return taskRepository.save(task);
|
||||||
|
|
||||||
return taskRepository.save(task);
|
|
||||||
}
|
|
||||||
return oldTask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyUpdateStatus(Task oldTask, Task task) {
|
private void notifyUpdateStatus(Task oldTask, Task task) {
|
||||||
|
@ -172,7 +172,7 @@ public class NoteParser {
|
|||||||
.header(AUTHORIZATION, BEARER + personProperty.getToken())
|
.header(AUTHORIZATION, BEARER + personProperty.getToken())
|
||||||
.execute(NoteJson.class)
|
.execute(NoteJson.class)
|
||||||
.map(json -> conversionService.convert(json, Task.class))
|
.map(json -> conversionService.convert(json, Task.class))
|
||||||
.orElseThrow(() -> new ConvertException("Ошибка обработки задачи"));
|
.orElseThrow(() -> new ConvertException("Ошибка обработки задачи id: " + task.getId()));
|
||||||
taskService.update(newTask);
|
taskService.update(newTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
pom.xml
16
pom.xml
@ -14,7 +14,6 @@
|
|||||||
<module>gitlab-sdk</module>
|
<module>gitlab-sdk</module>
|
||||||
<module>bot-core</module>
|
<module>bot-core</module>
|
||||||
<module>bot-app</module>
|
<module>bot-app</module>
|
||||||
<module>teamcity</module>
|
|
||||||
<module>bot-data</module>
|
<module>bot-data</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
@ -79,9 +78,6 @@
|
|||||||
|
|
||||||
<gitlab.core.version>3.0.1-RELEASE</gitlab.core.version>
|
<gitlab.core.version>3.0.1-RELEASE</gitlab.core.version>
|
||||||
<gitlab.app.version>1.0.0-SNAPSHOT</gitlab.app.version>
|
<gitlab.app.version>1.0.0-SNAPSHOT</gitlab.app.version>
|
||||||
<gitlab.teamcity.version>3.0.1-RELEASE</gitlab.teamcity.version>
|
|
||||||
<gitlab.teamcity.core.version>3.0.1-RELEASE</gitlab.teamcity.core.version>
|
|
||||||
<gitlab.teamcity.sdk.version>3.0.1-RELEASE</gitlab.teamcity.sdk.version>
|
|
||||||
<gitlab.sdk.version>3.0.1-RELEASE</gitlab.sdk.version>
|
<gitlab.sdk.version>3.0.1-RELEASE</gitlab.sdk.version>
|
||||||
<gitlab.context.version>3.0.1-RELEASE</gitlab.context.version>
|
<gitlab.context.version>3.0.1-RELEASE</gitlab.context.version>
|
||||||
<gitlab.data.version>3.0.1-RELEASE</gitlab.data.version>
|
<gitlab.data.version>3.0.1-RELEASE</gitlab.data.version>
|
||||||
@ -122,12 +118,6 @@
|
|||||||
<version>${gitlab.telegram.version}</version>
|
<version>${gitlab.telegram.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.sadtech.bot.gitlab</groupId>
|
|
||||||
<artifactId>teamcity-sdk</artifactId>
|
|
||||||
<version>${gitlab.teamcity.sdk.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.sadtech.bot.gitlab</groupId>
|
<groupId>org.sadtech.bot.gitlab</groupId>
|
||||||
<artifactId>bot-context</artifactId>
|
<artifactId>bot-context</artifactId>
|
||||||
@ -140,12 +130,6 @@
|
|||||||
<version>${gitlab.sdk.version}</version>
|
<version>${gitlab.sdk.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.sadtech.bot.gitlab</groupId>
|
|
||||||
<artifactId>teamcity-core</artifactId>
|
|
||||||
<version>${gitlab.teamcity.core.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.sadtech.bot.gitlab</groupId>
|
<groupId>org.sadtech.bot.gitlab</groupId>
|
||||||
<artifactId>bot-data</artifactId>
|
<artifactId>bot-data</artifactId>
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>gitlab-bot</artifactId>
|
|
||||||
<groupId>org.sadtech.bot.gitlab</groupId>
|
|
||||||
<version>3.0.1-RELEASE</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>teamcity</artifactId>
|
|
||||||
<version>3.0.1-RELEASE</version>
|
|
||||||
<packaging>pom</packaging>
|
|
||||||
|
|
||||||
<modules>
|
|
||||||
<module>teamcity-sdk</module>
|
|
||||||
<module>teamcity-core</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
|
||||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<developers>
|
|
||||||
<developer>
|
|
||||||
<id>uPagge</id>
|
|
||||||
<name>Struchkov Mark</name>
|
|
||||||
<email>upagge@ya.ru</email>
|
|
||||||
<organization>SADTECH</organization>
|
|
||||||
<organizationUrl>https://sadtech.org</organizationUrl>
|
|
||||||
<url>https://uPagge.sadtech.org</url>
|
|
||||||
<roles>
|
|
||||||
<role>Project lead</role>
|
|
||||||
</roles>
|
|
||||||
<timezone>+3</timezone>
|
|
||||||
</developer>
|
|
||||||
</developers>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,82 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>teamcity</artifactId>
|
|
||||||
<groupId>org.sadtech.bot.gitlab</groupId>
|
|
||||||
<version>3.0.1-RELEASE</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>teamcity-core</artifactId>
|
|
||||||
<version>${gitlab.teamcity.core.version}</version>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.sadtech.bot.gitlab</groupId>
|
|
||||||
<artifactId>bot-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.sadtech.bot.gitlab</groupId>
|
|
||||||
<artifactId>teamcity-sdk</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<optional>true</optional>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.sadtech.haiti</groupId>
|
|
||||||
<artifactId>haiti-utils</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
|
||||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<developers>
|
|
||||||
<developer>
|
|
||||||
<id>uPagge</id>
|
|
||||||
<name>Struchkov Mark</name>
|
|
||||||
<email>upagge@ya.ru</email>
|
|
||||||
<organization>SADTECH</organization>
|
|
||||||
<organizationUrl>https://sadtech.org</organizationUrl>
|
|
||||||
<url>https://uPagge.sadtech.org</url>
|
|
||||||
<roles>
|
|
||||||
<role>Project lead</role>
|
|
||||||
</roles>
|
|
||||||
<timezone>+3</timezone>
|
|
||||||
</developer>
|
|
||||||
</developers>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,23 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.config.property;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Component
|
|
||||||
@ConfigurationProperties(prefix = "gitlab-bot.teamcity")
|
|
||||||
public class TeamcityProperty {
|
|
||||||
|
|
||||||
private String token;
|
|
||||||
private String projectUrl;
|
|
||||||
private String buildUrl;
|
|
||||||
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.domain;
|
|
||||||
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.sadtech.bot.gitlab.context.domain.notify.Notify;
|
|
||||||
import org.sadtech.bot.gitlab.context.service.AppSettingService;
|
|
||||||
import org.sadtech.bot.gitlab.context.utils.Smile;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.BuildShort;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.sdk.BuildStatus;
|
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
public class TeamcityBuildNotify extends Notify {
|
|
||||||
|
|
||||||
private final BuildShort buildShort;
|
|
||||||
|
|
||||||
@Builder
|
|
||||||
private TeamcityBuildNotify(BuildShort buildShort) {
|
|
||||||
this.buildShort = buildShort;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String generateMessage(AppSettingService appSettingService) {
|
|
||||||
return MessageFormat.format(
|
|
||||||
"{0} *Сборка* | {1,number,#}:{2,number,#} | {3}" +
|
|
||||||
"{4} [{5}]({6}) {4}" +
|
|
||||||
"{7} {8}",
|
|
||||||
Smile.BUILD,
|
|
||||||
buildShort.getId(),
|
|
||||||
buildShort.getNumber(),
|
|
||||||
escapeMarkdown(buildShort.getProjectId()),
|
|
||||||
Smile.HR,
|
|
||||||
buildShort.getBuildTypeId(),
|
|
||||||
buildShort.getUrl(),
|
|
||||||
getSmile(buildShort),
|
|
||||||
buildShort.getStatus()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getSmile(BuildShort buildShort) {
|
|
||||||
return BuildStatus.SUCCESS.equals(buildShort.getStatus()) ? Smile.SUCCESS.getValue() : Smile.FAILURE.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.domain.entity;
|
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.sdk.BuildState;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.sdk.BuildStatus;
|
|
||||||
import org.sadtech.haiti.context.domain.BasicEntity;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.EnumType;
|
|
||||||
import javax.persistence.Enumerated;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@Table(name = "teamcity_build")
|
|
||||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
|
|
||||||
public class BuildShort implements BasicEntity<Long> {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@Column(name = "id")
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Column(name = "project_id")
|
|
||||||
private String projectId;
|
|
||||||
|
|
||||||
@Column(name = "number")
|
|
||||||
private Integer number;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
@Column(name = "state")
|
|
||||||
private BuildState state;
|
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
@Column(name = "status")
|
|
||||||
private BuildStatus status;
|
|
||||||
|
|
||||||
@Column(name = "branch_name")
|
|
||||||
private String branchName;
|
|
||||||
|
|
||||||
@Column(name = "build_type_id")
|
|
||||||
private String buildTypeId;
|
|
||||||
|
|
||||||
@Column(name = "api_url")
|
|
||||||
private String apiUrl;
|
|
||||||
|
|
||||||
@Column(name = "url")
|
|
||||||
private String url;
|
|
||||||
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.domain.entity;
|
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.sadtech.haiti.context.domain.BasicEntity;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@Table(name = "teamcity_project")
|
|
||||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
|
|
||||||
public class TeamcityProject implements BasicEntity<String> {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@Column(name = "id")
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@Column(name = "name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Column(name = "description")
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
@Column(name = "url")
|
|
||||||
private String url;
|
|
||||||
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.domain.entity;
|
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.sadtech.haiti.context.domain.BasicEntity;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
//@Entity
|
|
||||||
//@Table(name = "teamcity_setting")
|
|
||||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
|
|
||||||
public class TeamcitySetting implements BasicEntity<Long> {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@Column(name = "id")
|
|
||||||
@EqualsAndHashCode.Include
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Column(name = "recipient_id")
|
|
||||||
private String recipientId;
|
|
||||||
|
|
||||||
@Column(name = "project_id")
|
|
||||||
private String projectId;
|
|
||||||
|
|
||||||
@Column(name = "build_type_id")
|
|
||||||
private String buildTypeId;
|
|
||||||
|
|
||||||
@Column(name = "success")
|
|
||||||
private boolean success;
|
|
||||||
|
|
||||||
@Column(name = "failure")
|
|
||||||
private boolean failure;
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.repository;
|
|
||||||
|
|
||||||
import lombok.NonNull;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.BuildShort;
|
|
||||||
import org.sadtech.haiti.context.repository.SimpleManagerRepository;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
public interface BuildShortRepository extends SimpleManagerRepository<BuildShort, Long> {
|
|
||||||
|
|
||||||
Set<Long> exists(@NonNull Set<Long> buildIds);
|
|
||||||
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.repository;
|
|
||||||
|
|
||||||
import lombok.NonNull;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcityProject;
|
|
||||||
import org.sadtech.haiti.context.repository.SimpleManagerRepository;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
public interface TeamcityProjectRepository extends SimpleManagerRepository<TeamcityProject, String> {
|
|
||||||
|
|
||||||
List<String> exists(@NonNull Set<String> projectIds);
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.repository;
|
|
||||||
|
|
||||||
import lombok.NonNull;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcitySetting;
|
|
||||||
import org.sadtech.haiti.context.repository.SimpleManagerRepository;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
public interface TeamcitySettingRepository extends SimpleManagerRepository<TeamcitySetting, Long> {
|
|
||||||
|
|
||||||
List<TeamcitySetting> findAllByProjectId(@NonNull String projectId);
|
|
||||||
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.repository.impl;
|
|
||||||
|
|
||||||
import lombok.NonNull;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.BuildShort;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.repository.BuildShortRepository;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.repository.jpa.BuildShortJpaRepository;
|
|
||||||
import org.sadtech.haiti.database.repository.manager.AbstractSimpleManagerRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Repository
|
|
||||||
public class BuildShortRepositoryImpl extends AbstractSimpleManagerRepository<BuildShort, Long> implements BuildShortRepository {
|
|
||||||
|
|
||||||
private final BuildShortJpaRepository jpaRepository;
|
|
||||||
|
|
||||||
public BuildShortRepositoryImpl(BuildShortJpaRepository jpaRepository) {
|
|
||||||
super(jpaRepository);
|
|
||||||
this.jpaRepository = jpaRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Long> exists(@NonNull Set<Long> buildIds) {
|
|
||||||
return jpaRepository.existsByIds(buildIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.repository.impl;
|
|
||||||
|
|
||||||
import lombok.NonNull;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcityProject;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.repository.TeamcityProjectRepository;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.repository.jpa.TeamcityProjectJpaRepository;
|
|
||||||
import org.sadtech.haiti.database.repository.manager.AbstractSimpleManagerRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Repository
|
|
||||||
public class TeamcityProjectRepositoryImpl extends AbstractSimpleManagerRepository<TeamcityProject, String> implements TeamcityProjectRepository {
|
|
||||||
|
|
||||||
private final TeamcityProjectJpaRepository teamcityProjectJpaRepository;
|
|
||||||
|
|
||||||
public TeamcityProjectRepositoryImpl(TeamcityProjectJpaRepository teamcityProjectJpaRepository) {
|
|
||||||
super(teamcityProjectJpaRepository);
|
|
||||||
this.teamcityProjectJpaRepository = teamcityProjectJpaRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> exists(@NonNull Set<String> projectIds) {
|
|
||||||
return teamcityProjectJpaRepository.existsAllById(projectIds);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.repository.impl;
|
|
||||||
|
|
||||||
import lombok.NonNull;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcitySetting;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.repository.TeamcitySettingRepository;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.repository.jpa.TeamcitySettingJpaRepository;
|
|
||||||
import org.sadtech.haiti.database.repository.manager.AbstractSimpleManagerRepository;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
//@Repository
|
|
||||||
public class TeamcitySettingRepositoryImpl extends AbstractSimpleManagerRepository<TeamcitySetting, Long> implements TeamcitySettingRepository {
|
|
||||||
|
|
||||||
private final TeamcitySettingJpaRepository jpaRepository;
|
|
||||||
|
|
||||||
public TeamcitySettingRepositoryImpl(TeamcitySettingJpaRepository jpaRepository) {
|
|
||||||
super(jpaRepository);
|
|
||||||
this.jpaRepository = jpaRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TeamcitySetting> findAllByProjectId(@NonNull String projectId) {
|
|
||||||
return jpaRepository.findAllByProjectId(projectId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.repository.jpa;
|
|
||||||
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.BuildShort;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
public interface BuildShortJpaRepository extends JpaRepository<BuildShort, Long> {
|
|
||||||
|
|
||||||
@Query("SELECT b.id FROM BuildShort b WHERE b.id IN :buildIds")
|
|
||||||
Set<Long> existsByIds(@Param("buildIds") Set<Long> buildIds);
|
|
||||||
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.repository.jpa;
|
|
||||||
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcityProject;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
public interface TeamcityProjectJpaRepository extends JpaRepository<TeamcityProject, String> {
|
|
||||||
|
|
||||||
@Query("SELECT t.id FROM TeamcityProject t WHERE t.id IN :projectIds")
|
|
||||||
List<String> existsAllById(@Param("projectIds") Set<String> projectIds);
|
|
||||||
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.repository.jpa;
|
|
||||||
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcitySetting;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.repository.NoRepositoryBean;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@NoRepositoryBean
|
|
||||||
public interface TeamcitySettingJpaRepository extends JpaRepository<TeamcitySetting, Long> {
|
|
||||||
|
|
||||||
List<TeamcitySetting> findAllByProjectId(String projectId);
|
|
||||||
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.scheduler;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.service.parser.BuildShortParser;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.service.parser.TeamcityProjectParser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
//@Component
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class TeamcityProjectScheduler {
|
|
||||||
|
|
||||||
private final TeamcityProjectParser projectParser;
|
|
||||||
private final BuildShortParser buildShortParser;
|
|
||||||
|
|
||||||
// @Scheduled(cron = "0 */1 * * * *")
|
|
||||||
// public void parseNewProject() {
|
|
||||||
// projectParser.parseNewProject();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Scheduled(cron = "0 */1 * * * *")
|
|
||||||
// public void parseNewBuilds() {
|
|
||||||
// buildShortParser.parseNewBuilds();
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.service;
|
|
||||||
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.BuildShort;
|
|
||||||
import org.sadtech.haiti.context.service.SimpleManagerService;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
public interface BuildShortService extends SimpleManagerService<BuildShort, Long> {
|
|
||||||
|
|
||||||
Set<Long> exists(Set<Long> buildIds);
|
|
||||||
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.service;
|
|
||||||
|
|
||||||
import lombok.NonNull;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcityProject;
|
|
||||||
import org.sadtech.haiti.context.service.SimpleManagerService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
public interface TeamcityProjectService extends SimpleManagerService<TeamcityProject, String> {
|
|
||||||
|
|
||||||
List<String> exists(@NonNull Set<String> projectIds);
|
|
||||||
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.service;
|
|
||||||
|
|
||||||
import lombok.NonNull;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcitySetting;
|
|
||||||
import org.sadtech.haiti.context.service.SimpleManagerService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
public interface TeamcitySettingService extends SimpleManagerService<TeamcitySetting, Long> {
|
|
||||||
|
|
||||||
List<TeamcitySetting> getAllByProjectId(@NonNull String projectId);
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.service.convert;
|
|
||||||
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.BuildShort;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.sdk.BuildShortJson;
|
|
||||||
import org.springframework.core.convert.converter.Converter;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class BuildShotJsonToBuildShortConvert implements Converter<BuildShortJson, BuildShort> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BuildShort convert(BuildShortJson source) {
|
|
||||||
final BuildShort buildShort = new BuildShort();
|
|
||||||
buildShort.setApiUrl(source.getHref());
|
|
||||||
buildShort.setBranchName(source.getBranchName());
|
|
||||||
buildShort.setId(source.getId());
|
|
||||||
buildShort.setNumber(source.getNumber());
|
|
||||||
buildShort.setState(source.getState());
|
|
||||||
buildShort.setStatus(source.getStatus());
|
|
||||||
buildShort.setUrl(source.getWebUrl());
|
|
||||||
buildShort.setProjectId(source.getProjectId());
|
|
||||||
buildShort.setBuildTypeId(source.getBuildTypeId());
|
|
||||||
return buildShort;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.service.convert;
|
|
||||||
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcityProject;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.sdk.TeamcityProjectJson;
|
|
||||||
import org.springframework.core.convert.converter.Converter;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class TeamcityProjectJsonToTeamcityProjectConvert implements Converter<TeamcityProjectJson, TeamcityProject> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TeamcityProject convert(TeamcityProjectJson source) {
|
|
||||||
final TeamcityProject teamcityProject = new TeamcityProject();
|
|
||||||
teamcityProject.setId(source.getId());
|
|
||||||
teamcityProject.setDescription(source.getDescription());
|
|
||||||
teamcityProject.setName(source.getName());
|
|
||||||
teamcityProject.setUrl(source.getWebUrl());
|
|
||||||
return teamcityProject;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.service.impl;
|
|
||||||
|
|
||||||
import lombok.NonNull;
|
|
||||||
import org.sadtech.bot.gitlab.context.service.NotifyService;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.TeamcityBuildNotify;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.BuildShort;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcitySetting;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.repository.BuildShortRepository;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.service.BuildShortService;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.service.TeamcitySettingService;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.sdk.BuildStatus;
|
|
||||||
import org.sadtech.haiti.context.domain.ExistsContainer;
|
|
||||||
import org.sadtech.haiti.core.service.AbstractSimpleManagerService;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
//@Service
|
|
||||||
public class BuildShortServiceImpl extends AbstractSimpleManagerService<BuildShort, Long> implements BuildShortService {
|
|
||||||
|
|
||||||
private final TeamcitySettingService teamcitySettingService;
|
|
||||||
private final BuildShortRepository buildShortRepository;
|
|
||||||
private final NotifyService notifyService;
|
|
||||||
|
|
||||||
public BuildShortServiceImpl(TeamcitySettingService teamcitySettingService, BuildShortRepository buildShortRepository, NotifyService notifyService) {
|
|
||||||
super(buildShortRepository);
|
|
||||||
this.teamcitySettingService = teamcitySettingService;
|
|
||||||
this.buildShortRepository = buildShortRepository;
|
|
||||||
this.notifyService = notifyService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Long> exists(Set<Long> buildIds) {
|
|
||||||
return buildShortRepository.exists(buildIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BuildShort create(@NonNull BuildShort buildShort) {
|
|
||||||
final BuildShort newBuildShort = buildShortRepository.save(buildShort);
|
|
||||||
|
|
||||||
teamcitySettingService.getAllByProjectId(buildShort.getProjectId())
|
|
||||||
.forEach(teamcitySetting -> sendNotification(teamcitySetting, buildShort));
|
|
||||||
|
|
||||||
return newBuildShort;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendNotification(TeamcitySetting teamcitySetting, BuildShort buildShort) {
|
|
||||||
if (isStatusBuild(teamcitySetting, buildShort.getStatus()) && isTypeBuild(teamcitySetting, buildShort.getBuildTypeId())) {
|
|
||||||
notifyService.send(
|
|
||||||
TeamcityBuildNotify.builder()
|
|
||||||
.buildShort(buildShort)
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isTypeBuild(TeamcitySetting teamcitySetting, String buildTypeId) {
|
|
||||||
return teamcitySetting.getBuildTypeId() == null
|
|
||||||
|| (teamcitySetting.getBuildTypeId().equals(buildTypeId));
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isStatusBuild(TeamcitySetting teamcitySetting, BuildStatus buildStatus) {
|
|
||||||
return (teamcitySetting.isFailure() && BuildStatus.FAILURE.equals(buildStatus))
|
|
||||||
|| (teamcitySetting.isSuccess() && BuildStatus.SUCCESS.equals(buildStatus));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BuildShort update(@NonNull BuildShort buildShort) {
|
|
||||||
return buildShortRepository.save(buildShort);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ExistsContainer<BuildShort, Long> existsById(@NonNull Collection<Long> collection) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.service.impl;
|
|
||||||
|
|
||||||
import lombok.NonNull;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcityProject;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.repository.TeamcityProjectRepository;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.service.TeamcityProjectService;
|
|
||||||
import org.sadtech.haiti.context.domain.ExistsContainer;
|
|
||||||
import org.sadtech.haiti.core.service.AbstractSimpleManagerService;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
//@Service
|
|
||||||
public class TeamcityProjectServiceImpl extends AbstractSimpleManagerService<TeamcityProject, String> implements TeamcityProjectService {
|
|
||||||
|
|
||||||
private final TeamcityProjectRepository teamcityProjectRepository;
|
|
||||||
|
|
||||||
public TeamcityProjectServiceImpl(TeamcityProjectRepository teamcityProjectRepository) {
|
|
||||||
super(teamcityProjectRepository);
|
|
||||||
this.teamcityProjectRepository = teamcityProjectRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> exists(@NonNull Set<String> projectIds) {
|
|
||||||
return teamcityProjectRepository.exists(projectIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TeamcityProject create(@NonNull TeamcityProject teamcityProject) {
|
|
||||||
return teamcityProjectRepository.save(teamcityProject);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TeamcityProject update(@NonNull TeamcityProject teamcityProject) {
|
|
||||||
return teamcityProjectRepository.save(teamcityProject);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ExistsContainer<TeamcityProject, String> existsById(@NonNull Collection<String> collection) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.service.impl;
|
|
||||||
|
|
||||||
import lombok.NonNull;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcitySetting;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.repository.TeamcitySettingRepository;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.service.TeamcitySettingService;
|
|
||||||
import org.sadtech.haiti.context.domain.ExistsContainer;
|
|
||||||
import org.sadtech.haiti.core.service.AbstractSimpleManagerService;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
//@Service
|
|
||||||
public class TeamcitySettingServiceImpl extends AbstractSimpleManagerService<TeamcitySetting, Long> implements TeamcitySettingService {
|
|
||||||
|
|
||||||
private final TeamcitySettingRepository teamcitySettingRepository;
|
|
||||||
|
|
||||||
public TeamcitySettingServiceImpl(TeamcitySettingRepository teamcitySettingRepository) {
|
|
||||||
super(teamcitySettingRepository);
|
|
||||||
this.teamcitySettingRepository = teamcitySettingRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TeamcitySetting> getAllByProjectId(@NonNull String projectId) {
|
|
||||||
return teamcitySettingRepository.findAllByProjectId(projectId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TeamcitySetting create(@NonNull TeamcitySetting entity) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TeamcitySetting update(@NonNull TeamcitySetting entity) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ExistsContainer<TeamcitySetting, Long> existsById(@NonNull Collection<Long> collection) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,68 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.service.parser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.config.property.TeamcityProperty;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.BuildShort;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcityProject;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.service.BuildShortService;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.service.TeamcityProjectService;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.sdk.BuildShortJson;
|
|
||||||
import org.sadtech.haiti.context.page.Sheet;
|
|
||||||
import org.sadtech.haiti.core.page.PaginationImpl;
|
|
||||||
import org.sadtech.haiti.utils.network.HttpHeader;
|
|
||||||
import org.sadtech.haiti.utils.network.HttpParse;
|
|
||||||
import org.springframework.core.convert.ConversionService;
|
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static org.sadtech.haiti.utils.network.HttpParse.ACCEPT;
|
|
||||||
import static org.sadtech.haiti.utils.network.HttpParse.AUTHORIZATION;
|
|
||||||
import static org.sadtech.haiti.utils.network.HttpParse.BEARER;
|
|
||||||
|
|
||||||
//@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class BuildShortParser {
|
|
||||||
|
|
||||||
private final BuildShortService buildShortService;
|
|
||||||
private final TeamcityProjectService projectService;
|
|
||||||
private final ConversionService conversionService;
|
|
||||||
private final TeamcityProperty teamcityProperty;
|
|
||||||
|
|
||||||
public void parseNewBuilds() {
|
|
||||||
final Sheet<TeamcityProject> projectSheet = projectService.getAll(PaginationImpl.of(0, 100));
|
|
||||||
if (projectSheet.hasContent()) {
|
|
||||||
projectSheet.getContent().forEach(this::parse);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void parse(TeamcityProject project) {
|
|
||||||
final List<BuildShortJson> buildShortJsons = HttpParse.request(MessageFormat.format(teamcityProperty.getBuildUrl(), project.getId()))
|
|
||||||
.header(ACCEPT)
|
|
||||||
.header(HttpHeader.of(AUTHORIZATION, BEARER + teamcityProperty.getToken()))
|
|
||||||
.executeList(BuildShortJson.class);
|
|
||||||
if (!buildShortJsons.isEmpty()) {
|
|
||||||
final Set<Long> buildIds = buildShortJsons.stream()
|
|
||||||
.map(BuildShortJson::getId)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
final Set<Long> existsId = buildShortService.exists(buildIds);
|
|
||||||
final List<BuildShort> buildShorts = buildShortJsons.stream()
|
|
||||||
.filter(json -> !existsId.contains(json.getId()))
|
|
||||||
.map(json -> conversionService.convert(json, BuildShort.class))
|
|
||||||
.peek(
|
|
||||||
buildShort -> buildShort.setProjectId(project.getId())
|
|
||||||
)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
buildShortService.createAll(buildShorts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.core.service.parser;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.config.property.TeamcityProperty;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.domain.entity.TeamcityProject;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.core.service.TeamcityProjectService;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.sdk.TeamcityProjectJson;
|
|
||||||
import org.sadtech.haiti.utils.network.HttpHeader;
|
|
||||||
import org.sadtech.haiti.utils.network.HttpParse;
|
|
||||||
import org.springframework.core.convert.ConversionService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static org.sadtech.haiti.utils.network.HttpParse.ACCEPT;
|
|
||||||
import static org.sadtech.haiti.utils.network.HttpParse.AUTHORIZATION;
|
|
||||||
import static org.sadtech.haiti.utils.network.HttpParse.BEARER;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
//@Component
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class TeamcityProjectParser {
|
|
||||||
|
|
||||||
private final TeamcityProjectService teamcityProjectService;
|
|
||||||
|
|
||||||
private final TeamcityProperty teamcityProperty;
|
|
||||||
|
|
||||||
private final ConversionService conversionService;
|
|
||||||
|
|
||||||
public void parseNewProject() {
|
|
||||||
|
|
||||||
final List<TeamcityProjectJson> teamcityProjectJsons = HttpParse.request(teamcityProperty.getProjectUrl())
|
|
||||||
.header(ACCEPT)
|
|
||||||
.header(HttpHeader.of(AUTHORIZATION, BEARER + teamcityProperty.getToken()))
|
|
||||||
.executeList(TeamcityProjectJson.class);
|
|
||||||
|
|
||||||
if (!teamcityProjectJsons.isEmpty()) {
|
|
||||||
final Set<String> projectIds = teamcityProjectJsons.stream()
|
|
||||||
.map(TeamcityProjectJson::getId)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
final List<String> exists = teamcityProjectService.exists(projectIds);
|
|
||||||
final List<TeamcityProject> teamcityProjects = teamcityProjectJsons.stream()
|
|
||||||
.filter(json -> !exists.contains(json.getId()))
|
|
||||||
.map(json -> conversionService.convert(json, TeamcityProject.class))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
teamcityProjectService.createAll(teamcityProjects);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<groupId>org.sadtech.bot.gitlab</groupId>
|
|
||||||
<artifactId>teamcity</artifactId>
|
|
||||||
<version>3.0.1-RELEASE</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>teamcity-sdk</artifactId>
|
|
||||||
<version>${gitlab.teamcity.sdk.version}</version>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<optional>true</optional>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-annotations</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
|
||||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<developers>
|
|
||||||
<developer>
|
|
||||||
<id>uPagge</id>
|
|
||||||
<name>Struchkov Mark</name>
|
|
||||||
<email>upagge@ya.ru</email>
|
|
||||||
<organization>SADTECH</organization>
|
|
||||||
<organizationUrl>https://sadtech.org</organizationUrl>
|
|
||||||
<url>https://uPagge.sadtech.org</url>
|
|
||||||
<roles>
|
|
||||||
<role>Project lead</role>
|
|
||||||
</roles>
|
|
||||||
<timezone>+3</timezone>
|
|
||||||
</developer>
|
|
||||||
</developers>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,25 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.sdk;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public class BuildShortJson {
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
private String projectId;
|
|
||||||
private Integer number;
|
|
||||||
private BuildState state;
|
|
||||||
private BuildStatus status;
|
|
||||||
private String branchName;
|
|
||||||
private String buildTypeId;
|
|
||||||
private String href;
|
|
||||||
private String webUrl;
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.sdk;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
public enum BuildState {
|
|
||||||
|
|
||||||
@JsonProperty("finished")
|
|
||||||
FINISHED
|
|
||||||
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.sdk;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
public enum BuildStatus {
|
|
||||||
|
|
||||||
SUCCESS,
|
|
||||||
FAILURE
|
|
||||||
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.sdk;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public abstract class Sheet<T> {
|
|
||||||
|
|
||||||
private Integer count;
|
|
||||||
|
|
||||||
public abstract List<T> getContent();
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.sdk;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public class TeamcityProjectJson {
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
private String name;
|
|
||||||
private String description;
|
|
||||||
private String webUrl;
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.sdk.sheet;
|
|
||||||
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.sdk.BuildShortJson;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.sdk.Sheet;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Setter
|
|
||||||
public class BuildShortJsonSheet extends Sheet<BuildShortJson> {
|
|
||||||
|
|
||||||
private List<BuildShortJson> build;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<BuildShortJson> getContent() {
|
|
||||||
return build;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package org.sadtech.bot.gitlab.teamcity.sdk.sheet;
|
|
||||||
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.sdk.Sheet;
|
|
||||||
import org.sadtech.bot.gitlab.teamcity.sdk.TeamcityProjectJson;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* // TODO: 21.09.2020 Добавить описание.
|
|
||||||
*
|
|
||||||
* @author upagge 21.09.2020
|
|
||||||
*/
|
|
||||||
@Setter
|
|
||||||
public class TeamcityProjectJsonSheet extends Sheet<TeamcityProjectJson> {
|
|
||||||
|
|
||||||
private List<TeamcityProjectJson> project;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TeamcityProjectJson> getContent() {
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -18,11 +18,6 @@
|
|||||||
<artifactId>bot-core</artifactId>
|
<artifactId>bot-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.sadtech.bot.gitlab</groupId>
|
|
||||||
<artifactId>teamcity-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.sadtech.bot.godfather</groupId>
|
<groupId>org.sadtech.bot.godfather</groupId>
|
||||||
<artifactId>telegram-bot</artifactId>
|
<artifactId>telegram-bot</artifactId>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.sadtech.bot.gitlab.telegram.unit;
|
package org.sadtech.bot.gitlab.telegram.unit;
|
||||||
|
|
||||||
import org.sadtech.bot.gitlab.context.domain.PersonInformation;
|
import org.sadtech.bot.gitlab.context.domain.PersonInformation;
|
||||||
import org.sadtech.bot.gitlab.context.domain.entity.Note;
|
|
||||||
import org.sadtech.bot.gitlab.context.service.AppSettingService;
|
import org.sadtech.bot.gitlab.context.service.AppSettingService;
|
||||||
import org.sadtech.bot.gitlab.context.service.TaskService;
|
import org.sadtech.bot.gitlab.context.service.TaskService;
|
||||||
import org.sadtech.bot.gitlab.core.config.properties.GitlabProperty;
|
import org.sadtech.bot.gitlab.core.config.properties.GitlabProperty;
|
||||||
@ -131,7 +130,7 @@ public class MenuConfig {
|
|||||||
final Long userId = personInformation.getId();
|
final Long userId = personInformation.getId();
|
||||||
final String text = taskService.getAllPersonTask(userId, false).stream()
|
final String text = taskService.getAllPersonTask(userId, false).stream()
|
||||||
// .collect(Collectors.groupingBy())
|
// .collect(Collectors.groupingBy())
|
||||||
.map(Note::getBody)
|
.map(note -> MessageFormat.format("[{0}]({1})", note.getBody(), note.getWebUrl()))
|
||||||
.collect(Collectors.joining("\n"));
|
.collect(Collectors.joining("\n"));
|
||||||
return BoxAnswer.of(text);
|
return BoxAnswer.of(text);
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user