Skip to content

Commit ba8e442

Browse files
authored
update redis client dependency to ~> 4 (logstash-plugins#77)
* update redis client dependency to ~> 4 * move testing to docker
1 parent 0121609 commit ba8e442

File tree

10 files changed

+121
-68
lines changed

10 files changed

+121
-68
lines changed

.travis.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
---
2-
language: ruby
3-
cache: bundler
4-
services:
5-
- redis-server
6-
sudo: false
2+
sudo: required
3+
services: docker
4+
addons:
5+
apt:
6+
packages:
7+
- docker-ce
78
matrix:
89
include:
9-
- rvm: jruby-9.1.13.0
10-
env: LOGSTASH_BRANCH=master
11-
- rvm: jruby-9.1.13.0
12-
env: LOGSTASH_BRANCH=7.0
13-
- rvm: jruby-9.1.13.0
14-
env: LOGSTASH_BRANCH=6.7
15-
- rvm: jruby-9.1.13.0
16-
env: LOGSTASH_BRANCH=6.6
17-
- rvm: jruby-1.7.27
18-
env: LOGSTASH_BRANCH=5.6
10+
- env: ELASTIC_STACK_VERSION=7.x
11+
- env: ELASTIC_STACK_VERSION=6.x
12+
- env: SNAPSHOT=true ELASTIC_STACK_VERSION=7.x
13+
- env: SNAPSHOT=true ELASTIC_STACK_VERSION=8.x
1914
fast_finish: true
20-
install: true
21-
script: ci/build.sh
22-
jdk: openjdk8
23-
before_install: gem install bundler -v '< 2'
15+
install: ci/unit/docker-setup.sh
16+
script: ci/unit/docker-run.sh

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 3.5.0
2+
- Updated redis client dependency to ~> 4
3+
14
## 3.4.1
25
- Changed `redis_type` to `data_type` in .rb file [#70](https://github.com/logstash-plugins/logstash-input-redis/issues/70) and asciidoc file [#71](https://github.com/logstash-plugins/logstash-input-redis/issues/71)
36

ci/build.sh

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

ci/setup.sh

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

ci/unit/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ARG ELASTIC_STACK_VERSION
2+
FROM docker.elastic.co/logstash/logstash:$ELASTIC_STACK_VERSION
3+
COPY --chown=logstash:logstash Gemfile /usr/share/plugins/this/Gemfile
4+
COPY --chown=logstash:logstash *.gemspec /usr/share/plugins/this/
5+
RUN cp /usr/share/logstash/logstash-core/versions-gem-copy.yml /usr/share/logstash/versions.yml
6+
ENV PATH="${PATH}:/usr/share/logstash/vendor/jruby/bin"
7+
ENV LOGSTASH_SOURCE=1
8+
ENV JARS_SKIP="true"
9+
RUN gem install bundler -v '< 2'
10+
WORKDIR /usr/share/plugins/this
11+
RUN bundle install
12+
COPY --chown=logstash:logstash . /usr/share/plugins/this

ci/unit/docker-compose.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: '3'
2+
3+
# run tests: cd ci/unit; docker-compose up --build --force-recreate
4+
# manual: cd ci/unit; docker-compose run logstash bash
5+
services:
6+
7+
logstash:
8+
build:
9+
context: ../../
10+
dockerfile: ci/unit/Dockerfile
11+
args:
12+
- ELASTIC_STACK_VERSION=$ELASTIC_STACK_VERSION
13+
command: /usr/share/plugins/this/ci/unit/run.sh
14+
environment:
15+
LS_JAVA_OPTS: "-Xmx256m -Xms256m"
16+
LOGSTASH_SOURCE: 1
17+
JARS_SKIP: "true"
18+
OSS: "true"
19+
tty: true
20+
#volumes:
21+
# - ./:/usr/share/plugins/this

ci/unit/docker-run.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
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+
docker-compose -f ci/unit/docker-compose.yml up --exit-code-from logstash

ci/unit/docker-setup.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
# This is intended to be run the plugin's root directory. `ci/unit/docker-test.sh`
4+
# Ensure you have Docker installed locally and set the ELASTIC_STACK_VERSION environment variable.
5+
set -e
6+
7+
VERSION_URL="https://raw.githubusercontent.com/elastic/logstash/master/ci/logstash_releases.json"
8+
9+
if [ "$ELASTIC_STACK_VERSION" ]; then
10+
echo "Fetching versions from $VERSION_URL"
11+
VERSIONS=$(curl $VERSION_URL)
12+
if [[ "$SNAPSHOT" = "true" ]]; then
13+
ELASTIC_STACK_RETRIEVED_VERSION=$(echo $VERSIONS | jq '.snapshots."'"$ELASTIC_STACK_VERSION"'"')
14+
echo $ELASTIC_STACK_RETRIEVED_VERSION
15+
else
16+
ELASTIC_STACK_RETRIEVED_VERSION=$(echo $VERSIONS | jq '.releases."'"$ELASTIC_STACK_VERSION"'"')
17+
fi
18+
if [[ "$ELASTIC_STACK_RETRIEVED_VERSION" != "null" ]]; then
19+
# remove starting and trailing double quotes
20+
ELASTIC_STACK_RETRIEVED_VERSION="${ELASTIC_STACK_RETRIEVED_VERSION%\"}"
21+
ELASTIC_STACK_RETRIEVED_VERSION="${ELASTIC_STACK_RETRIEVED_VERSION#\"}"
22+
echo "Translated $ELASTIC_STACK_VERSION to ${ELASTIC_STACK_RETRIEVED_VERSION}"
23+
export ELASTIC_STACK_VERSION=$ELASTIC_STACK_RETRIEVED_VERSION
24+
fi
25+
26+
echo "Testing against version: $ELASTIC_STACK_VERSION"
27+
28+
if [[ "$ELASTIC_STACK_VERSION" = *"-SNAPSHOT" ]]; then
29+
cd /tmp
30+
31+
if [[ $ELASTIC_STACK_VERSION == 8* ]]; then
32+
jq=".build.projects.logstash.packages.\"logstash-$ELASTIC_STACK_VERSION-docker-image.tar.gz\".url"
33+
else
34+
jq=".build.projects.\"logstash\".packages.\"logstash-$ELASTIC_STACK_VERSION-docker-image.tar.gz\".url"
35+
fi
36+
echo "curl --silent https://artifacts-api.elastic.co/v1/versions/$ELASTIC_STACK_VERSION/builds/latest | jq -r $jq)"
37+
result=$(curl --silent https://artifacts-api.elastic.co/v1/versions/$ELASTIC_STACK_VERSION/builds/latest | jq -r $jq)
38+
echo $result
39+
curl $result > logstash-docker-image.tar.gz
40+
tar xfvz logstash-docker-image.tar.gz repositories
41+
echo "Loading docker image: "
42+
cat repositories
43+
docker load < logstash-docker-image.tar.gz
44+
rm logstash-docker-image.tar.gz
45+
cd -
46+
fi
47+
48+
if [ -f Gemfile.lock ]; then
49+
rm Gemfile.lock
50+
fi
51+
52+
docker-compose -f ci/unit/docker-compose.yml down
53+
docker-compose -f ci/unit/docker-compose.yml build
54+
#docker-compose -f ci/unit/docker-compose.yml up --exit-code-from logstash --force-recreate
55+
else
56+
echo "Please set the ELASTIC_STACK_VERSION environment variable"
57+
echo "For example: export ELASTIC_STACK_VERSION=6.2.4"
58+
exit 1
59+
fi
60+

ci/unit/run.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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+
bundle exec rspec -fd --pattern spec/**/*_spec.rb,spec/**/*_specs.rb

logstash-input-redis.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Gem::Specification.new do |s|
22

33
s.name = 'logstash-input-redis'
4-
s.version = '3.4.1'
4+
s.version = '3.5.0'
55
s.licenses = ['Apache License (2.0)']
66
s.summary = "Reads events from a Redis instance"
77
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
2323
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
2424

2525
s.add_runtime_dependency 'logstash-codec-json'
26-
s.add_runtime_dependency 'redis', '~> 3'
26+
s.add_runtime_dependency 'redis', '~> 4'
2727

2828
s.add_development_dependency 'logstash-devutils'
2929
end

0 commit comments

Comments
 (0)