Compare commits

...

7 Commits

Author SHA1 Message Date
YannC
699f879bd3 chore(version): update to version 'v0.14.4'. 2024-01-23 14:54:20 +01:00
Ludovic DEHON
b1e11c7896 fix(ui): add cookie on api call 2024-01-23 14:53:41 +01:00
YannC
7463224d23 fix(): use same JDBC mapper (#2915)
* fix(): use same JDBC mapper

* cleanup

* fix(test): change wiremock unit test port

---------

Co-authored-by: Ludovic DEHON <tchiot.ludo@gmail.com>
2024-01-23 14:53:32 +01:00
YannC
668380eb34 chore(version): update to version 'v0.14.3'. 2024-01-22 17:21:01 +01:00
YannC
0308e8e262 chore(version): update to version 'v0.14.2'. 2024-01-22 14:55:45 +01:00
Ludovic DEHON
8fcde439bd chore(version): update to version 'v0.14.1'. 2024-01-21 11:58:28 +01:00
brian.mulier
cc59ac0713 fix(core-ee): avoid the need of recursiveness when generating outputFiles 2024-01-21 11:57:51 +01:00
15 changed files with 54 additions and 23 deletions

View File

@@ -62,7 +62,7 @@ abstract public class PluginUtilsService {
tempFile = File.createTempFile(s + "_", null, tempDirectory.toFile());
}
result.put(s, "{{workingDir}}/" + tempFile.getName());
result.put(s, additionalVars.get("workingDir") + "/" + tempFile.getName());
}));
if (!isDir) {

View File

@@ -0,0 +1,27 @@
package io.kestra.core.tasks;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.startsWith;
public class PluginUtilsServiceTest {
@Test
void outputFiles() throws IOException {
Path tempDirectory = Files.createTempDirectory("plugin-utils");
Map<String, String> outputFilesMap = PluginUtilsService.createOutputFiles(
tempDirectory,
List.of("out"),
new HashMap<>(Map.of("workingDir", tempDirectory.toAbsolutePath().toString()))
);
assertThat(outputFilesMap.get("out"), startsWith(tempDirectory.resolve("out_").toString()));
}
}

View File

@@ -1,4 +1,4 @@
version=0.14.0
version=0.14.4
jacksonVersion=2.15.2
micronautVersion=3.10.1

View File

@@ -1,11 +1,11 @@
package io.kestra.jdbc;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableMap;
import io.kestra.core.exceptions.DeserializationException;
import io.kestra.core.models.executions.metrics.MetricAggregation;
import io.kestra.core.queues.QueueService;
import io.kestra.core.repositories.ArrayListTotal;
import io.kestra.core.serializers.JacksonMapper;
import io.kestra.core.utils.IdUtils;
import io.micronaut.context.ApplicationContext;
import io.micronaut.data.model.Pageable;
@@ -31,6 +31,8 @@ import java.util.stream.Collectors;
import java.util.stream.IntStream;
public abstract class AbstractJdbcRepository<T> {
protected static final ObjectMapper MAPPER = JdbcMapper.of();
protected final QueueService queueService;
protected final Class<T> cls;
@@ -163,7 +165,7 @@ public abstract class AbstractJdbcRepository<T> {
public T deserialize(String record) {
try {
return JacksonMapper.ofJson().readValue(record, cls);
return MAPPER.readValue(record, cls);
} catch (IOException e) {
throw new DeserializationException(e, record);
}

View File

@@ -21,7 +21,7 @@ public abstract class JdbcMapper {
public static ObjectMapper of() {
if (MAPPER == null) {
MAPPER = JacksonMapper.ofJson().copy();
MAPPER = JacksonMapper.ofJson(false).copy();
final SimpleModule module = new SimpleModule();
module.addSerializer(Instant.class, new JsonSerializer<>() {

View File

@@ -23,7 +23,7 @@ import java.util.function.Consumer;
@Singleton
@Slf4j
public class JdbcWorkerTriggerResultQueueService {
private final static ObjectMapper MAPPER = JacksonMapper.ofJson();
private final static ObjectMapper MAPPER = JdbcMapper.of();
private final JdbcQueue<WorkerTriggerResult> workerTriggerResultQueue;
@Inject

View File

@@ -5,7 +5,7 @@ import io.kestra.core.exceptions.DeserializationException;
import io.kestra.core.models.executions.Execution;
import io.kestra.core.models.executions.TaskRun;
import io.kestra.core.runners.SubflowExecution;
import io.kestra.core.serializers.JacksonMapper;
import io.kestra.jdbc.JdbcMapper;
import io.kestra.jdbc.repository.AbstractJdbcRepository;
import org.jooq.DSLContext;
import org.jooq.Field;
@@ -18,7 +18,7 @@ import java.util.Map;
import java.util.Optional;
public abstract class AbstractJdbcSubflowExecutionStorage extends AbstractJdbcRepository {
private final static ObjectMapper MAPPER = JacksonMapper.ofJson();
private final static ObjectMapper MAPPER = JdbcMapper.of();
protected io.kestra.jdbc.AbstractJdbcRepository<SubflowExecution<?>> jdbcRepository;
@SuppressWarnings({"unchecked", "rawtypes"})

View File

@@ -31,6 +31,7 @@ import io.kestra.core.tasks.flows.Template;
import io.kestra.core.topologies.FlowTopologyService;
import io.kestra.core.utils.Await;
import io.kestra.core.utils.Either;
import io.kestra.jdbc.JdbcMapper;
import io.kestra.jdbc.repository.AbstractJdbcExecutionRepository;
import io.kestra.jdbc.repository.AbstractJdbcFlowTopologyRepository;
import io.kestra.jdbc.repository.AbstractJdbcWorkerInstanceRepository;
@@ -58,7 +59,7 @@ import java.util.stream.Stream;
@JdbcRunnerEnabled
@Slf4j
public class JdbcExecutor implements ExecutorInterface {
private static final ObjectMapper MAPPER = JacksonMapper.ofJson();
private static final ObjectMapper MAPPER = JdbcMapper.of();;
private final ScheduledExecutorService schedulerDelay = Executors.newSingleThreadScheduledExecutor();

View File

@@ -7,11 +7,11 @@ import io.kestra.core.exceptions.DeserializationException;
import io.kestra.core.queues.QueueException;
import io.kestra.core.queues.QueueInterface;
import io.kestra.core.queues.QueueService;
import io.kestra.core.serializers.JacksonMapper;
import io.kestra.core.utils.Either;
import io.kestra.core.utils.ExecutorsUtils;
import io.kestra.core.utils.IdUtils;
import io.kestra.jdbc.JdbcConfiguration;
import io.kestra.jdbc.JdbcMapper;
import io.kestra.jdbc.JooqDSLContextWrapper;
import io.kestra.jdbc.repository.AbstractJdbcRepository;
import io.micronaut.context.ApplicationContext;
@@ -42,7 +42,7 @@ import java.util.function.Supplier;
@Slf4j
public abstract class JdbcQueue<T> implements QueueInterface<T> {
protected static final ObjectMapper mapper = JacksonMapper.ofJson();
protected static final ObjectMapper MAPPER = JdbcMapper.of();
private static ExecutorService poolExecutor;
@@ -86,7 +86,7 @@ public abstract class JdbcQueue<T> implements QueueInterface<T> {
Map<Field<Object>, Object> fields = new HashMap<>();
fields.put(AbstractJdbcRepository.field("type"), this.cls.getName());
fields.put(AbstractJdbcRepository.field("key"), key != null ? key : IdUtils.create());
fields.put(AbstractJdbcRepository.field("value"), JSONB.valueOf(mapper.writeValueAsString(message)));
fields.put(AbstractJdbcRepository.field("value"), JSONB.valueOf(MAPPER.writeValueAsString(message)));
if (consumerGroup != null) {
fields.put(AbstractJdbcRepository.field("consumer_group"), consumerGroup);
@@ -289,7 +289,7 @@ public abstract class JdbcQueue<T> implements QueueInterface<T> {
return fetch
.map(record -> {
try {
return Either.left(JacksonMapper.ofJson().readValue(record.get("value", String.class), cls));
return Either.left(MAPPER.readValue(record.get("value", String.class), cls));
} catch (JsonProcessingException e) {
return Either.right(new DeserializationException(e, record.get("value", String.class)));
}

View File

@@ -16,6 +16,7 @@ export default {
actions: {
loadFeeds({commit}, options) {
return axios.get(API_URL + "/v1/feeds", {
withCredentials: true,
params: {
iid: options.iid,
uid: options.uid,
@@ -58,7 +59,7 @@ export default {
dispatch("posthogEvents", mergeData)
return axios.post(API_URL + "/v1/reports/events", mergeData);
return axios.post(API_URL + "/v1/reports/events", mergeData, {withCredentials: true});
},
posthogEvents(_, data) {
const type = data.type;

View File

@@ -22,7 +22,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
@MicronautTest
@WireMockTest(httpPort = 8081)
@WireMockTest(httpPort = 28181)
class BlueprintControllerTest {
@Inject
@Client("/")

View File

@@ -22,7 +22,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
// For this controller tests, we replace every Marketplace URLs with http://localhost:8081/{previous-host} to target Wiremock server
@WireMockTest(httpPort = 8081)
@WireMockTest(httpPort = 28181)
class EditorControllerTest extends JdbcH2ControllerTest {
@Inject
@Client("/")
@@ -36,12 +36,12 @@ class EditorControllerTest extends JdbcH2ControllerTest {
return new MarketplaceRequestMapper() {
@Override
public String url(MarketplaceRequestType type) {
return type.getUrl().replaceFirst("https?://", "http://localhost:8081/");
return type.getUrl().replaceFirst("https?://", "http://localhost:28181/");
}
@Override
public String resourceBaseUrl(String publisher) {
return super.resourceBaseUrl(publisher).replaceFirst("https?://", "http://localhost:8081/");
return super.resourceBaseUrl(publisher).replaceFirst("https?://", "http://localhost:28181/");
}
};
}
@@ -123,7 +123,7 @@ class EditorControllerTest extends JdbcH2ControllerTest {
private MappingBuilder hasGoodHeaders(MappingBuilder mappingBuilder) {
return mappingBuilder.withHeader("Origin", equalTo("http://localhost:8080"))
.withHeader("Host", equalTo("localhost:8081"))
.withHeader("Host", equalTo("localhost:28181"))
.withHeader("Cookie", absent())
.withHeader("Access-Control-Allow-Origin", absent());
}

View File

@@ -446,7 +446,7 @@ class ExecutionControllerTest extends JdbcH2ControllerTest {
FileMetas.class
).blockingFirst();
assertThat(metas.getSize(), equalTo(3002L));
assertThat(metas.getSize(), greaterThanOrEqualTo(3003L));
String newExecutionId = IdUtils.create();

View File

@@ -1,4 +1,4 @@
[
"http://localhost:8081/my-publisher.vscode-unpkg.net/my-publisher/my-extension/1.0.0/extension/package.json",
"http://localhost:8081/my-publisher.vscode-unpkg.net/my-publisher/my-extension/1.0.0/extension/package.nls.json"
"http://localhost:28181/my-publisher.vscode-unpkg.net/my-publisher/my-extension/1.0.0/extension/package.json",
"http://localhost:28181/my-publisher.vscode-unpkg.net/my-publisher/my-extension/1.0.0/extension/package.nls.json"
]

View File

@@ -8,7 +8,7 @@ micronaut:
http:
services:
api:
url: http://localhost:8081
url: http://localhost:28181
server:
cors:
enabled: true