Commit graph

118 commits

Author SHA1 Message Date
github-actions[bot]
0770fff960
give more memory to tests. 1gb instead of 512mb (#16764) (#16801)
(cherry picked from commit e6e0f9f6eb)

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2024-12-16 11:59:34 +00:00
Andrea Selva
8e8a5b08d1
Updated target and source Java definitions in build.gradle becuase deprecated and planned for removal in next major (#16156)
Updated target and source Java definitions in build.gradle because deprecated and planned for removal in next major.
2024-05-10 09:14:25 +02:00
João Duarte
0d6117173f
update multiple dependencies (#16136)
This upgrades multiple java libraries:

* snakeyaml
* shadow
* gradle
* guava
* commons-io
* commons-logging
* commons-codec
* commons-compress
* commons-lang3
* commons-csv
* log4j
* google-java-format
* httpclient
* httpcore
* javassist
* jackson
* jackson-databind
* wiremock-standalone

Gems:

* rack
*sinatra
*octokit
* gems
* rake
* webmock

Also upgrades Java to 17.0.11+9.

Leftover upgrades:

* commons-csv 1.8 breaks license checker
* janino 3.1.12 breaks java tests
* log4j 2.21.0 breaks java compilation
2024-05-08 09:13:41 +01:00
Andrea Selva
6a04854e4c
JDK 21 move (#15719)
Adaptations to run Logstash on JDK 21:

- Java 8 support is obsolete and will be removed.
- Thread's `getId` (not final) replaced by final `threadId` https://bugs.openjdk.org/browse/JDK-8017617
- Verify the warnings "this-escape" when a constructor use other method or pass around `this` reference to other methods https://bugs.openjdk.org/browse/JDK-8015831
- URL constructor is deprecated, use `<uri_instance>.toURL()` (since JDK 20)
-  Manages new (since JDK 20) `G1 Concurrent GC` MX Bean, [ref](https://github.com/elastic/logstash/pull/15719#issuecomment-1946367785)
2024-04-03 17:08:12 +02:00
Andrea Selva
c30fe46c80
Added :jvm-options-parser subproject to the javaTests task (#15957)
Adds a global new task named javaTests which groups both :logstash-core:javaTests and :jvm-options-parser:test to include the JvmOptionParser unit test in javaTests phase.
2024-02-19 16:22:03 +01:00
Dimitrios Liappis
d74fea4b55
Fix IT tests after version bumps (#15827)
This commit fixes IT failures that frequently occur after
version bumps due to missing unified release snapshot builds for
the new version.

This commit uses project specific DRA snapshot URLs for ES and Filebeat
in all cases apart from release builds.

Closes #2825
2024-01-23 15:13:51 +02:00
Andrea Selva
73daec05ed
Download of JDK from the Elastic catalog instead of Adoptium (#15514)
* Adapted the JDK's download URL creation to intereact with Elastic catalog to get metadata, and return the catalog download link instead of directly pointing to Adoptium API

* Silenced the Download task of JDK to print the full url
2023-10-30 16:24:27 +01:00
Pavel Zorin
f90647d98d
Sonar integration with Java Tests code coverage (#15279)
* Sonar integration

* Removed sonar from test target
2023-09-15 00:47:38 +02:00
Andres Rodriguez
6154a69c15
Add basic ruby linter (#15168)
Adds rubocop as a linter for ruby.:
 - Adds .rubocop.yml which defines specific config on top of default
 - Adds Gradle task 'lint' task
 - Adds 'lint:report' rake task to report Lint Cops.
 - Adds 'lint:format' rake task to automatically format the code.
2023-07-13 17:18:10 -04:00
João Duarte
1d1fa7a471
update commons-io commons-compress jrjackson databind (#15125)
* update commons-io to 2.13.0 and commons-compress to 1.23.0

* update databind and jackson
2023-06-29 09:02:32 +02:00
João Duarte
98c3d30ca8
Remove custom bundler (#15066)
* reintroduce bundler patches for bundler < 2.4
2023-06-29 08:59:54 +02:00
Andrea Selva
26d1c7ccdb
Update to JRuby 9.4 (#14861)
Set of changes to make Logstash compatible to JRuby 9.4.
Bundle JRuby 9.4.3.0

- Redefine space token in `LSCL`  and `grammar` treetop from `_` which would generated methods in the form `def _0` (deprecated since `2.7`) to `sc`.
- `I18n.t` method doesn't accept hash as second argument
- `URI.encode` has been replaced with same functionality with `URI::Parser.new.escape`
- `YAML.load` needs explicit `fallback: false` to return false when the yaml string is empty (or contains only comments)
- JRuby's  `JavaClass` has been removed, now it can use `java.lang.Class` directly
- explicitly require gem `thwait` to satisfy `require "thwait"` (In `Gemfile.template` and `logstash-core/logstash-core.gemspec`)
- fix not args `clone` to be `def clone(*args)`
- fix `Enumeration.each_slice` which from `Ruby 3.1` is [chainable](https://rubyreferences.github.io/rubychanges/3.1.html#enumerableeach_cons-and-each_slice-return-a-receiver) and doesn't return `nil`. JRuby fixed in https://github.com/jruby/jruby/issues/7015
- Expanded `Down.download` arguments map ca16bbed3c302006967413eb9d3862f2da81f7ae
- Avoid to pass `nil` in the list of couples used in `Hash[ <list of couples> ]` which from Ruby `3.0` generates an `ArgumentError`
- Removed space not allowed between method name and parentheses `initialize (` is forbidden. 29b607dcdef98f81a73ad171639fd13aaa65e243
- With [Ruby 2.7 the `Kernel#open`](https://rubyreferences.github.io/rubychanges/2.7.html#network-and-web) doesn't fallback to `URI#open`, fixed test code that used that to verify open port. e5b70de54c5301f51a767da67294092af0cfafdc
- Avoid to drop `rdoc/` folder from vendored JRuby else `bin/logstash -i irb` would crash, commit b71f73e9c6edb81a7b7ae1305047e506f61c6e8c

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2023-06-28 13:05:43 +02:00
João Duarte
0df07d3f11
Reintroduce bundler 2.4 (#14995)
* Revert "Revert "Unpin bundler to allow 2.4 (#14894)" (#14942)"

This reverts commit 5e3038a3d3.

* prevent bundler 2.4 from blowing up memory during ./gradlew generatePluginsVersion

for some reason, instances of Bundler::Dsl are retained in
org.jruby.MetaClass. Each Bundler::Dsl will retain Bundler::SourceList
which is > 150MB. This commit sets the internal state of each Dsl's
source list so the large objects can be collected.

The proper fix would be to either reuse a single Dsl object or fix the
code upstream to avoid having Dsl objects retained by org.jruby.MetaClass.

* skip input cloudwatch during generatePluginsVersion

the new bundler 2.4's resolution algorithm seems to struggle in certain
situations, like resolving combination of "logstash-input-cloudwatch" and
"logstash-integration-aws".

Until the issue is solved let's skip it.
2023-04-12 10:11:07 +01:00
João Duarte
5e3038a3d3
Revert "Unpin bundler to allow 2.4 (#14894)" (#14942)
This reverts commit 6d08a7c1cd.

Bundler 2.4 is accumulating memory during the `generateDocsVersion` task
outside of the known Bundler 2.3 DepProxy class.
Until the memory mitigation patch is adapted to Bundler 2.4 it's best to revert 6d08a7c1cd.
2023-03-23 11:45:24 +00:00
Andrea Selva
a126364102
Centralized version definition for snakeyaml and shadow plugin used in buildscripts (#14952)
Create a variable in the Gradle's 'ext' map to store the versions of libraries and plugins used across the various .gradle files.
2023-03-10 16:50:16 +01:00
João Duarte
6d08a7c1cd
Unpin bundler to allow 2.4 (#14894)
* use Bundler::SolveFailure
2023-02-22 17:05:16 +00:00
Pamir
50c395a443
Update snakeyaml to 1.33 2023-01-23 10:56:40 +00:00
Mashhur
dd06ec53e9
Use aarch64 artifact arch for integration tests on Mac M1 (darwin) OS. (#14754) 2022-11-17 16:24:57 +05:00
Mashhur
bd3451270c
Dev instructions improvement (#14219)
* LS local development guide improvements.

* Use imperative guide instead abstraction.

* Give a proper name to Gradle task to install the dev gems.
2022-09-27 13:38:36 -07:00
Rob Bavey
cd60c6522a
Update tests to allow integration tests to use the bundled JDK (#14432)
* Adds tasks to add bundled JDK to tar file used to run integration tests
* Uses `RUNTIME_JAVA_HOME` environment variable to control whether bundled JDK or
  alternative is to be used
* Updates logstash service helper to respect value of `RUNTIME_JAVA_HOME`

* Requires updates to jenkins repo to set `RUNTIME_JAVA_HOME` correctly only for
  integration tests that expect to use a custom version of Java, such as the JDK
  matrix tests.
2022-08-16 09:03:52 -04:00
Andrea Selva
7887972348
Open java modules for gradle test after 7.5 upgrade (#14413)
Open the access to java.lang and java.util packages in java.base module.
With Gradle 7.5 these packages aren't anymore implicitly opened in test tasks. With this commit, those packages are opened for all test tasks, also on the buildSrc.
2022-08-03 15:32:49 +02:00
João Duarte
8aa62dc441
pin bundler 2.3.18 to avoid bug in .19 (#14394)
When using Bundler 2.3.19, doing a "bin/logstash-plugin uninstall <plugin>"
will crash, failing to find gems in the :build group.

Until we know more about why, pin bundler to 2.3.19
2022-07-29 17:46:10 +01:00
João Duarte
6262cc6b70
upgrade to gradle 7.5 (#14378) 2022-07-26 14:34:50 +01:00
Karol Bucek
f073529d70
Build: make sure lock is created in integration specs (#14302)
without these changes doing (an in-process) `bundle install`
did not generate a Gemfile.lock

this is than problematic, when using git sourced gem (locally) those gems do not not get resolved properly with the *qa/integration/rspec.rb* script
2022-06-28 09:06:15 +02:00
Rob Bavey
9e2c87a1ab
Switch adoptopenjdk url to adoptium (#14098)
* Switch adoptopenjdk url to adoptium

Newer versions of the JDK are only available from api.adoptium.net, and not dual hosted on api.adoptopenjdk.net
This commit allows the use of adoptium versions of the JDK.

Relates: #14072
2022-05-24 09:33:44 -04:00
Andrea Selva
69107a5bc6
Simplifies aliass registry marking task config and move into separate class (#14138)
Introduce some default configs for Alias registry signing task, extract into separate class and cover with tests.
2022-05-20 13:59:55 +02:00
Andrea Selva
2e2dcbb46a
Fixed SignAliasDefinitionsTask task to depend on input yaml registry file (#14126)
Updates the SignAliasDefinitionsTask Gradle task to express as input dependency the Aliases registry yaml file, so that when the input changes then a new signed registry is created.
2022-05-20 09:26:37 +02:00
Rob Bavey
4a2268a43f
Update jruby version to 9.3.4.0 (#14114)
This commit updates the version of jruby used in Logstash to `9.3.4.0`.

* Updates the references of `jruby` from `9.2.20.1` to `9.3.4.0`
* Updates references/locations of ruby from `2.5.0` to `2.6.0`
* Updates java imports including `org.logstash.util` to be quoted
  * Without quoting the name of the import, the following error is observed in tests:
  * `java.lang.NoClassDefFoundError: org/logstash/Util (wrong name: org/logstash/util)`
  * Maybe an instance of https://github.com/jruby/jruby/issues/4861
* Adds a monkey patch to `require` to resolve compatibility issue between latest `jruby` and `polyglot` gem 
  * The addition of https://github.com/jruby/jruby/pull/7145 to disallow circular
causes, will throw when `polyglot` is thrown into the mix, and stop logstash from
starting and building - any gems that use an exception to determine whether or not
to load the native gem, will trigger the code added in that commit.
  * This commit adds a monkey patch of `require` to rollback the circular cause exception
back to the original cause.
* Removes the use of the deprecated `JavaClass`
* Adds additional `require time` in `generate_build_metadata`
* Rewrites a test helper to avoid potentially calling `~>` on `FalseClass`


Co-authored-by: Joao Duarte <jsvduarte@gmail.com>
Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2022-05-19 10:29:59 -04:00
Rob Bavey
2c7f14d25a
Move JvmOptionParser to separate project (#13657)
This commit moves the JvmOptionParser into its own gradle project.

This enables the JvmOptionParser to remain compatible with Java 1.8 to present a helpful error message to a user attempting to start Logstash using older versions of Java, while allowing the main Logstash code base to freely use idiomatic Java 11 features.
2022-05-18 14:58:53 -04:00
Rob Bavey
b4c54ab681
[Java17] Add --add-export settings to restore JDK17 compatibility (#13825)
* [Java17] Add `--add-export` settings to restore JDK17 compatibility

After #13700 updated google-java-format dependency, it is now required to add a number
of `--add-export` flags in order to run on JDK17. This commit adds these flags to the
jvm options for a running logstash, and to the tests running on gradle to enable tests
to still work

* Move mandatory JVM options out of `jvm.options` and into JvmOptionsParser

Certain values for the JVM are mandatory for Logstash to function correctly. Rather than
leave them in config/jvm.options where they can be updated, and can cause upgrade issues
for users when we add new mandatory options, move them into code where they cannot be
changed
2022-03-24 16:59:15 -04:00
Andrea Selva
fbcbb7084f
Print bundled jdk's version in launch scripts when LS_JAVA_HOME is provided (#13880)
Extracts the bundled JDK's version into a one-line text file which could easily read and print from bash/batch scripts.
Updates Logstash's bash/batch launcher scripts to print the bundled JDK version when warn the user about his override.

Updates the rake script used to create Logstash artifacts (rakelib/artifacts.rake) to include JDK related stuff only if packages that requires it.
2022-03-18 08:59:30 +01:00
Karol Bucek
c3d2f5750f
Build: avoid doing a redundant bundle install (#13820) 2022-03-01 15:52:26 +01:00
Rob Bavey
aceb682f18
Unpin bundler, fix gem installer tests (#13762)
Fix gem installer tests to enable unpinning the version of bundler

This commit removes changes the gem installer to use real gems, rather than
use `allow_instance_of` during testing, which appears to be problematic with the
latest version of bundler
2022-02-11 09:13:11 -05:00
Rob Bavey
a15c9771c7
Pin bundler to 2.3.6 to fix builder (#13753)
Build has been failing since the release of 2.3.7, this commit pins
bundler to 2.3.6 to get the build green again while the cause can be
investigated
2022-02-09 20:07:53 -08:00
Karol Bucek
3637a30e8f
Refactor: drop redundant (jruby-complete.jar) dependency (#13159)
Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2022-02-02 06:55:26 +01:00
Andrea Selva
728289e862
Switched to Gradle 7 (#13184)
This commit:
- Updates the Gradle wrapper to version 7.2
- Remove the deprecated jcenter and where it was used to retrieve Gradle's plugins it switches to gradlePluginPortal
- Insert an explicit dependency from test task to the log4j.properties manipulation task ("copyProductionLog4jConfiguration") used in integration
2021-09-08 10:42:13 +02:00
Andrea Selva
9fd3b61188
Introduce explicit dependencies (#13183)
Gradle 7 introduced a check for implicit task dependencies.
This PR moves to a fine grained copyAlias tasks to tighten output dependencies and to make those explicit.
2021-09-02 09:41:37 +02:00
Andrea Selva
d2237578d5
Feature/remove gradle license report plugin (#13182)
Remove usage of plugin Gradle-License-Report to generate CSV report of used dependencies.
This commit replaces the removed plugin with the custom `ListProjectDependencies` task that inspects Gradle's project dependencies and produces a CSV file containing the list.
2021-09-01 15:28:57 +02:00
Andrea Selva
a7f6c01a3a
Update Snakeyaml version to 1.29 (#13129)
Snakeyaml is used only in the build chain, and it's not packaged with Logstash
2021-08-16 10:33:47 +02:00
Andrea Selva
cef339ce57
Move retrieval of Stack version from Gradle's configuration to execution (#13042)
The Gradle's configuration of task should be as fast as possible and don't break the build.
This commit moves retrieval of Elastic Stack version from the remote registry to the execution phase of the tasks.
Also the tasks that depends on this has received the same change (downloadEs and check EsSHA), moving from configuration to execution phase.

Close #13030
2021-07-12 09:08:07 +02:00
Andrea Selva
b7efcf4a58
Revert "Change Gradle's :logstash-integration-tests:integrationTests task to depends on copyES (#12847)" (#13045)
This reverts commit 149ee41a8b.

The Gradle "runIntegrationTests" has to download the necessary ES and Fielbeats and then launch the task :logstash-integration-tests:integrationTests.
:logstash-integration-tests:integrationTests is not intented to be launched directly
2021-07-05 11:05:11 +02:00
Andrea Selva
a5f3153a8f
Add unit test to grant that production aliases correspond to a published RubyGem (#12993)
Loads the production plugin_aliases.yml definition file and check that every alias has
a properly published gem on RubyGems.

Adds clean up of plugin_aliases.yml files
Fixed task dependency for copyPluginAlias
2021-06-21 14:17:14 +02:00
Andrea Selva
cafbf03158
Added test to cover the installation of aliased plugins (#12967)
Added test to cover the installation of aliased plugins when exists a gem with same name but that's not a Logstash plugin.
In this case the alias is resolved to the original, skipping the gem retrieved from RubyGems.
2021-06-15 14:14:41 +02:00
Andrea Selva
446dc7d906
Avoid hard-coded plugin alias definitions (#12841)
Remove hard coded alias definitions in favor of yaml descriptor file.

Introduce a single point of aliases definition (logstash-core/src/main/resources/org/logstash/plugins/AliasRegistry.yml),  checksum and copy it around to be used by Logstash and by Logstash's plugin management tool.

The descriptor yml file contains a checksum to verify it's not changed accidentally in a deployment of Logstash, if the verification phase fail Logstash avoid to start and plugin management tool avoid to operate.
The signing and copying around is managed by a specific Gradle task invoked during the build.

Co-authored-by: Ry Biesemeyer <yaauie@users.noreply.github.com>

Fixes #12831
2021-06-03 12:24:18 +02:00
Andrea Selva
149ee41a8b
Change Gradle's :logstash-integration-tests:integrationTests task to depends on copyES (#12847)
The integrationTests start instances of Elasticsearch so they need it to be present and unpacked in build/ folder before start.
2021-05-03 11:51:17 +02:00
andsel
dd9f2b7a0a Fix the run of copyEs and downloadEs gradle task. (#12586)
Avoid the deletion of downaloaded ES artifact during copyEs task and download a new version only if the SHA512 of the local copy differs from the what is retrived from remote repository.
This avoid unusefull download of the same ES artifact when run integrationTests task multiple times.
2021-02-03 07:40:45 -08:00
andsel
d176e608bd Enable javadoc lint only for files that contains javadoc comments, avoid warning for missing javadoc comments on everything else 2020-12-17 03:39:11 -08:00
andsel
7144a3f7cf Fix error due to missing variable when listitng tasks and no architecture is externally specified with -Pos_arch= 2020-12-10 05:22:48 -08:00
Karol Bucek
4649a55a84
Build: properly isolate integration (test) env setup (#12361)
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-12300)
2020-10-19 17:32:01 +02:00
Rob Bavey
80091b16ec
Remove redundant shouldRunAfter (#12314)
The `shouldRunAfter` specified in the main script body was causing the runIntegrationTests
task to be evaluated even when it should not have been, causing unnecessary failures
when artifacts required only for integration tests are unavailable.
This can be removed, because the `shouldRunAfter` relationship for the `runIntegrationTests`
task is already defined in the task body.
2020-10-07 11:05:04 -04:00