Skip to content

Commit 14943d9

Browse files
committed
update to centralized travis configuration
1 parent 7ba6acc commit 14943d9

10 files changed

+91
-104
lines changed

.ci/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
ARG ELASTIC_STACK_VERSION
2+
# TODO: refactor this to be implicitly resolved by logstash-plugins/.ci/Dockerfile
3+
ARG DISTRIBUTION_SUFFIX
4+
FROM docker.elastic.co/logstash/logstash$DISTRIBUTION_SUFFIX:$ELASTIC_STACK_VERSION
5+
USER logstash
6+
COPY --chown=logstash:logstash Gemfile /usr/share/plugins/plugin/Gemfile
7+
COPY --chown=logstash:logstash *.gemspec VERSION* version* /usr/share/plugins/plugin/
8+
RUN cp /usr/share/logstash/logstash-core/versions-gem-copy.yml /usr/share/logstash/versions.yml
9+
ENV PATH="${PATH}:/usr/share/logstash/vendor/jruby/bin"
10+
ENV LOGSTASH_SOURCE="1"
11+
ENV ELASTIC_STACK_VERSION=$ELASTIC_STACK_VERSION
12+
# DISTRIBUTION="default" (by default) or "oss"
13+
ARG DISTRIBUTION
14+
ENV DISTRIBUTION=$DISTRIBUTION
15+
# INTEGRATION="true" while integration testing (false-y by default)
16+
ARG INTEGRATION
17+
ENV INTEGRATION=$INTEGRATION
18+
RUN gem install bundler -v '< 2'
19+
WORKDIR /usr/share/plugins/plugin
20+
RUN bundle install --with test ci
21+
COPY --chown=logstash:logstash . /usr/share/plugins/plugin
22+
RUN bundle exec rake vendor
23+
RUN .ci/setup.sh
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
ARG elastic_stack_version
2-
ARG distribution_suffix
3-
FROM docker.elastic.co/elasticsearch/elasticsearch$distribution_suffix:$elastic_stack_version
1+
ARG ELASTIC_STACK_VERSION
2+
ARG DISTRIBUTION_SUFFIX
3+
FROM docker.elastic.co/elasticsearch/elasticsearch$distribution_suffix:$ELASTIC_STACK_VERSION
44

5-
ARG plugin_path=/usr/share/plugins/this
5+
ARG plugin_path=/usr/share/plugins/plugin
66
ARG es_path=/usr/share/elasticsearch
77
ARG es_yml=$es_path/config/elasticsearch.yml
8-
ARG secure_integration
8+
ARG SECURE_INTEGRATION
99

1010
RUN rm -f $es_path/config/scripts
1111

