Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

project: minor changes #836

Merged
merged 4 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
uses: actions/checkout@v3

- name: Build and test with Maven
env:
SKIP_DOCKER_TESTS: "true"
run: ./mvnw -s .github/settings.xml -B clean install -Pgha -Pdocker -Pit -Pjdk${{ matrix.jdk_version }}

- name: Build with debian docker images
Expand Down
16 changes: 8 additions & 8 deletions agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
Expand Down Expand Up @@ -125,14 +133,6 @@
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-guava</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.walmartlabs.concord.agent.executors.runner.ProcessPool;
import com.walmartlabs.concord.agent.remote.ApiClientFactory;
import com.walmartlabs.concord.agent.remote.QueueClientProvider;
import com.walmartlabs.concord.common.ObjectMapperProvider;
import com.walmartlabs.concord.server.queueclient.QueueClient;
import com.walmartlabs.ollie.config.ConfigurationProcessor;
import com.walmartlabs.ollie.config.Environment;
Expand Down
30 changes: 25 additions & 5 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,31 @@
<artifactId>commons-validator</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-guava</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<scope>provided</scope>
</dependency>

<!-- JDK9+ compatibility -->
<dependency>
Expand Down Expand Up @@ -75,11 +100,6 @@
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.walmartlabs.concord.agent;
package com.walmartlabs.concord.common;

/*-
* *****
Expand All @@ -9,7 +9,7 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
Expand All @@ -27,13 +27,19 @@
import com.fasterxml.jackson.datatype.guava.GuavaModule;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Provider;

public class ObjectMapperProvider implements Provider<ObjectMapper> {

private static final Logger log = LoggerFactory.getLogger(ObjectMapperProvider.class);

@Override
public ObjectMapper get() {
log.info("Using concord-common's ObjectMapper...");

ObjectMapper mapper = new ObjectMapper()
.registerModule(new Jdk8Module())
.registerModule(new GuavaModule())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.walmartlabs.concord.client.ProcessEntry;
import com.walmartlabs.concord.client.StartProcessResponse;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;

import java.io.File;
import java.util.HashMap;
Expand All @@ -36,7 +36,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@DisabledIf(value = "shouldSkipDockerTests", disabledReason = "Requires dockerd listening on a tcp socket. Not available in a typical CI environment")
@DisabledIfEnvironmentVariable(named = "SKIP_DOCKER_TESTS", matches = "true", disabledReason = "Requires dockerd listening on a tcp socket. Not available in a typical CI environment")
public class DockerAnsibleIT extends AbstractServerIT {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.walmartlabs.concord.client.StartProcessResponse;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -33,7 +34,7 @@
import static com.walmartlabs.concord.it.common.ServerClient.*;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@DisabledIf(value = "shouldSkipDockerTests", disabledReason = "Requires dockerd listening on a tcp socket. Not available in a typical CI environment")
@DisabledIfEnvironmentVariable(named = "SKIP_DOCKER_TESTS", matches = "true", disabledReason = "Requires dockerd listening on a tcp socket. Not available in a typical CI environment")
public class DockerIT extends AbstractServerIT {

@Test
Expand Down
2 changes: 1 addition & 1 deletion k8s/agent-operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG from_image=gcr.io/distroless/java:8
ARG from_image=gcr.io/distroless/java17
FROM $from_image

COPY target/operator.jar /operator.jar
Expand Down
8 changes: 7 additions & 1 deletion server/dist/src/assembly/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,18 @@ if (( $JAVA_VERSION > 8 )); then
JDK_SPECIFIC_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED"
fi

if [[ -z "${EXTRA_CLASSPATH}" ]]; then
EXTRA_CLASSPATH=""
fi

echo "EXTRA_CLASSPATH: ${EXTRA_CLASSPATH}"

exec java \
${CONCORD_JAVA_OPTS} \
${JDK_SPECIFIC_OPTS} \
-Dfile.encoding=UTF-8 \
-Djava.net.preferIPv4Stack=true \
-Djava.security.egd=file:/dev/./urandom \
-Dollie.conf=${CONCORD_CFG_FILE} \
-cp "${BASE_DIR}/lib/*:${BASE_DIR}/ext/*:${BASE_DIR}/classes" \
-cp "${BASE_DIR}/lib/*:${BASE_DIR}/ext/*:${BASE_DIR}/classes:${EXTRA_CLASSPATH}" \
"${MAIN_CLASS}"
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.name.Names;
import com.walmartlabs.concord.common.ObjectMapperProvider;
import com.walmartlabs.concord.server.boot.*;
import com.walmartlabs.concord.server.boot.filters.*;
import com.walmartlabs.concord.server.boot.servlets.FormServletHolder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* *****
* Concord
* -----
* Copyright (C) 2017 - 2023 Walmart Inc.
* Copyright (C) 2017 - 2018 Walmart Inc.
* -----
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,24 +20,27 @@
* =====
*/

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.guava.GuavaModule;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.eclipse.sisu.EagerSingleton;

import javax.inject.Provider;
import javax.inject.Inject;
import javax.inject.Named;

public class ObjectMapperProvider implements Provider<ObjectMapper> {
/**
* Until Siesta is removed, we need to make sure its ObjectMapper is configured correctly.
*/
@Named
@EagerSingleton
public class ObjectMapperInitializer {

@Override
public ObjectMapper get() {
return new ObjectMapper()
.registerModule(new GuavaModule())
.registerModule(new Jdk8Module())
.registerModule(new JavaTimeModule())
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
@Inject
public ObjectMapperInitializer(@Named("siesta") javax.inject.Provider<ObjectMapper> mapperProvider) {
ObjectMapper om = mapperProvider.get();
om.registerModule(new GuavaModule());
om.registerModule(new Jdk8Module());
om.registerModule(new JavaTimeModule());
}
}