Skip to content

Commit cb6e9e6

Browse files
Merge pull request #14 from naveentatikonda/main_rebase_develop_branch
rebase main branch with develop branch
2 parents c56ef92 + fac5d23 commit cb6e9e6

22 files changed

+296
-210
lines changed

.ci/Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
ARG LOGSTASH_VERSION
2+
FROM docker.elastic.co/logstash/logstash-oss:${LOGSTASH_VERSION}
3+
# install and enable password-less sudo for logstash user
4+
# allows modifying the system inside the container (using the .ci/setup.sh hook)
5+
# USER root
6+
# RUN if [ $(command -v apt-get) ]; then \
7+
# apt-get install -y sudo && \
8+
# gpasswd -a logstash sudo; \
9+
# else \
10+
# yum install -y sudo && \
11+
# usermod -aG wheel logstash; \
12+
# fi
13+
# RUN echo "logstash ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/logstash && \
14+
# chmod 0440 /etc/sudoers.d/logstash
15+
USER logstash
16+
# whole . plugin code could be copied here but we only do that after bundle install,
17+
# to speedup incremental builds (locally one's mostly changing lib/ and spec/ files)
18+
COPY --chown=logstash:logstash Gemfile /usr/share/plugins/plugin/Gemfile
19+
COPY --chown=logstash:logstash *.gemspec VERSION* version* /usr/share/plugins/plugin/
20+
#COPY --chown=logstash:logstash Gemfile *.gemspec VERSION* version* /usr/share/plugins/plugin/
21+
RUN cp /usr/share/logstash/logstash-core/versions-gem-copy.yml /usr/share/logstash/versions.yml
22+
# NOTE: since 8.0 JDK is bundled as part of the LS distribution under $LS_HOME/jdk
23+
ENV PATH="${PATH}:/usr/share/logstash/vendor/jruby/bin:/usr/share/logstash/jdk/bin"
24+
ENV LOGSTASH_SOURCE="1"
25+
ARG INTEGRATION
26+
ENV INTEGRATION=$INTEGRATION
27+
RUN gem install bundler -v '< 2'
28+
WORKDIR /usr/share/plugins/plugin
29+
# COPY --chown=logstash:logstash .ci/* /usr/share/plugins/plugin/.ci/
30+
# RUN .ci/setup.sh
31+
RUN bundle install --with test ci
32+
COPY --chown=logstash:logstash . /usr/share/plugins/plugin/
33+
RUN bundle exec rake vendor

.ci/Dockerfile.elasticsearch

Lines changed: 0 additions & 20 deletions
This file was deleted.

.ci/docker-run.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

.ci/docker-setup.sh

Lines changed: 0 additions & 89 deletions
This file was deleted.

.ci/docker.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#LS_JAVA_OPTS="-Xms256m -Xmx256m -XX:MaxMetaspaceSize=256m"
2+
# Common LS options (can be overridden from ENV e.g. in .travis.yml) :
3+
# - `-Xregexp.interruptible=true -Xcompile.invokedynamic=true -Xjit.threshold=0` LS base-line
4+
# - `-XX:+UseParallelGC` do not use G1 (default) on Java 11
5+
# - `-v -W1` print JRuby version but do not go verbose
6+
JRUBY_OPTS=-Xregexp.interruptible=true -Xcompile.invokedynamic=true -Xjit.threshold=0 -J-XX:+UseParallelGC -J-XX:+PrintCommandLineFlags -v -W1

.ci/logstash-run.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,18 @@ set -ex
44
export PATH=$BUILD_DIR/gradle/bin:$PATH
55