1212
COPY --chown=elasticsearch:elasticsearch spec/fixtures/scripts/groovy/* $es_path/config/scripts/
1313
COPY --chown=elasticsearch:elasticsearch spec/fixtures/test_certs/* $es_path/config/test_certs/
14-
COPY --chown=elasticsearch:elasticsearch ci/elasticsearch-run.sh $es_path/
14+
COPY --chown=elasticsearch:elasticsearch .ci/elasticsearch-run.sh $es_path/
1515

16-
RUN if [ "$secure_integration" = "true" ] ; then echo "xpack.security.http.ssl.enabled: $secure_integration" >> $es_yml; fi
17-
RUN if [ "$secure_integration" = "true" ] ; then echo "xpack.security.http.ssl.key: $es_path/config/test_certs/test.key" >> $es_yml; fi
18-
RUN if [ "$secure_integration" = "true" ] ; then echo "xpack.security.http.ssl.certificate: $es_path/config/test_certs/test.crt" >> $es_yml; fi
19-
RUN if [ "$secure_integration" = "true" ] ; then echo "xpack.security.http.ssl.certificate_authorities: [ '$es_path/config/test_certs/ca.crt' ]" >> $es_yml; fi
20-
RUN if [ "$secure_integration" = "true" ] ; then $es_path/bin/elasticsearch-users useradd simpleuser -p abc123 -r superuser; fi
21-
RUN if [ "$secure_integration" = "true" ] ; then $es_path/bin/elasticsearch-users useradd 'f@ncyuser' -p 'ab%12#' -r superuser; fi
16+
RUN if [ "$SECURE_INTEGRATION" = "true" ] ; then echo "xpack.security.http.ssl.enabled: $SECURE_INTEGRATION" >> $es_yml; fi
17+
RUN if [ "$SECURE_INTEGRATION" = "true" ] ; then echo "xpack.security.http.ssl.key: $es_path/config/test_certs/test.key" >> $es_yml; fi
18+
RUN if [ "$SECURE_INTEGRATION" = "true" ] ; then echo "xpack.security.http.ssl.certificate: $es_path/config/test_certs/test.crt" >> $es_yml; fi
19+
RUN if [ "$SECURE_INTEGRATION" = "true" ] ; then echo "xpack.security.http.ssl.certificate_authorities: [ '$es_path/config/test_certs/ca.crt' ]" >> $es_yml; fi
20+
RUN if [ "$SECURE_INTEGRATION" = "true" ] ; then $es_path/bin/elasticsearch-users useradd simpleuser -p abc123 -r superuser; fi
21+
RUN if [ "$SECURE_INTEGRATION" = "true" ] ; then $es_path/bin/elasticsearch-users useradd 'f@ncyuser' -p 'ab%12#' -r superuser; fi

.ci/docker-compose.override.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: '3'
2+
3+
services:
4+
5+
logstash:
6+
command: /usr/share/plugins/plugin/.ci/logstash-run.sh
7+
build:
8+
args:
9+
- ELASTIC_STACK_VERSION=$ELASTIC_STACK_VERSION
10+
- DISTRIBUTION=${DISTRIBUTION:-default}
11+
- DISTRIBUTION_SUFFIX=${DISTRIBUTION_SUFFIX}
12+
environment:
13+
- ELASTIC_STACK_VERSION=$ELASTIC_STACK_VERSION
14+
- DISTRIBUTION=${DISTRIBUTION:-default}
15+
- DISTRIBUTION_SUFFIX=${DISTRIBUTION_SUFFIX}
16+
- INTEGRATION=${INTEGRATION:-false}
17+
- SECURE_INTEGRATION=${SECURE_INTEGRATION:-false}
18+
19+
elasticsearch:
20+
build:
21+
context: ../
22+
dockerfile: .ci/Dockerfile.elasticsearch
23+
args:
24+
- ELASTIC_STACK_VERSION=$ELASTIC_STACK_VERSION
25+
- INTEGRATION=${INTEGRATION:-false}
26+
- SECURE_INTEGRATION=${SECURE_INTEGRATION:-false}
27+
command: /usr/share/elasticsearch/elasticsearch-run.sh
28+
tty: true
29+
ports:
30+
- "9200:9200"
31+
user: elasticsearch
32+

ci/docker-run.sh renamed to .ci/docker-run.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
# This is intended to be run inside the docker container as the command of the docker-compose.
44
set -ex
5+
6+
cd .ci
7+
58
if [ "$INTEGRATION" == "true" ]; then
6-
docker-compose -f ci/docker-compose.yml up --exit-code-from logstash
9+
docker-compose up --exit-code-from logstash
710
else
8-
docker-compose -f ci/docker-compose.yml up --exit-code-from logstash logstash
11+
docker-compose up --exit-code-from logstash logstash
912
fi

ci/docker-setup.sh renamed to .ci/docker-setup.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# This is intended to be run the plugin's root directory. `ci/docker-test.sh`
3+
# This is intended to be run the plugin's root directory. `.ci/docker-setup.sh`
44
# Ensure you have Docker installed locally and set the ELASTIC_STACK_VERSION environment variable.
55
set -e
66

@@ -67,12 +67,14 @@ if [ "$ELASTIC_STACK_VERSION" ]; then
6767
rm Gemfile.lock
6868
fi
6969

70+
cd .ci
71+
7072
if [ "$INTEGRATION" == "true" ]; then
71-
docker-compose -f ci/docker-compose.yml down
72-
docker-compose -f ci/docker-compose.yml build
73+
docker-compose down
74+
docker-compose build
7375
else
74-
docker-compose -f ci/docker-compose.yml down
75-
docker-compose -f ci/docker-compose.yml build logstash
76+
docker-compose down
77+
docker-compose build logstash
7678
fi
7779
else
7880
echo "Please set the ELASTIC_STACK_VERSION environment variable"
File renamed without changes.
File renamed without changes.

.travis.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
1-
---
2-
sudo: required
3-
services: docker
4-
addons:
5-
apt:
6-
packages:
7-
- docker-ce
1+
import:
2+
- logstash-plugins/.ci:travis/[email protected]
3+
84
env:
9-
- INTEGRATION=false ELASTIC_STACK_VERSION=5.x
10-
- INTEGRATION=false ELASTIC_STACK_VERSION=6.x
11-
- INTEGRATION=false ELASTIC_STACK_VERSION=7.x
12-
- DISTRIBUTION=default INTEGRATION=true ELASTIC_STACK_VERSION=6.x
13-
- DISTRIBUTION=default INTEGRATION=true ELASTIC_STACK_VERSION=7.x
14-
- DISTRIBUTION=default INTEGRATION=true ELASTIC_STACK_VERSION=7.x SNAPSHOT=true
15-
- DISTRIBUTION=default INTEGRATION=true ELASTIC_STACK_VERSION=8.x SNAPSHOT=true
16-
- DISTRIBUTION=default SECURE_INTEGRATION=true INTEGRATION=true ELASTIC_STACK_VERSION=7.x
17-
- DISTRIBUTION=oss INTEGRATION=true ELASTIC_STACK_VERSION=7.x
18-
install: ci/docker-setup.sh
19-
script: ci/docker-run.sh
5+
#- INTEGRATION=false ELASTIC_STACK_VERSION=5.x
6+
#- INTEGRATION=false ELASTIC_STACK_VERSION=6.x
7+
- INTEGRATION=false ELASTIC_STACK_VERSION=7.x
8+
#- DISTRIBUTION=default INTEGRATION=true ELASTIC_STACK_VERSION=6.x
9+
- DISTRIBUTION=default INTEGRATION=true ELASTIC_STACK_VERSION=7.x
10+
#- DISTRIBUTION=default INTEGRATION=true ELASTIC_STACK_VERSION=7.x SNAPSHOT=true
11+
#- DISTRIBUTION=default INTEGRATION=true ELASTIC_STACK_VERSION=8.x SNAPSHOT=true
12+
- DISTRIBUTION=default SECURE_INTEGRATION=true INTEGRATION=true ELASTIC_STACK_VERSION=7.x
13+
- DISTRIBUTION=oss INTEGRATION=true ELASTIC_STACK_VERSION=7.x

ci/Dockerfile.logstash

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

ci/docker-compose.yml

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

0 commit comments

Comments
 (0)