Commit graph

270 commits

Author SHA1 Message Date
Karol Bucek
53e73e9ccc
Fix: make sure LS exits when running into fatal errors (#12559)
Currently, LS does not respect fatal errors such as java.lang.OutOfMemoryError and continues executing.

This is dangerous since JVM errors are a legitimate reason to halt the process and not continue processing.

Additionally:

-   make sure we log the full stack-trace on fatal errors
-   halt the JVM wout executing finalizers/hook (scissors on how ES handles uncaught exceptions)
-   also, we should now be aware of a potentially unexpectedly dying thread

Back-port of #12470
2021-01-13 06:45:16 +01:00
Rob Bavey
0588d51056
[7x_backport] Add UBI8 image specific labels back to the docker image (#12502)
Clean backport of #12498

these labels are required for redhat openshift certification.

These commit reintroduces the labels for the ubi8 image only, and adds
acceptance tests to ensure these labels are correct and not inherited
2020-12-04 16:12:39 -05:00
Rob Bavey
44fa849852
[7x backport] Fix docker image metadata (#12450)
Clean backport of #12447, #12452

This commit fixes two issues with the docker metadata:

Removes non-OCI compliant freeform metadata labels
Uses a consistent build date for all the docker images and dockerfiles

Additionally, this commit adds a `build_docker_ubi8` rake task to enable
`ci/docker_acceptance_tests.sh` to run with no options to build all
docker images for the architecture.

Removing the freeform description labels left the container metadata
without a description label. This commit adds a description under the
"org.opencontainers.image.description" label
2020-11-18 16:10:48 -05:00
andsel
350bb28b06 In QA test, when Logstash package with bundled JDK is installed on RedHat it has to check also the architecture
(cherry picked from commit a6fbc6c260)
2020-10-21 08:58:53 -07:00
Karol Bucek
a693fa3bf4
Build: properly isolate integration (test) env setup (#12364)
to avoid gems being resolved from the usual LS GEM_HOME

this is problematic for gems such as jruby-openssl which are loaded
during boot (by RGs/Bundler) and thus activated in Bundler from a
different GEM_HOME. if such gem is updated it won't end up being
install-ed in the --path location as it's found on the GEM_HOME!

+ Fix: gem conflict 1.3.6 required by core
this is due now isolating GEM_HOME on `bundle install --path`

+ Refactor: we do not need LS_GEM_HOME/PATH

+ avoid pinning jruby-openssl to 0.10.4

resolves GH-12299 (reverting GH-12301)
2020-10-20 09:00:01 +02:00
Rob Bavey
708c156c1b
[7x backport] Write DLQ entries to temp file first (#12304) (#12318)
Clean backport of #12304

This commit changes the DLQ writer to write to a temporary file
 which will be renamed on "completion", to avoid the possibility
 of the DLQ reader reading an incomplete DLQ segment. The temp file
 will be renamed and made available, either when the capacity of this
 segment is reached, or if a configurable 'flush interval' has elapsed
 since the last event reached the dead letter queue.

This commit fixes #8022, #10275, #10967
This commit replaces #11127
2020-10-07 14:37:49 -04:00
Rob Bavey
ccbc5691cb
Docker Build: Add ability to detect/set build architecture (#12303)
Clean backport of #12302

This commit adds the ability for the docker build to build artifacts for multiple architectures.
By default, the target architecture is inferred from the architecture of the machine the build is being
run from - running the build from an aarch64 machine will build an aarch64 docker image, while building
from an x86_64 machine will build an x86_64 docker image.

This can be overridden by setting the environment variable DOCKER_ARCHITECTURE to either `x86_64` or
`aarch64`.

This commit also updates the integration tests to test against the architecture from the machine the test
is being run on, and includes the target architecture in the test description.
2020-10-05 13:38:09 -04:00
andsel
9668b9ec5c Bundle JDK (AdoptOpenJDK 11) in Logstash artifacts (ARM64)
Changed Linux creation artifacts (tar.gz/deb/rpm) to include the ARM JDK.
Extracted common parts of artifact.rake into functions to be shared between ARM and Intel bundling tasks
2020-09-30 05:59:29 -07:00
Rob Bavey
813e059a9d Bundle JDK (AdoptOpenJDK 11) in Logstash artifacts (x86_64)
Create new artifacts with bundled JDK for the supported platforms on x86_64. Download JDK packages from AdoptOpenJDK site, the selected version is loaded from `versions.yml`.
Changed also the launch scripts to give precedence to JAVA_HOME, then fallback on bundled JDK if present, as last resource go to the system Java.

New artifacts produced with bundled JDK are:
- tar.gz with JDK for Linux and Darwin
- zip file for Windows
- dep and rpm
- Docker image

All artifacts without JDK are now postfixed with '-no-jdk' while the ones with JDK included has the architecture extension.

Covered with tests the touched parts

Co-authored-by: Rob Bavey <robbavey@users.noreply.github.com>
2020-09-30 05:44:42 -07:00
Rob Bavey
1684c8529f
[7x backport]Fix docker image certification (#12248)
Clean backport of #12242

This commit includes the required changes to pass RedHat docker image certification.
This includes:
 Moving license files to /licenses folder
 Adding required base labels for name, description, vendor and summary

Relates: https://github.com/elastic/dev/issues/1287
2020-09-16 09:13:58 -04:00
andsel
c0d9b025e5 Fix to implement the blank? method that doesn't exists for String, is added by Rails framework 2020-09-04 14:29:03 +00:00
Rob Bavey
ef1352ef53 Add UBI8 docker image to artifacts
This commit adds the rake docker_ubi8 rake task, and associated
changes to the docker template and makefiles.

This commit also refactors the acceptance tests to extract xpack tests
into a helper class to allow the same tests to be used in both 'full'
and 'ubi8' docker image tests
2020-08-20 14:35:48 +00:00
Rob Bavey
e8385738c5
7x Introduce integration tests for docker images (#12157)
Clean backport of #12135

This commit adds integration tests for the Logstash docker images. Previous
integration tests were removed in https://github.com/elastic/logstash/pull/10693,
due to the tests being non functional.

The commit adds image and container tests. The image tests check the contents and the
metadata of the image; the container tests check the logstash process, and includes tests
ensuring that logstash runs, and is configurable.

This test also adds a ci script to allow the tests to be run on jenkins, and to split the
running of these tests up based on the image type and includes updates to the rake tasks to
support this.
2020-08-03 09:43:09 -04:00
Rob Bavey
7a4b81363b Fix kafka setup scripts
This commit updates the kafka setup scripts to ensure that the kafka setup is clean between builds, by
setting an explicit zookeeper data directory to be cleaned each time, and correctly overriding `log.dirs`
instead of `log.dir` to ensure that the kafka logs are written and wiped in a consistent place each time,
which helps when using the non-immutable images used in arm64 tests.
2020-07-13 17:49:23 +00:00
Rob Bavey
40f99249e6 Clear JAVA_HOME to use bundled JDK for Elasticsearch
This commit clears the `JAVA_HOME` variable when starting Elasticsearch
to force it to use the bundled version of the JDK, rather than the
default `JAVA_HOME` from the machine Logstash integration tests are being
run on, and removes the likelihood of tests failing to run due to `JAVA_HOME`
being set to a non-compliant JDK.
2020-07-08 13:01:41 +00:00
Rob Bavey
5a20843c8c
[7x backport] Add wait functionality to stop_es integration test helper function (#12067)
Integration tests may fail during elasticsearch teardown, as currently
the stop_es function sends a `SIGTERM` to Elasticsearch, but does not
wait for the process to exit. That can lead to issues when deleting
data directories from a still running process. This commit adds
wait functionality to `stop_es` to wait for a short period of time,
sending a `SIGKILL` if Elasticsearch does not terminate in time.

Clean backport of #12061
2020-07-02 11:35:45 -04:00
Rob Bavey
1a0d5c961f Use branch appropriate version of Elasticsearch
Carrying on from the work done in #11958, update the gradle build to download
the same version of Elasticsearch as is specified in the logstash version.yml file.
This commit updates the standard integration tests to use the same version of
Elasticsearch that is already downloaded for x-pack integration tests, and also
fixes integration tests to allow for the different responses around hits generated
by different versions of Elasticsearch.
2020-06-16 13:32:16 +00:00
Joao Duarte
7f58596643 remove uses of JSON.load in favor or JSON.parse
JSON.load allows the creation of complex objects, and should not
be given untrusted input. This commit changes the only three uses
of JSON.load in the codebase, which aren't user facing or present
in bundled product, so not really an attact vector.
2020-06-12 14:48:05 +00:00
Rob Bavey
addcb8a0a7
Retrieve branch version of Filebeat via gradle (#12011)
Clean backport of #11958

This commit changes the download to pull the version of beats based on the version pulled from the branch rather than from an environment variable, or 6.5.4.
This commit also moves the download logic of Filebeat fromfilebeat_setup.sh to build.gradle in order to use the artifacts API in the same way as the downloadEs task, and does some refactoring to DRY up the artifact download tasks.
This commit also fixes the beats integration test to replace the use of a removed setting.
This commit also sets retries to 3 for the download tasks, using 'retries' functionality from gradle download task plugin
2020-06-12 09:27:18 -04:00
Joao Duarte
e5f1e613ef update log4j script routes definition
fixes the change introduced with https://issues.apache.org/jira/browse/LOG4J2-2647
2020-06-09 13:26:30 +00:00
Rob Bavey
2deb5c02ad Fix prepare_offline_spec.rb test
The 'prepare_offline_spec.rb' is failing due to a change in the warning message
from JDK11 to JDK14, and JAVA_TOOL_OPTIONS being passed in as an environment
variable by Jenkins, which was not happening before due to the dockerized
environment.

Fixes #11933
2020-06-08 15:22:42 +00:00
Rob Bavey
ace1dd1318 [7x backport] Escape test fixture service scripts
Backport of #11931

Escape test fixture service scripts to avoid test failures when run in
Jenkins using multiple yaml configuration files, which causes directories
to be constructed like `centos-7&&immutable` which cause issues with
the service runners cutting off directory locations before '&&'

This commit deviates from the original commit by not setting @setup_script
and @teardown_script variable with the Shellwords escape, as this was removed
in a subsequent commit (#11944)
2020-06-08 07:50:52 -07:00
Rob Bavey
20a30f823a Give more options for testing with ruby while waiting for port
Try system ruby, then LS_HOME/bin/ruby, then relative path from
script to LS_HOME/bin/ruby. Use LS_RUBY_HOME variable to avoid
testing again on subsequent attempts to wait for port.
2020-06-08 14:36:31 +00:00
andsel
f3f6ca049f Fix integration tests related to logs when persistent_queue FEATURE_FLAG is enabled
Updated log4j definitions used when FEATURE_FLAG=persistent_queue is used.

Closes #11924

Fixes #11970
2020-06-05 13:39:08 +00:00
Rob Bavey
85e5057788
[7.x backport] Fix service script execution when path includes && (#11944) (#11948)
Backport of #11944

A previous commit attempted to fix this issue by adding Shellwords.escape to setup_script and teardown_script locations, but File.exists? returns false when called against a filename escaped by Shellwords.escape. This commit localizes the escaping to where the
file is executed.

This commit also adds Shellwords.escape to teardown script runner and the method used to execute logstash to retrieve version. This is to enable tests to run correctly when Jenkins creates execution environments with folders named with &&, eg centos-7&&immutable
2020-06-02 10:45:01 -04:00
Rob Bavey
b28fa3e7df Set beats permission checking to strict=false
When running filebeats integration tests on centos-7, the tests
fail due to permsisions checks on the temporary configuration file
created for the test. This commit sets strict permissions checks
to false in order for the tests to be able to succeed.

Fixes #11949
2020-06-01 18:40:41 +00:00
Rob Bavey
1ed6523e83 Fix typo
Fixes #11942
2020-05-29 16:46:52 +00:00
Rob Bavey
8cce2091d3 Switch 'no nc' port checker to ruby
Use ruby to test for port, rather than just sleeping

Fixes #11942
2020-05-29 16:46:52 +00:00
Rob Bavey
e4a5134760 Enable fallback to sleep if nc not installed
Fixture test scripts use `nc` to wait for the port to determine
whether a test fixture is up and running. This commit adds a fall
back option to sleep if `nc` is not available - it is not installed
on Jenkins centos worker nodes.

Fixes #11942
2020-05-29 16:46:52 +00:00
Rob Bavey
b2da4449a5
Use task avoidance API in gradle scripts (#11914) (#11943)
* Use task avoidance API in gradle scripts

This commit uses the task avoidance api (tasks.register vs task.create/
task DSL), as recommended since Gradle 5.1

This should reduce the execution of unnecessary tasks in build jobs, and
hopefully improve build resiliency and execution time.
2020-05-29 11:52:01 -04:00
Andrea Selva
c5b6a853d6
Introduced JDK environment variable to explicitly pass the JAVA_HOME to use and defined .ci/ with OS and JDK preferences (#11934) 2020-05-27 16:48:39 +02:00
Rob Bavey
ffcba6faf9 Quieten down kafka teardown script
Kafka teardown script can exit with failure, typically when trying to
stop the broker. This commit logs the error code if the scripts fail
rather than crash out causing build failure.

Fixes #11905
2020-05-19 14:19:56 +00:00
Joao Duarte
881099c39f download kafka from another mirror
the current mirror now refuses connections for the past 36 hours

Fixes #11887
2020-05-11 08:15:37 +00:00
Rob Bavey
33efbf3871 Update kafka version for integration tests.
Fixes #11806
2020-04-17 21:00:07 +00:00
Rob Bavey
0eb2f54de2
Update gradle version to 6.3 (#11742) (#11761)
* Backport of #11742. Not a clean backport as 7.x had not previously been upgraded to 5.6.4 as master had been.

* Update gradle version to 6.3

Gradle versions prior to 6.3 cannot run under JDK14.
This commit upgrades the version of Gradle to 6.3, and removes all deprecation warnings that can currently be removed.

Changes include:
* Increase gradle memory to 2g
* Increase gradle memory in the license check job to 2g
* Replace use of `testCompile`
* Replace `runtime` with `runtimeOnly`
* Remove`compile` depedencies from gradle files
* Replace deprecated archive methods
* Fix dependencies report build
* Make jruby dependencies 'api', fix archiveVersion
* Set `duplicatesStrategy` for all tasks of type Copy
* Use `configureEach` for global 'withType' calls
** Use the recommended Tasks API calls
(https://blog.gradle.org/preview-avoiding-task-configuration-time)
* Run `./gradlew wrapper` earlier to improve caching
* Use copy with chown for resources that need to be run during `./gradlew wrapper`
2020-04-08 09:00:34 -04:00
João Duarte
1fc169b7f6 Add apache and elastic license headers to source code files (#11673)
* add license header to ruby and java files
* add license header to erb and rake files
* add license headers to gradle files
2020-03-11 11:54:32 +00:00
Karol Bucek
7706866fb0 Fix: broken --help due sinatra 2.x upgrade
Fixes #11634
2020-03-03 21:00:10 +00:00
andsel
7a22220467 Added plugin.id to fish tag log lines related to plugins
Fixes #11078
2020-01-23 15:33:31 +00:00
Rob Bavey
60a7cd1de2 Update offline pack tests for integration plugins
Fix wildcard "logstash-filter-*" test
Add test for offline packaging of integaration plugins

Fixes #11406
2020-01-10 19:07:54 +00:00
andsel
9b308ae673 Introduced DeprecationLogger for use in core code and exposed to Java and Ruby plugins. Closes 11049
Fixes #11260
2019-11-14 10:49:28 +00:00
Joao Duarte
81e7b18b25 don't rely on expect match and last_match in qa test
Fixes #11273
2019-10-31 09:14:07 +00:00
Joao Duarte
b9039dcb57 ensure output of plugin list is utf8
Fixes #11246
2019-10-18 16:52:51 +00:00
João Duarte
e22868db52 Disable dlq integration tests due to multiple intermittent failures
Fixes #11244
2019-10-18 16:09:25 +00:00
andsel
331e8678c1 Fixes intermittent failing build due to Puma server going down bad on shutdown request
Fixes #11242
2019-10-18 11:28:45 +00:00
Ry Biesemeyer
0a89c4cee2 validate plugin list output respecting integration plugins
Fixes #11240
2019-10-18 08:54:33 +00:00
Joao Duarte
472d333ad9 more resilient testing of logging level setting
Fixes #11230
2019-10-17 13:04:14 +00:00
Ry Biesemeyer
1cf8a7b8d4 plugins: replace kafka input/output with integration
Fixes #11218
2019-10-16 01:46:49 +00:00
andsel
fc9c0e0ca2 Added LS configuration variable 'pipeline.separate_logs' to separate logs per pipelines - use log4j RoutingAppender - avoid output to main log files when log per pipeline is enabled - closes 10427
Fixes #11108
2019-10-08 14:07:18 +00:00
andsel
1cbaeebb4d Added origins of pipeline's configuration (es config string, the paths of config files used, module).
closes 9630

Fixes #11130
2019-09-12 15:08:20 +00:00
andsel
056c3e3bb8 Add pipeline.id to log lines fixes #8290, #10521
Fixes #11075
2019-08-29 10:36:05 +00:00