Commit graph

349 commits

Author SHA1 Message Date
Mashhur
7ed8d37630
Bundle plugin. (#15359) 2023-10-02 21:36:05 -07:00
Rob Bavey
fe1b1ed1da
Remove DepProxy patch, as Bundler::DepProxy is removed in Bundler 2.4.0 (#15269) 2023-08-21 15:54:01 -04:00
Andres Rodriguez
cf67cb1377
Rubocop: Enable most SpaceInside cops (#15201)
Enabled:
* SpaceInsideArrayLiteralBrackets
* SpaceInsideParens
* SpaceInsidePercentLiteralDelimiters
* SpaceInsideStringInterpolation
* Add enforced style for SpaceInsideStringInterpolation

Enabled without offenses:
* SpaceInsideArrayPercentLiteral
* Layout/SpaceInsideRangeLiteral
* Layout/SpaceInsideReferenceBrackets
2023-07-20 09:49:46 -04:00
Andres Rodriguez
2165d43e1a
Rubocop: Enable SpaceBefore cops (#15197)
Enables the following cops:

 * Layout/SpaceBeforeBlockBraces
 * Layout/SpaceBeforeBrackets
 * Layout/SpaceBeforeComma
 * Layout/SpaceBeforeComment
 * Layout/SpaceBeforeFirstArg
 * Layout/SpaceBeforeSemicolon
2023-07-18 22:32:17 -04:00
Andres Rodriguez
4255a8fd1c
Rubocop: Enable SpaceAround cops (#15196)
* Enable SpaceARoundBlockParameters
* Enable SpaceAroundEqualsInParameterDefault
* Enable SpaceAroundKeyword
* Enable SpaceAroundOperators
* Enable SpaceBeforeBlockBraces, which yields no changes
2023-07-18 21:11:57 -04:00
Andres Rodriguez
acd87a69e7
Rubocop: Enable various EmptyLine cops (#15194)
Disabled:
 * EmptyLineAfterGuardClause
 * EmptyLineAfterMultilineCondition
 * EmptyLinesAroundAccessModifier

Enabled:
 * Layout/EmptyLineAfterMagicComment
 * Layout/EmptyLineBetweenDefs
 * Layout/EmptyLines
 * Layout/EmptyLinesAroundArguments
 * Layout/EmptyLinesAroundAttributeAccessor
 * Layout/EmptyLinesAroundBeginBody
 * Layout/EmptyLinesAroundBlockBody
 * Layout/EmptyLinesAroundExceptionHandlingKeywords
 * Layout/EmptyLinesAroundMethodBody
 * Layout/EmptyLinesAroundModuleBody
2023-07-18 16:49:16 -04:00
Andres Rodriguez
1d558c35d0
Fix instances of deprecated class methods (#15183)
Replace ::File.exists? for ::File.exist?
2023-07-17 11:32:46 -04:00
Andres Rodriguez
cb19d4e88a
Add rake lint task to correct custom cods
Add a rake task that allows users to correct all the instances of a specific cop.
2023-07-14 16:48:53 -04:00
Andres Rodriguez
b63ffea472
Enable SpaceAfterColon, SpaceAfterComma, SpaceAfterSemicolon (#15180)
Enable SpaceAfterColon, SpaceAfterComma, SpaceAfterSemicolon and fix occurrences.
2023-07-14 16:46:35 -04:00
Andres Rodriguez
5e34aacc6e
Enable trailing whitespace formating (#15174)
* Enable Layout/TrailingWhitespace cop formation
* Remove Trailing Whitespaces
2023-07-14 13:22:02 -04: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
Andres Rodriguez
0092a82a93
Bundle ESF forwarder (#15126) 2023-07-10 18:10:52 -04:00
João Duarte
98c3d30ca8
Remove custom bundler (#15066)
* reintroduce bundler patches for bundler < 2.4
2023-06-29 08:59:54 +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
Andres Rodriguez
2f57453822
Revert partial change in c99a7b2f4 that broke packaging builds (#14955)
Fixed: #14941
2023-03-09 22:19:45 +00:00
kaisecheng
c99a7b2f46
Add env LOG_STYLE to control the log behavior (#14949)
This commit adds environment variable LOG_STYLE to control log behavior of docker container
`console` - this is the default to output to standout
`file` - log to disk.

Fixed: #14941
2023-03-08 23:25:33 +00:00
Mashhur
3875a24cda
Skip dependency Gemfile.lock during the artifact creation. (#14899)
* Skip dependency Gemfile.lock during the artifact creation. This will help vulnerability scanners not to confuse while scanning.

* Apply suggestions from code review

Add to exclude `Gemfile`, apply pattern to include shared gems as well.
2023-02-13 19:55:43 +05:00
João Duarte
fb8cfb2f1d
set rpm_digest to sha256 instead of default md5 (#14864)
this allows FIPS enabled Operating Systems to validate the RPM package
2023-02-02 15:37:57 +00:00
Andrea Selva
720996fa7c
Cover all #system invokation with exit code checking, eventually failing the execution of Rake task (#14782)
Covers all invocations of system Ruby method inside artifcts.rake script to check the exit status and eventually raise an exception.
2022-11-30 16:02:27 +01:00
Andres Rodriguez
86a18e6e3f
Exclude jruby's bundler from artifacts (#14667)
Exclude Jruby's bundler and rake from the built artifacts. The artifacts don't need to ship with such dependencies. Also, Logstash will bundle its own bundler for plugin management but it is not the one shipped with jruby.

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2022-10-18 11:13:02 -04:00
Andrea Selva
89c45d6d80
Change deb/rpm specification to describe as replacement of noarch old Logstash packages (#14346) 2022-09-06 18:56:33 +02: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
João Duarte
ae4a64d9ae
introduce logstash-integration-aws (#14369)
The logstash-integration-aws plugin replaces the underlying individual plugins related to AWS.

This commit also updates the necessary files around license checking.
2022-07-26 10:50:58 +01:00
Rob Bavey
422dfa7a26
Add darwin to aarch64 builds (#13425) 2022-07-22 15:55:17 -04:00
kaisecheng
dfb109843d
Support ironbank docker build (#14298)
This commit adds a rake task `rake artifact:dockerfile_ironbank` to generate ironbank docker build context for automatic release.
The output can be found in build/logstash-ironbank-$VERSION-docker-build-context.tar.gz

Co-authored-by: Rob Bavey <rob.bavey@elastic.co>
2022-06-28 10:29:55 +01: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
Andres Rodriguez
c5ede67fc3
Removal of sys-v init.d scripts (#13922)
Removes the installation of sys-v init.d scripts from .deb and .rpms.

All supported operating systems use systemd as the init system, as such, it is no longer necessary to continue to ship Sys-v Init.d scripts.
2022-03-30 11:26:56 -04:00
João Duarte
1195b38422
fix default argument handling in rake artifact task (#13904)
Ruby allows methods to have default values in arguments if they're not
passed. However if a nil is passed then the default value isn't used.

The artifact:archives tasks were passing nil values to the exclusion
argument, causing all files to be included in the package.

This commit cleans the naming of the path lists and ensures the default
exclusion list is always used.
2022-03-18 10:46:20 +00: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
Andres Rodriguez
38fbe5aa0f
Remove pleaserun (via bin/system-install) usage (#12415)
This change removes the usage of 'pleaserun', which
was leveraged create the init.d scripts or systemd units.

Now, we ship init.d scripts and systemd units to make
the maintenance easier and following the lead of the
other Elastic projects.

Fixes: #10519, Fixes: #12439, Fixes: #8253
2022-03-10 12:11:41 -05:00
João Duarte
edfbabf2fc
speed up artifact file listing (#13862)
currently the artifact tasks compute the file listing from a list of
include regexes and exclude regexes. However this is done by hand,
taking each include regex and running it through each exclude regex.

This is quite slow as we add more exclude regexes. This PR changes to
totally relying on Rake::FileList, by feeding it the include and exclude
lists. This speeds up file listing from 150 seconds to 1 second.
2022-03-07 18:18:07 +00:00
Ry Biesemeyer
0369ba208d
artifacts: omit openssl_pkcs8_pure specs from built artifacts (#13715)
* artifacts: omit openssl_pkcs8_pure specs from built artifacts

* Exclude _all_ top-level spec and test directories from built artifacts

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2022-03-04 10:55:31 -08:00
Karol Bucek
c3d2f5750f
Build: avoid doing a redundant bundle install (#13820) 2022-03-01 15:52:26 +01:00
Karol Bucek
e1da2d651d
Build: update .lock.release with rake version:set (#13477) 2022-01-20 06:49:06 +01:00
Ry Biesemeyer
5992e5713f
artifacts: exclude unused rubyzip test files from distributions (#13431) 2021-11-29 08:41:32 -08:00
Karol Bucek
09c3bf744e
Docs: keep elastic_app_search output meta-data (#13048) 2021-07-07 07:05:00 +02:00
kaisecheng
5a209ba830
Add geoip database metrics to /node/stats API (#13004)
This PR adds geoip database status, last update timestamp, download stats counter to Node Stats API
2021-06-23 17:35:15 +02:00
João Duarte
7390b64a93
update fpm to allow pkg creation on jdk11+jruby 9.2 (#13005)
* fpm to 1.13.0 which allows building packages with java 11 + jruby 9.2
* childprocess to 4.x + remove monkey patches
* clamp to 1.x to unlock fpm 1.13.0
2021-06-21 14:39:27 +01:00
Andrea Selva
d2c68fc0f9
Use the OS separator to invoke gradlew from Rake script (#13000)
Uses the OS defined path separator in Rake script to invoke the gradlew command. Without this the sh('./gradlew assemble') results in error when running .\gradlew clean installDefaultGems.
2021-06-21 10:23:11 +02:00
Andrea Selva
3eaff3612d
Fix acceptance test when run artifact:all (#12975)
This commit avoid to check for existence of jar files to decide if run or not Gradle assemble,
basically because the outputs of assemble task are not only jars but also others files, for example plugin-aliases.yml.
In this way the decision to execute or not is left the Gradle logic.
2021-06-10 10:31:39 +02:00
Andrea Selva
8e62e8a01c
Fix dependency on plugin_alias.yml during rake artifacts:all (#12962)
The module LogStash::PluginManager requires the file `lib/pluginmanager/plugin_aliases.yml` is created,
which happend during the Gradle's 'copyPluginAlias' executed as part of Rake's 'bootstrap'.
2021-06-04 12:37:56 +02:00
Rob Bavey
a935261eeb
Add logstash-integration-elastic_enterprise_search to plugins-metadata.json (#12925)
* Add logstash-integration-elastic_enterprise_search to plugins-metadata.json
* Remove old elastic_app_search plugin and set integration as default
* Add license information for workplace search gem
2021-05-25 17:37:39 -04:00
Karol Bucek
cc615da80c
Build: avoid leaking memory from generate_plugins_version (#12763) 2021-03-24 17:58:14 +01:00
kaisecheng
54b370ea48
Geoip database service (#12675)
geoip database service in xpack
dependency update and license note

Fixed: #12560
2021-02-18 14:18:28 +01:00
Rob Bavey
5ee83e8cc7
Fix docker image metadata (#12447)
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.
2020-11-18 12:29:37 -05:00
andsel
c9309675a9 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 00:24:13 -07:00
Rob Bavey
5c7d5ac8c0 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-23 08:18:31 -07:00
Rob Bavey
1c675aa74b 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 07:35:49 -07:00
Rob Bavey
2d1e6d968f
Introduce integration tests for docker images (#12135)
* Introduce integration tests for docker

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-07-31 14:34:40 -04:00
Joao Duarte
34f7151411 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 07:48:05 -07:00