diff --git a/.ci/common/logstash.Dockerfile b/.ci/common/logstash.Dockerfile index 799016c..260ece6 100644 --- a/.ci/common/logstash.Dockerfile +++ b/.ci/common/logstash.Dockerfile @@ -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 diff --git a/.ci/docker-setup.sh b/.ci/docker-setup.sh index c39563a..20dda41 100755 --- a/.ci/docker-setup.sh +++ b/.ci/docker-setup.sh @@ -8,29 +8,36 @@ # - 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#\"}" @@ -38,26 +45,23 @@ fi export ELASTIC_STACK_VERSION=$ELASTIC_STACK_RETRIEVED_VERSION fi - echo "Testing against version: $ELASTIC_STACK_VERSION" - - if [[ "$ELASTIC_STACK_VERSION" = *"-SNAPSHOT" ]]; then - 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index e86668f..ce65e94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/lib/logstash/plugin_mixins/rabbitmq_connection.rb b/lib/logstash/plugin_mixins/rabbitmq_connection.rb index af9199e..789dd4b 100644 --- a/lib/logstash/plugin_mixins/rabbitmq_connection.rb +++ b/lib/logstash/plugin_mixins/rabbitmq_connection.rb @@ -2,6 +2,7 @@ require "logstash/namespace" require "march_hare" require "java" +require "stud/interval" # Common functionality for the rabbitmq input/output module LogStash diff --git a/logstash-integration-rabbitmq.gemspec b/logstash-integration-rabbitmq.gemspec index 53f7452..098e2ae 100644 --- a/logstash-integration-rabbitmq.gemspec +++ b/logstash-integration-rabbitmq.gemspec @@ -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 "+ diff --git a/spec/outputs/rabbitmq_spec.rb b/spec/outputs/rabbitmq_spec.rb index c1962a3..25e140b 100644 --- a/spec/outputs/rabbitmq_spec.rb +++ b/spec/outputs/rabbitmq_spec.rb @@ -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