From 93ebfd6c15e41ebd60b6332a5a543dca3400a6fd Mon Sep 17 00:00:00 2001 From: Kaise Cheng Date: Mon, 21 Dec 2020 14:59:19 +0100 Subject: [PATCH 1/8] remove logstash/pipeline --- spec/outputs/rabbitmq_spec.rb | 1 - 1 file changed, 1 deletion(-) 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 From a6135342d7b8ea19fd821052334703a96998a9c8 Mon Sep 17 00:00:00 2001 From: Kaise Cheng Date: Mon, 21 Dec 2020 15:05:45 +0100 Subject: [PATCH 2/8] bump version --- CHANGELOG.md | 3 +++ logstash-integration-rabbitmq.gemspec | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e86668f..1004bcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 7.2.1 + - 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/logstash-integration-rabbitmq.gemspec b/logstash-integration-rabbitmq.gemspec index 53f7452..f8890e6 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.1' 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 "+ From be83e0d4ae69df99cb7e7ba5e68a67891c9da429 Mon Sep 17 00:00:00 2001 From: Kaise Cheng Date: Mon, 21 Dec 2020 15:30:26 +0100 Subject: [PATCH 3/8] bump version --- CHANGELOG.md | 2 +- logstash-integration-rabbitmq.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1004bcd..ce65e94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 7.2.1 +## 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 diff --git a/logstash-integration-rabbitmq.gemspec b/logstash-integration-rabbitmq.gemspec index f8890e6..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.2.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 "+ From 78ffcded69c52f95d0a412d70920db4f858cddb3 Mon Sep 17 00:00:00 2001 From: Kaise Cheng Date: Tue, 22 Dec 2020 11:24:48 +0100 Subject: [PATCH 4/8] fix broken docker --- .ci/common/logstash.Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.ci/common/logstash.Dockerfile b/.ci/common/logstash.Dockerfile index 799016c..766fd58 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 8.0 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 From 9a275e3bffceb589a67082fd6c22599d081ffbd6 Mon Sep 17 00:00:00 2001 From: Kaise Cheng Date: Tue, 22 Dec 2020 11:51:17 +0100 Subject: [PATCH 5/8] fix broken docker setup script --- .ci/docker-setup.sh | 50 +++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/.ci/docker-setup.sh b/.ci/docker-setup.sh index c39563a..40c9c56 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,25 @@ 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]}") + +cd .ci + 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 From 33cd46d7a92ca1b7b733c854b0b4602b35172a99 Mon Sep 17 00:00:00 2001 From: Kaise Cheng Date: Tue, 22 Dec 2020 13:16:34 +0100 Subject: [PATCH 6/8] fix broken docker setup script --- .ci/docker-setup.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.ci/docker-setup.sh b/.ci/docker-setup.sh index 40c9c56..20dda41 100755 --- a/.ci/docker-setup.sh +++ b/.ci/docker-setup.sh @@ -63,7 +63,5 @@ fi CURRENT_DIR=$(dirname "${BASH_SOURCE[0]}") -cd .ci - 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 From 7e5161dd994425f8d8a3bbf45673cb43ddf81283 Mon Sep 17 00:00:00 2001 From: Kaise Cheng Date: Tue, 22 Dec 2020 13:54:15 +0100 Subject: [PATCH 7/8] fix broken test --- lib/logstash/plugin_mixins/rabbitmq_connection.rb | 1 + 1 file changed, 1 insertion(+) 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 From 3016567ad77c84063ec52900b686f50224bfa04f Mon Sep 17 00:00:00 2001 From: Kaise Cheng Date: Thu, 31 Dec 2020 14:30:50 +0100 Subject: [PATCH 8/8] update comment --- .ci/common/logstash.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/common/logstash.Dockerfile b/.ci/common/logstash.Dockerfile index 766fd58..260ece6 100644 --- a/.ci/common/logstash.Dockerfile +++ b/.ci/common/logstash.Dockerfile @@ -4,7 +4,7 @@ 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 -# NOTE: since 8.0 JDK is bundled as part of the LS distribution under $LS_HOME/jdk +# 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'