66
wait_for_es() {
7-
echo "Waiting for elasticsearch to respond..."
8-
es_url="http://elasticsearch:9200"
7+
8+
SERVICE_URL="http://integration:9200"
99
if [[ "$SECURE_INTEGRATION" == "true" ]]; then
10-
es_url="https://elasticsearch:9200 -k"
10+
SERVICE_URL="https://integration:9200 -k -u admin:admin"
1111
fi
12-
count=120
13-
while ! curl --silent $es_url && [[ $count -ne 0 ]]; do
12+
count=10
13+
while ! curl -s $SERVICE_URL >/dev/null && [[ $count -ne 0 ]]; do
1414
count=$(( $count - 1 ))
1515
[[ $count -eq 0 ]] && return 1
16-
sleep 1
16+
sleep 20
1717
done
18-
echo "Elasticsearch is Up !"
19-
20-
return 0
18+
echo $(curl -s $SERVICE_URL | python -c "import sys, json; print(json.load(sys.stdin)['version']['number'])")
2119
}
2220

2321
if [[ "$INTEGRATION" != "true" ]]; then
@@ -28,6 +26,9 @@ else
2826
else
2927
extra_tag_args="--tag ~secure_integration --tag integration"
3028
fi
31-
wait_for_es
32-
bundle exec rspec -fd $extra_tag_args --tag es_version:$ELASTIC_STACK_VERSION spec/inputs/integration
29+
30+
echo "Waiting for cluster to respond..."
31+
VERSION=$(wait_for_es)
32+
echo "Cluster $VERSION is Up!"
33+
bundle exec rspec -fd $extra_tag_args --tag es_version:$VERSION spec/inputs/integration
3334
fi

.ci/opendistro/Dockerfile.opendistro

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ARG OPENDISTRO_VERSION
2+
FROM amazon/opendistro-for-elasticsearch:${OPENDISTRO_VERSION}
3+
4+
ARG es_path=/usr/share/elasticsearch
5+
6+
ARG SECURE_INTEGRATION
7+
RUN if [ "$SECURE_INTEGRATION" != "true" ] ; then $es_path/bin/elasticsearch-plugin remove opendistro_security; fi

.ci/docker-compose.override.yml renamed to .ci/opendistro/docker-compose.override.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,18 @@ services:
77
environment:
88
- INTEGRATION=${INTEGRATION:-false}
99
- SECURE_INTEGRATION=${SECURE_INTEGRATION:-false}
10-
- ELASTIC_STACK_VERSION=$ELASTIC_STACK_VERSION
11-
elasticsearch:
10+
11+
integration:
1212
build:
13-
context: ../
14-
dockerfile: .ci/Dockerfile.elasticsearch
13+
context: ../../
14+
dockerfile: .ci/opendistro/Dockerfile.opendistro
1515
args:
16-
- ELASTIC_STACK_VERSION=$ELASTIC_STACK_VERSION
16+
- OPENDISTRO_VERSION=${OPENDISTRO_VERSION:-latest}
1717
- INTEGRATION=${INTEGRATION:-false}
1818
- SECURE_INTEGRATION=${SECURE_INTEGRATION:-false}
1919
environment:
20-
#- ELASTIC_PASSWORD=$ELASTIC_PASSWORD a user is setup manually
21-
- xpack.security.enabled=${SECURE_INTEGRATION:-false}
2220
- bootstrap.memory_lock=true
2321
- discovery.type=single-node
24-
- ES_JAVA_OPTS=-Xms640m -Xmx640m
2522
tty: true
2623
ulimits:
2724
memlock:

.ci/opendistro/docker-compose.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: '3'
2+
3+
services:
4+
5+
logstash:
6+
build:
7+
context: ../../
8+
dockerfile: .ci/Dockerfile
9+
args:
10+
- LOGSTASH_VERSION=${LOGSTASH_VERSION:-7.13.2}
11+
command: .ci/run.sh
12+
env_file: ../docker.env
13+
environment:
14+
- SPEC_OPTS
15+
- LOG_LEVEL # devutils (>= 2.0.4) reads the ENV and sets LS logging
16+
tty: true

.ci/opendistro/docker-run.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
# This is intended to be run inside the docker container as the command of the docker-compose.
4+
set -ex
5+
6+
cd .ci/opendistro
7+
8+
docker-compose up --exit-code-from logstash

0 commit comments

Comments
 (0)