Merge pull request #2 from valitydev/ft/actions

add actions
This commit is contained in:
Gregory 2022-01-14 22:42:56 +03:00 committed by GitHub
commit eed6c5a3eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 123 additions and 72 deletions

26
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Build Artifact
on:
pull_request:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Checkout GitHub Action Repo
uses: actions/checkout@v2
with:
repository: valitydev/action-jdk-build
ref: v1.0.18
path: .github/actions/action-jdk-build
- name: Run Build Java
uses: ./.github/actions/action-jdk-build
with:
github-pat: '${{ secrets.GH_PACKAGES_RO_PAT }}'
github-user: 'strug'

46
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,46 @@
name: Deploy Docker Image
on:
push:
branches:
- 'master'
- 'main'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-deploy:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Checkout GitHub Action JDK Build Repo
uses: actions/checkout@v2
with:
repository: valitydev/action-jdk-build
ref: v1.0.18
path: .github/actions/action-jdk-build
- name: Checkout GitHub Action Deploy Docker Repo
uses: actions/checkout@v2
with:
repository: valitydev/action-deploy-docker
ref: v1.0.16
path: .github/actions/action-deploy-docker
- name: Run Build Java
uses: ./.github/actions/action-jdk-build
with:
github-pat: '${{ secrets.GH_PACKAGES_RO_PAT }}'
github-user: 'strug'
- name: Deploy image
uses: ./.github/actions/action-deploy-docker
with:
registry-username: ${{ github.actor }}
registry-access-token: ${{ secrets.GITHUB_TOKEN }}
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}

4
.gitmodules vendored
View File

@ -1,4 +0,0 @@
[submodule "build_utils"]
path = build_utils
url = git@github.com:rbkmoney/build_utils.git
branch = master

15
Jenkinsfile vendored
View File

@ -1,15 +0,0 @@
#!groovy
build('wb-list-manager', 'java-maven') {
checkoutRepo()
loadBuildUtils()
def javaServicePipeline
runStage('load JavaService pipeline') {
javaServicePipeline = load("build_utils/jenkins_lib/pipeJavaServiceInsideDocker.groovy")
}
def serviceName = env.REPO_NAME
def mvnArgs = '-DjvmArgs="-Xmx256m"'
javaServicePipeline(serviceName, mvnArgs)
}

@ -1 +0,0 @@
Subproject commit a7655bc60c877a65cdfe3d9b668021d970d88a76

14
pom.xml
View File

@ -4,9 +4,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>service-parent-pom</artifactId>
<version>2.0.9</version>
<version>1.0.1</version>
</parent>
<artifactId>wb-list-manager</artifactId>
@ -24,9 +24,9 @@
<dockerfile.base.service.tag>c0612d6052ac049496b72a23a04acb142035f249</dockerfile.base.service.tag>
<dockerfile.registry>dr2.rbkmoney.com</dockerfile.registry>
<shared.resources.version>0.3.7</shared.resources.version>
<wb.list.proto.version>1.39-e20ba71</wb.list.proto.version>
<wb.list.proto.version>1.44-5dbd6d4</wb.list.proto.version>
<kafka.common.lib.version>0.1.4</kafka.common.lib.version>
<testcontainers.annotations.version>1.3.0</testcontainers.annotations.version>
<testcontainers.annotations.version>1.3.2</testcontainers.annotations.version>
</properties>
<dependencies>
@ -66,10 +66,10 @@
<dependency>
<groupId>com.rbkmoney</groupId>
<artifactId>spring-boot-starter-metrics-statsd</artifactId>
<version>1.1.0</version>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>wb-list-proto</artifactId>
<version>${wb.list.proto.version}</version>
</dependency>
@ -114,7 +114,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<groupId>dev.vality</groupId>
<artifactId>testcontainers-annotations</artifactId>
<version>${testcontainers.annotations.version}</version>
<scope>test</scope>

View File

