From 2900105a0102e073ae8b6d594e13054dfa9d6902 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Tue, 18 Feb 2020 12:31:39 +0100 Subject: [PATCH] Fix versioning of dropwizard image used in tests (#16332) Tag the docker image used for dropwizard tests with the dropwizard metrics version instead of with the maven version used to build it. Prebuild artifacts so there is no need to download dependencies and build when running the immages. Add supported-versions.yml. Test also with 4.1.2. (cherry picked from commit 21e15609a7b2ca3d1a0ce17440510219629d2210) --- CHANGELOG.next.asciidoc | 1 + metricbeat/docs/modules/dropwizard.asciidoc | 2 +- metricbeat/module/dropwizard/_meta/Dockerfile | 17 ++++++++++++----- .../module/dropwizard/_meta/docs.asciidoc | 2 +- .../dropwizard/_meta/supported-versions.yml | 4 ++++ .../module/dropwizard/_meta/test/pom.xml | 19 +------------------ .../module/dropwizard/docker-compose.yml | 4 ++-- .../module/dropwizard/test_dropwizard.py | 1 + 8 files changed, 23 insertions(+), 27 deletions(-) create mode 100644 metricbeat/module/dropwizard/_meta/supported-versions.yml diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index f9523725fd7c..46a750ba9b42 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -232,6 +232,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Add collecting AuroraDB metrics in rds metricset. {issue}14142[14142] {pull}16004[16004] - Reuse connections in SQL module. {pull}16001[16001] - Improve the `logstash` module (when `xpack.enabled` is set to `true`) to use the override `cluster_uuid` returned by Logstash APIs. {issue}15772[15772] {pull}15795[15795] +- Add support for Dropwizard metrics 4.1. {pull}16332[16332] *Packetbeat* diff --git a/metricbeat/docs/modules/dropwizard.asciidoc b/metricbeat/docs/modules/dropwizard.asciidoc index de8d439fde01..03b5a863f2d0 100644 --- a/metricbeat/docs/modules/dropwizard.asciidoc +++ b/metricbeat/docs/modules/dropwizard.asciidoc @@ -10,7 +10,7 @@ This is the http://dropwizard.io[Dropwizard] module. The default metricset is `c [float] === Compatibility -The Dropwizard module is tested with dropwizard metrics 3.1.0. +The Dropwizard module is tested with dropwizard metrics 3.2.6, 4.0.0 and 4.1.2. [float] diff --git a/metricbeat/module/dropwizard/_meta/Dockerfile b/metricbeat/module/dropwizard/_meta/Dockerfile index 668844b9ef78..3098a420da1a 100644 --- a/metricbeat/module/dropwizard/_meta/Dockerfile +++ b/metricbeat/module/dropwizard/_meta/Dockerfile @@ -1,9 +1,16 @@ -ARG MAVEN_VERSION -FROM maven:${MAVEN_VERSION} +FROM maven:3.6-jdk-8 + +# Variables used in pom.xml +ARG DROPWIZARD_VERSION + +# Build the deployable war COPY test /test +WORKDIR /test +RUN mvn verify + +# Build the final image +FROM jetty:9.4.26-jre8 +COPY --from=0 /test/target/test-1.0-SNAPSHOT.war /var/lib/jetty/webapps/test.war HEALTHCHECK --interval=1s --retries=90 CMD curl -f http://localhost:8080/test/helloworld EXPOSE 8080 - -WORKDIR /test -CMD mvn jetty:run diff --git a/metricbeat/module/dropwizard/_meta/docs.asciidoc b/metricbeat/module/dropwizard/_meta/docs.asciidoc index 6f9f28bc8cc8..5f20730bc417 100644 --- a/metricbeat/module/dropwizard/_meta/docs.asciidoc +++ b/metricbeat/module/dropwizard/_meta/docs.asciidoc @@ -3,4 +3,4 @@ This is the http://dropwizard.io[Dropwizard] module. The default metricset is `c [float] === Compatibility -The Dropwizard module is tested with dropwizard metrics 3.1.0. +The Dropwizard module is tested with dropwizard metrics 3.2.6, 4.0.0 and 4.1.2. diff --git a/metricbeat/module/dropwizard/_meta/supported-versions.yml b/metricbeat/module/dropwizard/_meta/supported-versions.yml new file mode 100644 index 000000000000..0888fc679e72 --- /dev/null +++ b/metricbeat/module/dropwizard/_meta/supported-versions.yml @@ -0,0 +1,4 @@ +variants: + - DROPWIZARD_VERSION: 4.1.2 + - DROPWIZARD_VERSION: 4.0.0 + - DROPWIZARD_VERSION: 3.2.6 diff --git a/metricbeat/module/dropwizard/_meta/test/pom.xml b/metricbeat/module/dropwizard/_meta/test/pom.xml index 5efba5fb613f..e8d4dfb6c81d 100644 --- a/metricbeat/module/dropwizard/_meta/test/pom.xml +++ b/metricbeat/module/dropwizard/_meta/test/pom.xml @@ -17,24 +17,7 @@ io.dropwizard.metrics metrics-servlets - 4.0.0 + ${env.DROPWIZARD_VERSION} - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - org.mortbay.jetty - maven-jetty-plugin - - - diff --git a/metricbeat/module/dropwizard/docker-compose.yml b/metricbeat/module/dropwizard/docker-compose.yml index 28347ef8ba20..4cb6fbd13f05 100644 --- a/metricbeat/module/dropwizard/docker-compose.yml +++ b/metricbeat/module/dropwizard/docker-compose.yml @@ -2,10 +2,10 @@ version: '2.3' services: dropwizard: - image: docker.elastic.co/integrations-ci/beats-dropwizard:${MAVEN_VERSION:-3.3-jdk-8}-1 + image: docker.elastic.co/integrations-ci/beats-dropwizard:${DROPWIZARD_VERSION:-4.1.2}-1 build: context: ./_meta args: - MAVEN_VERSION: ${MAVEN_VERSION:-3.3-jdk-8} + DROPWIZARD_VERSION: ${DROPWIZARD_VERSION:-4.1.2} ports: - 8080 diff --git a/metricbeat/module/dropwizard/test_dropwizard.py b/metricbeat/module/dropwizard/test_dropwizard.py index 767fe4e32c77..8e771c511c2e 100644 --- a/metricbeat/module/dropwizard/test_dropwizard.py +++ b/metricbeat/module/dropwizard/test_dropwizard.py @@ -6,6 +6,7 @@ import metricbeat +@metricbeat.parameterized_with_supported_versions class Test(metricbeat.BaseTest): COMPOSE_SERVICES = ['dropwizard']