Skip to content
Merged
8 changes: 5 additions & 3 deletions .ci/common/logstash.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
ARG ELASTIC_STACK_VERSION
FROM docker.elastic.co/logstash/logstash:$ELASTIC_STACK_VERSION
COPY --chown=logstash:logstash Gemfile /usr/share/plugins/plugin/
COPY --chown=logstash:logstash *.gemspec /usr/share/plugins/plugin/
USER logstash
COPY --chown=logstash:logstash Gemfile /usr/share/plugins/plugin/Gemfile
COPY --chown=logstash:logstash *.gemspec VERSION* version* /usr/share/plugins/plugin/
RUN cp /usr/share/logstash/logstash-core/versions-gem-copy.yml /usr/share/logstash/versions.yml
ENV PATH="${PATH}:/usr/share/logstash/vendor/jruby/bin"
# NOTE: since 7.10 JDK is bundled as part of the LS distribution under $LS_HOME/jdk
ENV PATH="${PATH}:/usr/share/logstash/vendor/jruby/bin:/usr/share/logstash/jdk/bin"
ENV LOGSTASH_SOURCE="1"
RUN gem install bundler -v '< 2'
WORKDIR /usr/share/plugins/plugin
Expand Down
48 changes: 26 additions & 22 deletions .ci/docker-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,60 @@
# - INTEGRATION: (optional) a value of "true" changes the default value of $TEST_MODE to "integration"
set -e

pull_docker_snapshot() {
project="${1?project name required}"
local docker_image="docker.elastic.co/${project}/${project}${DISTRIBUTION_SUFFIX}:${ELASTIC_STACK_VERSION}"
echo "Pulling $docker_image"
docker pull "$docker_image"
}

# TEST_MODE should be one of "unit" or "integration" (defaults to "unit" unless INTEGRATION=true)
: "${TEST_MODE:=$([[ "${INTEGRATION}" = "true" ]] && echo "integration" || echo "unit")}"
export TEST_MODE

VERSION_URL="https://raw.githubusercontent.com/elastic/logstash/master/ci/logstash_releases.json"
VERSION_URL="https://raw.githubusercontent.com/elastic/logstash/master/ci/logstash_releases.json"

if [ -z "${ELASTIC_STACK_VERSION}" ]; then
if [ -z "${ELASTIC_STACK_VERSION}" ]; then
echo "Please set the ELASTIC_STACK_VERSION environment variable"
echo "For example: export ELASTIC_STACK_VERSION=6.2.4"
echo "For example: export ELASTIC_STACK_VERSION=7.x"
exit 1
fi

echo "Fetching versions from $VERSION_URL"
echo "Fetching versions from $VERSION_URL"
VERSIONS=$(curl $VERSION_URL)

if [[ "$SNAPSHOT" = "true" ]]; then
if [[ "$SNAPSHOT" = "true" ]]; then
ELASTIC_STACK_RETRIEVED_VERSION=$(echo $VERSIONS | jq '.snapshots."'"$ELASTIC_STACK_VERSION"'"')
echo $ELASTIC_STACK_RETRIEVED_VERSION
else
ELASTIC_STACK_RETRIEVED_VERSION=$(echo $VERSIONS | jq '.releases."'"$ELASTIC_STACK_VERSION"'"')
fi

if [[ "$ELASTIC_STACK_RETRIEVED_VERSION" != "null" ]]; then
if [[ "$ELASTIC_STACK_RETRIEVED_VERSION" != "null" ]]; then
# remove starting and trailing double quotes
ELASTIC_STACK_RETRIEVED_VERSION="${ELASTIC_STACK_RETRIEVED_VERSION%\"}"
ELASTIC_STACK_RETRIEVED_VERSION="${ELASTIC_STACK_RETRIEVED_VERSION#\"}"
echo "Translated $ELASTIC_STACK_VERSION to ${ELASTIC_STACK_RETRIEVED_VERSION}"
export ELASTIC_STACK_VERSION=$ELASTIC_STACK_RETRIEVED_VERSION
fi

echo "Testing against version: $ELASTIC_STACK_VERSION"

if [[ "$ELASTIC_STACK_VERSION" = *"-SNAPSHOT" ]]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not a such a deep knowledge of docker, but docker pull is the same as this curl + docker load ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker pull pull the image from the registry while docker load import image from STDIN .tar.gz

cd /tmp

jq=".build.projects.logstash.packages.\"logstash-$ELASTIC_STACK_VERSION-docker-image.tar.gz\".url"
result=$(curl --silent https://artifacts-api.elastic.co/v1/versions/$ELASTIC_STACK_VERSION/builds/latest | jq -r $jq)
echo $result
curl $result > logstash-docker-image.tar.gz
tar xfvz logstash-docker-image.tar.gz repositories
echo "Loading docker image: "
cat repositories
docker load < logstash-docker-image.tar.gz
rm logstash-docker-image.tar.gz
cd -
case "${DISTRIBUTION}" in
default) DISTRIBUTION_SUFFIX="" ;; # empty string when explicit "default" is given
*) DISTRIBUTION_SUFFIX="${DISTRIBUTION/*/-}${DISTRIBUTION}" ;;
esac
export DISTRIBUTION_SUFFIX

echo "Testing against version: $ELASTIC_STACK_VERSION (distribution: ${DISTRIBUTION:-"default"})"

if [[ "$ELASTIC_STACK_VERSION" = *"-SNAPSHOT" ]]; then
pull_docker_snapshot "logstash"
fi

if [ -f Gemfile.lock ]; then
if [ -f Gemfile.lock ]; then
rm Gemfile.lock
fi

CURRENT_DIR=$(dirname "${BASH_SOURCE[0]}")

docker-compose --file ".ci/common/docker-compose.yml" --file ".ci/${TEST_MODE}/docker-compose.override.yml" down
docker-compose --file ".ci/common/docker-compose.yml" --file ".ci/${TEST_MODE}/docker-compose.override.yml" --verbose build
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 7.2.0
- Remove ruby pipeline dependency. Starting from Logstash 8, Ruby execution engine is not available. All pipelines should use Java pipeline [#39](https://github.com/logstash-plugins/logstash-integration-rabbitmq/pull/39)

## 7.1.1
- DOC:Replaced plugin_header file with plugin_header-integration file. ([#34](https://github.com/logstash-plugins/logstash-integration-rabbitmq/issues/34))

Expand Down
1 change: 1 addition & 0 deletions lib/logstash/plugin_mixins/rabbitmq_connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require "logstash/namespace"
require "march_hare"
require "java"
require "stud/interval"

# Common functionality for the rabbitmq input/output
module LogStash
Expand Down
2 changes: 1 addition & 1 deletion logstash-integration-rabbitmq.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'logstash-integration-rabbitmq'
s.version = '7.1.1'
s.version = '7.2.0'
s.licenses = ['Apache License (2.0)']
s.summary = "Integration with RabbitMQ - input and output plugins"
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline "+
Expand Down
1 change: 0 additions & 1 deletion spec/outputs/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# encoding: UTF-8
require "logstash/devutils/rspec/spec_helper"
require "logstash/pipeline"
require "logstash/outputs/rabbitmq"

describe LogStash::Outputs::RabbitMQ do
Expand Down