@ -1,9 +1,9 @@
package com.rbkmoney.wb.list.manager.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rbkmoney.damsel.wb_list.WbListServiceSrv;
import com.rbkmoney.wb.list.manager.handler.WbListServiceHandler;
import com.rbkmoney.wb.list.manager.repository.ListRepository;
import dev.vality.damsel.wb_list.WbListServiceSrv;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -2,11 +2,11 @@ package com.rbkmoney.wb.list.manager.converter;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rbkmoney.damsel.wb_list.ChangeCommand;
import com.rbkmoney.damsel.wb_list.CountInfo;
import com.rbkmoney.wb.list.manager.model.CountInfoModel;
import com.rbkmoney.wb.list.manager.model.Row;
import com.rbkmoney.wb.list.manager.utils.KeyGenerator;
import dev.vality.damsel.wb_list.ChangeCommand;
import dev.vality.damsel.wb_list.CountInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
@ -21,14 +21,14 @@ public class CommandToRowConverter implements Converter<ChangeCommand, Row> {
@Override
public Row convert(ChangeCommand command) {
Row row = new Row();
com.rbkmoney.damsel.wb_list.Row commandRow = command.getRow();
dev.vality.damsel.wb_list.Row commandRow = command.getRow();
String key = KeyGenerator.generateKey(commandRow);
row.setKey(key);
row.setValue(initValue(commandRow));
return row;
}
private String initValue(com.rbkmoney.damsel.wb_list.Row commandRow) {
private String initValue(dev.vality.damsel.wb_list.Row commandRow) {
if (commandRow.isSetRowInfo() && commandRow.getRowInfo().isSetCountInfo()) {
try {
CountInfo countInfo = commandRow.getRowInfo().getCountInfo();

View File

@ -1,11 +1,11 @@
package com.rbkmoney.wb.list.manager.handler;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rbkmoney.damsel.wb_list.*;
import com.rbkmoney.wb.list.manager.exception.RiakExecutionException;
import com.rbkmoney.wb.list.manager.model.CountInfoModel;
import com.rbkmoney.wb.list.manager.repository.ListRepository;
import com.rbkmoney.wb.list.manager.utils.KeyGenerator;
import dev.vality.damsel.wb_list.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.thrift.TException;

View File

@ -1,12 +1,11 @@
package com.rbkmoney.wb.list.manager.resource;
import com.rbkmoney.damsel.wb_list.WbListServiceSrv;
import com.rbkmoney.woody.thrift.impl.http.THServiceBuilder;
import dev.vality.damsel.wb_list.WbListServiceSrv;
import lombok.RequiredArgsConstructor;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;
@WebServlet("/wb_list/v1")

View File

@ -1,8 +1,8 @@
package com.rbkmoney.wb.list.manager.serializer;
import com.rbkmoney.damsel.wb_list.ChangeCommand;
import com.rbkmoney.kafka.common.serialization.AbstractThriftDeserializer;
import dev.vality.damsel.wb_list.ChangeCommand;
import lombok.extern.slf4j.Slf4j;
@Slf4j

View File

@ -1,8 +1,8 @@
package com.rbkmoney.wb.list.manager.serializer;
import com.rbkmoney.damsel.wb_list.ChangeCommand;
import com.rbkmoney.kafka.common.serialization.ThriftSerializer;
import dev.vality.damsel.wb_list.ChangeCommand;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.serialization.Serde;

View File

@ -1,8 +1,8 @@
package com.rbkmoney.wb.list.manager.serializer;
import com.rbkmoney.damsel.wb_list.Event;
import com.rbkmoney.kafka.common.serialization.AbstractThriftDeserializer;
import dev.vality.damsel.wb_list.Event;
import lombok.extern.slf4j.Slf4j;
@Slf4j

View File

@ -1,8 +1,8 @@
package com.rbkmoney.wb.list.manager.serializer;
import com.rbkmoney.damsel.wb_list.Event;
import com.rbkmoney.kafka.common.serialization.ThriftSerializer;
import dev.vality.damsel.wb_list.Event;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.serialization.Serde;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.wb.list.manager.service;
import com.rbkmoney.damsel.wb_list.ChangeCommand;
import com.rbkmoney.damsel.wb_list.Event;
import dev.vality.damsel.wb_list.ChangeCommand;
import dev.vality.damsel.wb_list.Event;
public interface CommandService {

View File

@ -1,11 +1,11 @@
package com.rbkmoney.wb.list.manager.service;
import com.rbkmoney.damsel.wb_list.ChangeCommand;
import com.rbkmoney.damsel.wb_list.Event;
import com.rbkmoney.damsel.wb_list.EventType;
import com.rbkmoney.wb.list.manager.converter.CommandToRowConverter;
import com.rbkmoney.wb.list.manager.model.Row;
import com.rbkmoney.wb.list.manager.repository.ListRepository;
import dev.vality.damsel.wb_list.ChangeCommand;
import dev.vality.damsel.wb_list.Event;
import dev.vality.damsel.wb_list.EventType;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

View File

@ -1,9 +1,9 @@
package com.rbkmoney.wb.list.manager.stream;
import com.rbkmoney.damsel.wb_list.ChangeCommand;
import com.rbkmoney.wb.list.manager.serializer.CommandSerde;
import com.rbkmoney.wb.list.manager.serializer.EventSerde;
import com.rbkmoney.wb.list.manager.service.CommandService;
import dev.vality.damsel.wb_list.ChangeCommand;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.serialization.Serdes;

View File

@ -1,7 +1,7 @@
package com.rbkmoney.wb.list.manager.utils;
import com.rbkmoney.damsel.wb_list.ListType;
import com.rbkmoney.damsel.wb_list.PaymentId;
import dev.vality.damsel.wb_list.ListType;
import dev.vality.damsel.wb_list.PaymentId;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.springframework.util.StringUtils;
@ -11,7 +11,7 @@ public class KeyGenerator {
private static final String DELIMITER = "_";
public static String generateKey(com.rbkmoney.damsel.wb_list.Row row) {
public static String generateKey(dev.vality.damsel.wb_list.Row row) {
if (row.isSetId() && row.getId().isSetPaymentId()) {
PaymentId paymentId = row.getId().getPaymentId();
return generateKey(row.getListType(), row.getListName(), row.getValue(), paymentId.getPartyId(),

View File

@ -1,15 +1,15 @@
package com.rbkmoney.wb.list.manager;
import com.rbkmoney.damsel.wb_list.*;
import com.rbkmoney.wb.list.manager.utils.ChangeCommandWrapper;
import dev.vality.damsel.wb_list.*;
import java.time.Instant;
import java.util.UUID;
public abstract class TestObjectFactory {
public static com.rbkmoney.damsel.wb_list.Row testRow() {
com.rbkmoney.damsel.wb_list.Row row = new com.rbkmoney.damsel.wb_list.Row();
public static dev.vality.damsel.wb_list.Row testRow() {
dev.vality.damsel.wb_list.Row row = new dev.vality.damsel.wb_list.Row();
row.setId(IdInfo.payment_id(new PaymentId()
.setShopId(randomString())
.setPartyId(randomString())
@ -29,7 +29,7 @@ public abstract class TestObjectFactory {
public static ChangeCommandWrapper testCommand() {
ChangeCommandWrapper changeCommand = new ChangeCommandWrapper();
changeCommand.setCommand(Command.CREATE);
com.rbkmoney.damsel.wb_list.Row row = testRow();
dev.vality.damsel.wb_list.Row row = testRow();
changeCommand.setRow(row);
return changeCommand;
}

View File

@ -1,16 +1,16 @@
package com.rbkmoney.wb.list.manager;
import com.rbkmoney.damsel.wb_list.*;
import com.rbkmoney.testcontainers.annotations.kafka.KafkaTestcontainer;
import com.rbkmoney.testcontainers.annotations.kafka.config.KafkaConsumer;
import com.rbkmoney.testcontainers.annotations.kafka.config.KafkaConsumerConfig;
import com.rbkmoney.testcontainers.annotations.kafka.config.KafkaProducer;
import com.rbkmoney.testcontainers.annotations.kafka.config.KafkaProducerConfig;
import com.rbkmoney.wb.list.manager.extension.AwaitilityExtension;
import com.rbkmoney.wb.list.manager.extension.RiakTestcontainerExtension;
import com.rbkmoney.wb.list.manager.utils.ChangeCommandWrapper;
import com.rbkmoney.woody.api.flow.error.WRuntimeException;
import com.rbkmoney.woody.thrift.impl.http.THClientBuilder;
import dev.vality.damsel.wb_list.*;
import dev.vality.testcontainers.annotations.kafka.KafkaTestcontainer;
import dev.vality.testcontainers.annotations.kafka.config.KafkaConsumer;
import dev.vality.testcontainers.annotations.kafka.config.KafkaConsumerConfig;
import dev.vality.testcontainers.annotations.kafka.config.KafkaProducer;
import dev.vality.testcontainers.annotations.kafka.config.KafkaProducerConfig;
import org.apache.thrift.TBase;
import org.apache.thrift.TException;
import org.awaitility.Awaitility;

View File

@ -1,13 +1,13 @@
package com.rbkmoney.wb.list.manager;
import com.rbkmoney.damsel.wb_list.ChangeCommand;
import com.rbkmoney.damsel.wb_list.Command;
import com.rbkmoney.testcontainers.annotations.KafkaSpringBootTest;
import com.rbkmoney.testcontainers.annotations.kafka.KafkaTestcontainer;
import com.rbkmoney.testcontainers.annotations.kafka.config.KafkaProducer;
import com.rbkmoney.wb.list.manager.config.MockedStartupInitializers;
import com.rbkmoney.wb.list.manager.exception.RiakExecutionException;
import com.rbkmoney.wb.list.manager.repository.ListRepository;
import dev.vality.damsel.wb_list.ChangeCommand;
import dev.vality.damsel.wb_list.Command;
import dev.vality.testcontainers.annotations.KafkaSpringBootTest;
import dev.vality.testcontainers.annotations.kafka.KafkaTestcontainer;
import dev.vality.testcontainers.annotations.kafka.config.KafkaProducer;
import org.apache.thrift.TBase;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,8 +1,8 @@
package com.rbkmoney.wb.list.manager.config;
import com.rbkmoney.damsel.wb_list.Event;
import com.rbkmoney.testcontainers.annotations.kafka.config.KafkaConsumer;
import com.rbkmoney.wb.list.manager.serializer.EventDeserializer;
import dev.vality.damsel.wb_list.Event;
import dev.vality.testcontainers.annotations.kafka.config.KafkaConsumer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,6 +1,6 @@
package com.rbkmoney.wb.list.manager.extension;
import com.rbkmoney.testcontainers.annotations.util.GenericContainerUtil;
import dev.vality.testcontainers.annotations.util.GenericContainerUtil;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;

View File

@ -1,10 +1,10 @@
package com.rbkmoney.wb.list.manager.handler;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rbkmoney.damsel.wb_list.Result;
import com.rbkmoney.wb.list.manager.TestObjectFactory;
import com.rbkmoney.wb.list.manager.model.Row;
import com.rbkmoney.wb.list.manager.repository.ListRepository;
import dev.vality.damsel.wb_list.Result;
import org.apache.thrift.TException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -26,7 +26,7 @@ public class WbListServiceHandlerTest {
@Mock
private ListRepository listRepository;
private com.rbkmoney.damsel.wb_list.Row row;
private dev.vality.damsel.wb_list.Row row;
@BeforeEach
void setUp() {
@ -56,7 +56,7 @@ public class WbListServiceHandlerTest {
@Test
void isAllExist() throws TException {
ArrayList<com.rbkmoney.damsel.wb_list.Row> list = new ArrayList<>();
ArrayList<dev.vality.damsel.wb_list.Row> list = new ArrayList<>();
boolean exist = wbListServiceHandler.isAllExist(list);
assertTrue(exist);
@ -73,7 +73,7 @@ public class WbListServiceHandlerTest {
@Test
void isAnyExist() throws TException {
ArrayList<com.rbkmoney.damsel.wb_list.Row> list = new ArrayList<>();
ArrayList<dev.vality.damsel.wb_list.Row> list = new ArrayList<>();
boolean exist = wbListServiceHandler.isAnyExist(list);
assertFalse(exist);
@ -92,7 +92,7 @@ public class WbListServiceHandlerTest {
@Test
void isNoOneExist() throws TException {
ArrayList<com.rbkmoney.damsel.wb_list.Row> list = new ArrayList<>();
ArrayList<dev.vality.damsel.wb_list.Row> list = new ArrayList<>();
boolean exist = wbListServiceHandler.isNotOneExist(list);
assertTrue(exist);

View File

@ -1,7 +1,7 @@
package com.rbkmoney.wb.list.manager.utils;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.rbkmoney.damsel.wb_list.ChangeCommand;
import dev.vality.damsel.wb_list.ChangeCommand;
@JsonFilter("myFilter")
public class ChangeCommandWrapper extends ChangeCommand {