Настройка CICD с помощью Drone
This commit is contained in:
parent
77d9e6aba4
commit
f9259f558b
24
.drone.yml
24
.drone.yml
@ -5,17 +5,31 @@ name: gitlab-notify
|
||||
steps:
|
||||
- name: package
|
||||
image: maven:3.8.6-eclipse-temurin-17
|
||||
commands:
|
||||
- mvn -U clean package
|
||||
volumes:
|
||||
- name: m2
|
||||
path: /root/.m2
|
||||
path: /root/.m2/repository
|
||||
commands:
|
||||
- mvn -U clean package
|
||||
|
||||
- name: docker-publish
|
||||
image: upagge/docker-buildx:latest
|
||||
environment:
|
||||
DOCKER_REGISTRY_TOKEN:
|
||||
from_secret: DOCKER_REGISTRY_TOKEN
|
||||
DOCKER_IMAGE_NAME:
|
||||
from_secret: DOCKER_IMAGE_NAME
|
||||
DOCKER_REGISTRY_USER:
|
||||
from_secret: DOCKER_REGISTRY_USER
|
||||
commands:
|
||||
- echo "$DOCKER_REGISTRY_TOKEN" | docker login docker.io --username $DOCKER_REGISTRY_USER --password-stdin
|
||||
- docker buildx create --use
|
||||
- docker buildx build --push --platform linux/amd64,linux/arm64/v8 -t "$DOCKER_IMAGE_NAME:develop" .
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
- develop
|
||||
|
||||
volumes:
|
||||
- name: m2
|
||||
host:
|
||||
path: $MAVEN_REPO
|
||||
path: /drone/volume/m2
|
@ -10,7 +10,6 @@ import dev.struchkov.bot.gitlab.context.service.ProjectService;
|
||||
import dev.struchkov.bot.gitlab.core.config.properties.GitlabProperty;
|
||||
import dev.struchkov.bot.gitlab.core.config.properties.PersonProperty;
|
||||
import dev.struchkov.bot.gitlab.core.service.parser.forktask.GetMergeRequestTask;
|
||||
import dev.struchkov.bot.gitlab.core.utils.PoolUtils;
|
||||
import dev.struchkov.bot.gitlab.core.utils.StringUtils;
|
||||
import dev.struchkov.bot.gitlab.sdk.domain.CommitJson;
|
||||
import dev.struchkov.bot.gitlab.sdk.domain.MergeRequestJson;
|
||||
@ -33,6 +32,7 @@ import java.util.stream.Stream;
|
||||
|
||||
import static dev.struchkov.haiti.utils.Checker.checkNotEmpty;
|
||||
import static dev.struchkov.haiti.utils.Checker.checkNotNull;
|
||||
import static dev.struchkov.haiti.utils.concurrent.ForkJoinUtils.pullTaskResults;
|
||||
import static dev.struchkov.haiti.utils.network.HttpParse.ACCEPT;
|
||||
|
||||
@Slf4j
|
||||
@ -134,7 +134,7 @@ public class MergeRequestParser {
|
||||
.map(forkJoinPool::submit)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return PoolUtils.pullTaskResults(tasks);
|
||||
return pullTaskResults(tasks);
|
||||
}
|
||||
|
||||
private static void personMapping(List<MergeRequest> newMergeRequests) {
|
||||
|
@ -35,10 +35,10 @@ import static dev.struchkov.bot.gitlab.context.domain.PipelineStatus.PENDING;
|
||||
import static dev.struchkov.bot.gitlab.context.domain.PipelineStatus.PREPARING;
|
||||
import static dev.struchkov.bot.gitlab.context.domain.PipelineStatus.RUNNING;
|
||||
import static dev.struchkov.bot.gitlab.context.domain.PipelineStatus.WAITING_FOR_RESOURCE;
|
||||
import static dev.struchkov.bot.gitlab.core.utils.PoolUtils.pullTaskResult;
|
||||
import static dev.struchkov.bot.gitlab.core.utils.PoolUtils.pullTaskResults;
|
||||
import static dev.struchkov.haiti.context.exception.ConvertException.convertException;
|
||||
import static dev.struchkov.haiti.utils.Checker.checkNotEmpty;
|
||||
import static dev.struchkov.haiti.utils.concurrent.ForkJoinUtils.pullTaskResult;
|
||||
import static dev.struchkov.haiti.utils.concurrent.ForkJoinUtils.pullTaskResults;
|
||||
import static dev.struchkov.haiti.utils.network.HttpParse.ACCEPT;
|
||||
|
||||
/**
|
||||
@ -137,7 +137,7 @@ public class PipelineParser {
|
||||
|
||||
|
||||
public void scanOldPipeline() {
|
||||
log.debug("Старт обработки старых папйплайнов");
|
||||
log.debug("Старт обработки старых пайплайнов");
|
||||
int page = 0;
|
||||
Page<Pipeline> pipelineSheet = pipelineService.getAllByStatuses(oldStatus, PageRequest.of(page, COUNT));
|
||||
|
||||
@ -159,7 +159,7 @@ public class PipelineParser {
|
||||
|
||||
pipelineSheet = pipelineService.getAllByStatuses(oldStatus, PageRequest.of(++page, COUNT));
|
||||
}
|
||||
log.debug("Конец обработки старых папйплайнов");
|
||||
log.debug("Конец обработки старых пайплайнов");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,60 +0,0 @@
|
||||
package dev.struchkov.bot.gitlab.core.utils;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ForkJoinTask;
|
||||
|
||||
@Slf4j
|
||||
@UtilityClass
|
||||
public class PoolUtils {
|
||||
|
||||
public static <T> List<T> pullTaskResults(List<ForkJoinTask<List<T>>> tasks) {
|
||||
final List<T> results = new ArrayList<>();
|
||||
Iterator<ForkJoinTask<List<T>>> iterator = tasks.iterator();
|
||||
while (!tasks.isEmpty()) {
|
||||
while (iterator.hasNext()) {
|
||||
final ForkJoinTask<List<T>> task = iterator.next();
|
||||
if (task.isDone()) {
|
||||
final List<T> jsons;
|
||||
try {
|
||||
jsons = task.get();
|
||||
results.addAll(jsons);
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
iterator = tasks.iterator();
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public static <T> List<T> pullTaskResult(List<ForkJoinTask<T>> tasks) {
|
||||
final List<T> results = new ArrayList<>();
|
||||
Iterator<ForkJoinTask<T>> iterator = tasks.iterator();
|
||||
while (!tasks.isEmpty()) {
|
||||
while (iterator.hasNext()) {
|
||||
final ForkJoinTask<T> task = iterator.next();
|
||||
if (task.isDone()) {
|
||||
try {
|
||||
results.add(task.get());
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
iterator = tasks.iterator();
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
4
pom.xml
4
pom.xml
@ -104,13 +104,13 @@
|
||||
<dependency>
|
||||
<groupId>dev.struchkov.haiti</groupId>
|
||||
<artifactId>haiti-utils</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<version>2.3.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.struchkov.haiti</groupId>
|
||||
<artifactId>haiti-exception</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<version>2.3.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
Loading…
Reference in New Issue
Block a user