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

Fix Java CI Check by using Amazon Linux 2 instead of Centos7 which is EOL #580

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
working-directory: ./tmp/performance-analyzer
run: ./gradlew updateShas
- name: Set docker-compose path
run: echo "DOCKER_COMPOSE_LOCATION=$(which docker-compose)" >> $GITHUB_ENV
run: echo "DOCKER_LOCATION=$(which docker)" >> $GITHUB_ENV
# Set the vm.max_map_count system property to the minimum required to run OpenSearch
- name: Set vm.max_map_count
run: sudo sysctl -w vm.max_map_count=262144
Expand Down
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -495,18 +495,18 @@ task runDocker(type: Exec) {
workingDir(dockerArtifactsDir)

// This block is included to make the runDocker task work with Github Actions
// It sets the path to the docker-compose program from an environment variable
// The DOCKER_COMPOSE_LOCATION environment variable is set in the gradle.yml file inside the
// It sets the path to the docker compose program from an environment variable
// The DOCKER_LOCATION environment variable is set in the gradle.yml file inside the
// performance-analyzer repository.
def docker_compose_location = "docker-compose"
if (System.getenv("DOCKER_COMPOSE_LOCATION") != null) {
docker_compose_location = System.getenv("DOCKER_COMPOSE_LOCATION")
def docker_location = "docker"
if (System.getenv("DOCKER_LOCATION") != null) {
docker_location = System.getenv("DOCKER_LOCATION")
}

environment 'DATA_VOLUME1', 'opensearchdata1'
environment 'DATA_VOLUME2', 'opensearchdata2'

commandLine(docker_compose_location,
commandLine(docker_location, 'compose',
'-f', 'docker-compose.yml',
'-f', 'docker-compose.hostports.yml',
'-f', 'docker-compose.cluster.yml',
Expand Down Expand Up @@ -556,11 +556,11 @@ def runInProcess(commandArr) {
def runDockerCompose = { executionPath ->
// This block is included to make the runDocker task work with Github Actions
// It sets the path to the docker-compose program from an environment variable
// The DOCKER_COMPOSE_LOCATION environment variable is set in the gradle.yml file inside the
// The DOCKER_LOCATION environment variable is set in the gradle.yml file inside the
// performance-analyzer repository.
String dockerCompose = System.getenv("DOCKER_COMPOSE_LOCATION") == null ?
"docker-compose" : System.getenv("DOCKER_COMPOSE_LOCATION")
String[] commandArray = [dockerCompose,
String dockerCompose = System.getenv("DOCKER_LOCATION") == null ?
"docker" : System.getenv("DOCKER_LOCATION")
String[] commandArray = [dockerCompose, 'compose',
'-f', 'docker-compose.yml',
'-f', 'docker-compose.hostports.yml',
'-f', 'docker-compose.cluster.yml',
Expand Down
36 changes: 17 additions & 19 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
# Set gid=0 and make group perms==owner perms
################################################################################

FROM centos:7 AS prep_open_search_files
FROM public.ecr.aws/amazonlinux/amazonlinux:2 AS prep_open_search_files
ARG JDK_VER=11

ENV PATH /usr/share/opensearch/bin:$PATH

RUN yum install -y tar gzip shadow-utils

RUN if [[ "${JDK_VER}" = "17" ]] ; then \
curl -s https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz | tar -C /opt -zxf -; \
mkdir /opt/jdk ; \
Expand Down Expand Up @@ -75,27 +77,23 @@ fi
# Add entrypoint
################################################################################

FROM centos:7
FROM public.ecr.aws/amazonlinux/amazonlinux:2

ENV OPENSEARCH_CONTAINER true

RUN \
rpm --rebuilddb && yum clean all && \
yum install -y epel-release && \
yum update -y && \
yum install -y \
iproute \
python-setuptools \
hostname \
inotify-tools \
yum-utils \
which \
jq \
lsof \
python-pip \
rsync && \
yum clean all && \
pip install supervisor
RUN amazon-linux-extras install epel
RUN yum install -y supervisor
RUN yum install -y iproute \
python3-setuptools \
hostname \
inotify-tools \
yum-utils \
which \
jq \
lsof \
python3-pip \
rsync && \
yum clean all

RUN yum update -y && \
yum install -y nc unzip wget which && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Util {
private static final Logger LOG = LogManager.getLogger(Util.class);

public static final String PA_BASE_URL = "/_plugins/_performanceanalyzer";
public static final String LEGACY_OPENDISTRO_PA_BASE_URL = PA_BASE_URL;
public static final String LEGACY_OPENDISTRO_PA_BASE_URL = "/_opendistro/_performanceanalyzer";

public static final String METRICS_QUERY_URL = PA_BASE_URL + "/metrics";
public static final String LEGACY_OPENDISTRO_METRICS_QUERY_URL =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,14 +527,36 @@ public RCAScheduler getRcaScheduler() {
}

private void addRcaRequestHandler() {
httpServer.createContext(Util.RCA_QUERY_URL, queryRcaRequestHandler);
httpServer.createContext(Util.LEGACY_OPENDISTRO_RCA_QUERY_URL, queryRcaRequestHandler);
try {
httpServer.createContext(Util.RCA_QUERY_URL, queryRcaRequestHandler);
} catch (IllegalArgumentException e) {
LOG.error("unable to create context in http server for URL: " + Util.RCA_QUERY_URL);
}

try {
httpServer.createContext(Util.LEGACY_OPENDISTRO_RCA_QUERY_URL, queryRcaRequestHandler);
} catch (IllegalArgumentException e) {
LOG.error(
"unable to create context in http server for URL: "
+ Util.LEGACY_OPENDISTRO_RCA_QUERY_URL);
}
}

private void addActionsRequestHandler() {
httpServer.createContext(Util.ACTIONS_QUERY_URL, queryActionRequestHandler);
httpServer.createContext(
Util.LEGACY_OPENDISTRO_ACTIONS_QUERY_URL, queryActionRequestHandler);
try {
httpServer.createContext(Util.ACTIONS_QUERY_URL, queryActionRequestHandler);
} catch (IllegalArgumentException e) {
LOG.error("unable to create context in http server for URL: " + Util.ACTIONS_QUERY_URL);
}

try {
httpServer.createContext(
Util.LEGACY_OPENDISTRO_ACTIONS_QUERY_URL, queryActionRequestHandler);
} catch (IllegalArgumentException e) {
LOG.error(
"unable to create context in http server for URL: "
+ Util.LEGACY_OPENDISTRO_ACTIONS_QUERY_URL);
}
}

public void setDeliberateInterrupt() {
Expand Down
Loading