Commit graph

125 commits

Author SHA1 Message Date
mergify[bot]
2aff08c6e4
gradle task migrate to the new artifacts-api (#17232) (#17240)
This commit migrates gradle task to the new artifacts-api

- remove dependency on staging artifacts
- all builds use snapshot artifacts
- resolve version from current branch, major.x, previous minor,
   with priority given in that order.

Co-authored-by: Andrea Selva <selva.andre@gmail.com>
(cherry picked from commit 0a745686f6)

Co-authored-by: kaisecheng <69120390+kaisecheng@users.noreply.github.com>
2025-03-05 18:23:30 +00:00
github-actions[bot]
fc99649795
qa: don't bypass plugin manger tests on linux (#17171) (#17172)
* qa: don't bypass plugin manger tests on linux

* add gradle task to build gem fixtures for integration tests

(cherry picked from commit 0f81816311)

Co-authored-by: Ry Biesemeyer <yaauie@users.noreply.github.com>
2025-02-27 13:59:32 -08:00
github-actions[bot]
1fba70f92e
qa: use clean expansion of LS tarball per fixture instance (#17082) (#17113)
* qa: use clean expansion of LS tarball per fixture instance

Because QA tests can _modify_ the Logstash installation (e.g. those that
invoke the plugin manager), it is important that the service wrapper
begins with a clean expansion of the logstash tarball.

* qa: enable safe reuse of ls_home in ls_to_ls tests

(cherry picked from commit d20eb4dbcb)

Co-authored-by: Ry Biesemeyer <yaauie@users.noreply.github.com>
2025-02-18 22:08:02 -08:00
kaisecheng
05789744d2
Remove the Arcsight module and the modules framework (#16794)
Remove all module related code
- remove arcsight module
- remove module framework
- remove module tests
- remove module configs
2024-12-19 14:28:54 +00:00
João Duarte
e6e0f9f6eb
give more memory to tests. 1gb instead of 512mb (#16764) 2024-12-16 10:41:05 +00:00
Cas Donoghue
ff8c154c4d
Extend ruby linting tasks to handle file inputs (#16660)
This commit extends the gradle and rake tasks to pass through a list of files
for rubocop to lint. This allows more specificity and fine grained control for
linting when the consumer of the tasks only wishes to lint a select few files.
2024-11-12 12:46:52 -08:00
Andrea Selva
5d523aa5c8
Fix bad reference to a variable (#16615) 2024-10-30 11:44:41 +01:00
Andrea Selva
ed5874bc27
Use jvm catalog for reproducible builds and expose new pipeline to check JDK availability (#16602)
Updates the existing `createElasticCatalogDownloadUrl` method to use the precise version retrieved `versions.yml` to download the JDK instead of using the latest of major version. This makes the build reproducible again.
Defines a new Gradle `checkNewJdkVersion` task to check if there is a new JDK version available from JVM catalog matching the same major of the current branch. 
Creates a new Buildkite pipeline to execute a `bash` script to run the Gradle task; plus it also update the `catalog-info.yaml` with the new pipeline and a trigger to execute every week.
2024-10-29 10:55:15 +01: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