Commit graph

320 commits

Author SHA1 Message Date
Andrea Selva
12c22f7c2c
Backport PR #14782 to 7.17: Cover all #system invokation with exit code checking, eventually failing the execution of Rake task #14799
Covers all invocations of system Ruby method inside artifcts.rake script to check the exit status and eventually raise an exception.
2022-12-01 15:44:24 +01:00
github-actions[bot]
7f9b477bad
Support ironbank docker build (#14298) (#14306)
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>
(cherry picked from commit dfb109843d)

Co-authored-by: kaisecheng <69120390+kaisecheng@users.noreply.github.com>
2022-06-28 19:14:05 +01:00
João Duarte
898da5f41b 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 11:47:33 +00:00
João Duarte
f0fa13d188
speed up artifact file listing (#13862) (#13865)
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.

(cherry picked from commit edfbabf2fc)
2022-03-07 18:58:40 +00:00
Ry Biesemeyer
6fe6bc1054
Backport PR #13715 to 7.17: artifacts: omit openssl_pkcs8_pure specs from built artifacts (#13852)
* 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>
(cherry picked from commit 0369ba208d)

* Update releasenotes.asciidoc (#13701)

Fixed OS name. Ubuntu instead of Ununtu.

Co-authored-by: Cris da Rocha <cdarocha.astro@gmail.com>
2022-03-04 17:33:49 -08:00
Karol Bucek
4f6419fd1c
Build: avoid doing a redundant bundle install (#13820) (#13824)
(cherry picked from commit c3d2f5750f)
2022-03-01 17:41:20 +01:00
Rob Bavey
adb149c66d
Remove dependency:bundler task (#13146)
Already done on master in #12017, this is unnecessary as it is already being done
by installBundler.
2021-08-18 11:17:36 -04:00
Rob Bavey
cc06c5d8f5
Backport PR #13005 to 7.x: update fpm to allow pkg creation on jdk11+jruby 9.2 (#13005) (#13144)
Backport PR #13005 to 7.x branch. Original Message:

* 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

(cherry picked from commit 7390b64)

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2021-08-17 18:21:42 -04:00
Karol Bucek
49c04d7e5f
Docs: keep elastic_app_search output meta-data (#13048) (#13054) 2021-07-07 09:08:00 +02:00
kaisecheng
5616462233
Add geoip database metrics to /node/stats API (#13004) (#13020)
This PR adds geoip database status, last update timestamp, download stats counter to Node Stats API
2021-06-23 19:57:25 +02:00
Andrea Selva
75d616eba7
Use the OS separator to invoke gradlew from Rake script (#13000) (#13006)
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.

(cherry picked from commit d2c68fc0f9)
2021-06-21 12:06:38 +02:00
Andrea Selva
adcb0da91e
Fix acceptance test when run artifact:all (#12975) (#12996)
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.

(cherry picked from commit 3eaff3612d)
2021-06-17 11:50:38 +02:00
Andrea Selva
adb7f678ef
Backport PR #12962 Fix dependency on plugin_alias.yml during rake artifacts:all (#12963)
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'.

(cherry picked from commit 8e62e8a01c)
2021-06-04 14:45:21 +02:00
Rob Bavey
f0ba6ea5c3
Backport PR #12925 to 7.x: Add logstash-integration-elastic_enterprise_search to plugins-metadata.json (#12934)
Backport PR #12925 to 7.x. Original Message:

* 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

(cherry picked from commit a935261eeb)
2021-05-27 09:40:19 -04:00
kaisecheng
965c839e74
[7.x] Geoip database service (#12675) | GeoIP clean up database after new download (#12689) | fix broken test case of term of service (#12715) | change domain and endpoint of GeoIP database service (#12727) | GeoIP database add license file (#12777)
GeoIP database service license change

Fixed: #12560
2021-03-26 10:23:37 +01:00
Karol Bucek
d8055b8311
Build: avoid leaking memory from generate_plugins_version (#12763) (#12772)
(cherry picked from commit cc615da80c)
2021-03-24 20:13:30 +01: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
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
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
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
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
Rob Bavey
b846a0fdb8 Removes UBI7 docker code
Removal of code (#11335) to generate UBI7 based docker images, as this is not
being used for now

Fixes #11489
2020-01-14 14:04:54 +00:00
Rob Bavey
f06c5ef806 Replace references to JDBC plugins with integration plugins
Fixes #11406
2020-01-10 19:07:54 +00:00
Joao Duarte
d9cd2bdce2 setup jruby and bundler/rake before artifact rake tasks
Fixes #11392
2019-12-04 19:36:24 +00:00
Rob Bavey
bd66db544a Add UBI based docker images
This commit adds support for images based on UBI7 base image

Closes #11265

Fixes #11335
2019-12-03 13:51:49 +00:00
Joao Duarte
6842aba9eb stop installing rake and json on every bootstrap
Fixes #11102
2019-12-02 14:59:43 +00:00
Ry Biesemeyer
fc5d39c682 docgen: add integration plugins for plugin discovery
Fixes #11315
2019-11-20 22:02:59 +00:00
Ry Biesemeyer
5aa8c70683 docgen: no-op refactor bringing plugin types list out of regexp
Fixes #11315
2019-11-20 22:02:59 +00:00
Ry Biesemeyer
1cf8a7b8d4 plugins: replace kafka input/output with integration
Fixes #11218
2019-10-16 01:46:49 +00:00
Ry Biesemeyer
5a8cef4e8f plugins: replace rabbitmq input/output with integration
Fixes #11218
2019-10-16 01:46:49 +00:00
Ry Biesemeyer
96dfeb5016 add tasks for generating config parsers
Fixes #11195
2019-10-15 16:54:48 +00:00
Joao Duarte
8d19b5f078 handling missing gems during generatePluginsVersion
Fixes #11207
2019-10-10 13:28:17 +00:00
Colin Surprenant
2f8be2caea
[7.x clean backport of #10934] logstash-input-twitter as a default plugin (#10953) 2019-07-12 16:52:16 -04:00
Joao Duarte
534c267622 Cleanup gradle tasks and dependency installation
- have `bootstrap` task do as little as possible: install gems in Gemfile.template that don't belong to groups
- have test tasks depend on the `installTestGems` task instead of `bootstrap`
- logstash es output is now a dependency because of license checking
- fix out of memory problem in SharedHelpers.trap

Also use release lockfile during installDefaultGems

The release lockfile is only copied to Gemfile.lock if
it doesn't exist. During the `installDefaultGems` task other
plugin installation tasks already occurred, generating a lock file.

This commit removes it before running the plugin installation.

Fixes #10942
2019-07-12 08:11:28 +00:00
Karen Metts
ec07b43a53 Add java example plugins to skiplist
Fixes #10921
2019-06-28 16:15:15 +00:00
Joao Duarte
beb0a337f9 remove gcs output from skip list
Fixes #10919
2019-06-27 11:17:22 +00:00
Rob Bavey
48c581b6fd Add Logstash JMS input to the list of default plugins
Fixes #10865
2019-06-17 18:50:21 +00:00
Joao Duarte
3d84827174 name rpm/deb oss packages as logstash-oss
Fixes #10833
2019-05-29 14:25:21 +00:00
Joao Duarte
bd11485e0b fix plugin doc version generation with default plugins
now that default plugins are read only from the json metadata file and
not from the lock file, the plugin version manifesto needs to be adapted
so the status of "default" plugin is read from the json file.

Fixes #10824
2019-05-27 19:43:46 +00:00
Joao Duarte
d03f0ea454 allow skipping docker artifacts during artifact:all
Fixes #10823
2019-05-27 13:57:07 +00:00
Joao Duarte
089f369033 generate tarballs for docker images
Fixes #10819
2019-05-24 15:09:27 +00:00
Joao Duarte
71d7b7c1fb
rake task to generate dockerfile
* dont include docker tasks in artifact:all
* don't rebuild tar/zip if source hasn't changed
* allow SKIP_PREPARE to avoid tar creation if no modifications
* don't need a tarball to generate the dockerfile
* remove docker tests as they weren't working anymore

This commit adds a task to produce all necessary files to generate a docker image.

```
% RELEASE=1 rake artifact:dockerfile
....
Dockerfile created in /tmp/elastic/logstash/build/docker
% tree /tmp/elastic/logstash/build/docker
/tmp/elastic/logstash/build/docker
├── Dockerfile
├── bin
│   └── docker-entrypoint
├── config
│   ├── log4j2.properties
│   ├── logstash-full.yml
│   └── pipelines.yml
├── env2yaml
│   └── env2yaml
└── pipeline
    └── default.conf
% docker build --rm .
.....
Step 19/20 : LABEL org.label-schema.schema-version="1.0"   org.label-schema.vendor="Elastic"   org.label-schema.name="logstash"   org.label-schema.version="7.0.0"   org.label-schema.url="https://www.elastic.co/products/logstash"   org.label-schema.vcs-url="https://github.com/elastic/logstash" license="Elastic License"
 ---> Using cache
 ---> f622d7555220
Step 20/20 : ENTRYPOINT ["/usr/local/bin/docker-entrypoint"]
 ---> Using cache
 ---> b6feba7f4934
Successfully built b6feba7f4934
```

This task works only for releases (not snapshots).

This commit also adds a few tweaks to the artifacts building:

Using `SKIP_PREPARE=1` in `rake artifact:tar` or `rake artifact:tar_oss` will make a check to not rebuild the tarball if there are no code modifications.

These two changes are made since docker image build is new and we want to keep it out of artifact:all for a while. And if we're running these separately, we want to ensure the tarball built is used in the docker image (versus building a new one for each `rake artifact:tar` )

This means that, to generate all artifacts including docker images and dockerfile, it's necessary to run:

```
RELEASE=1 rake artifact:all
SKIP_PREPARE=1 RELEASE=1 rake artifact:docker
SKIP_PREPARE=1 RELEASE=1 rake artifact:docker_oss
RELEASE=1 rake artifact:dockerfile
```
2019-04-22 22:57:55 +01:00
Joao Duarte
86cae08547 updated bundler to 1.17.3
Fixes #10685
2019-04-12 21:07:54 +00:00
Joao Duarte
6ed7b4bc5c disable docker img generation on artifact:all
Fixes #10647
2019-04-04 15:19:26 +00:00
João Duarte
0921798a71
build docker images from logstash repo (#10603)
introduces two rake tasks: `rake artifact:docker_oss` and `rake artifact:docker`, which will create the docker images of the OSS and non OSS packages. These tasks depend on the tar artifacts being built.

Also `rake artifact:all` has been modified to also call these two tasks.

most code was moved from https://github.com/elastic/logstash-docker/
2019-04-04 11:27:31 +01:00
Joao Duarte
2543539910 cleanup many rakelib tasks that aren't used anymore
* simplify the plugins-metadata.json file
* sort and update the plugin list in the rakelib/plugins-metadata.json
* remove dependency on twitter input for testing
* sorted Gemfile.template (grouped by group)
* remove default plugins from Gemfile.template

Fixes #10509
2019-03-15 16:26:58 +00:00
Joao Duarte
2910faa57f fix building of deb and rpm
fpm requires json 1.x but the artifact rake tasks
will activate the default gem json 2

This PR ensures json 1 is activated early and is present right after
jruby is bootstrapped.

Also downgrades fpm to 1.3 as 1.11.0 wasn't building correctly

Downgrades .ruby-version to a version we have available in CI

Fixes #10396
2019-02-06 09:39:55 +00:00
Ry Biesemeyer
583ec6b625
Java 11 support (#10279)
* bump jruby to 9.2

* don't rely on logstash-base docker image

* work around webmock ruby 2.5 support

* ensure data folder exists in docker

* change fixnum and bignum to integer

* FileUtils.rmdir to rm_rf

this is because from 2.3 to 2.5 FileUtils.rmdir will throw an exception
if the directory isn't empty. On 2.3 the operation will just not delete
the directory silently.

* bump jruby to 9.2.5.0 and fix test

* make rake default task since prepare pack needs it

* Resolve compiler warnings (#10247)

There are 3 types of compiler warnings that are either resolved or suppressed:

1. Rawtypes: In JRuby 9.2, `RubyArray` is a generic, so references throughout
   our codebase to the now "raw" type trigger warnings. In most cases we cannot
   actually resolve the issue, since the JRuby-provided methods for creating
   `RubyArray`s still return the raw type, so these have been suppressed.

2. Deprecations:
   - `RubyString#intern19()` -> `RubyString#intern()`
   - `RubyString#downcase19(ThreadContext)` -> `RubyString#downcase(ThreadContext)`
   - `NativeException`: remove import & reference directly; suppress usage
     warnings
   - `RaiseException()`: migrate to equivalent non-deprecated methods wherever
     possible; in some cases where we are using this in conjunction with the
     also-deprecated `NativeException` to preserve java stacktraces, there
     seems to be no non-deprecated path forward, so these cases have been
     suppressed.

3. Redundant Casts
   - Resolved

* JRuby 9.2 bundler shenanigans (#10266)

* Revert "Revert "remove forced dependency on old bundler (#9395)""

This reverts commit bef984143d.

* plugin management: update internal bundler to 1.17.x APIs

* deps: update dev dependency webmock to version compatible with JRuby 9.2

* spec: update Pack fixture to include manticore version that doesn't conflict

* build: update gradle to version that has Java 11 support

* java11: resolve or suppress deprecation warnings

* Remove superfluous flag opting into ParNew GC implementation

When opting into CMS garbage collector with `XX:+UseConcMarkSweepGC`, the
young generation collector ParNew has been the default since Java 8, making
the `XX:+UseParNew` flag redundant; the flag was removed in Java 9, and
should no longer be specified to work with modern Javas.

https://bugs.openjdk.java.net/browse/JDK-8006478
https://openjdk.java.net/jeps/214

* spec: set thread name to example description for easier debugging

* spec: prevent errors in testing specs by checking against skip list before using

* no-op: remove use of `HashMap#computeIfAbsent` on single-threaded code

> This method will, on a best-effort basis, throw a `ConcurrentModificationException`
> if it is detected that the mapping function modifies this map during computation.
>
> -- https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/HashMap.html#computeIfAbsent(K,java.util.function.Function)

* qa: by default, run integration against Elastic Stack 6.5.x

To support development on Logstash on top of Java 11, default to testing
against an Elastic Stack that is capable of running on Java 11.

* qa: ignore deprecation warnings when comparing offline pack output

* qa: add Java 9+ support to ChildProcess dev dependency

this can safely be removed when the childprocess gem supports Java9+
https://github.com/enkessler/childprocess/pull/141

* qa: allow connections to localhost in webmock

* bump jrjackson version

* fix filebeat integration tests

* spec: ensure license compliance spec runs first

The license compliance spec that validates the licenses of bundled
plugins appears to not be compatible with the hooks that we inject
into bundler for plugin management, and will fail in obscure ways
when run after those hooks have been added. Since those hooks are
not necessary for validating licenses, the easiest solution was to
ensure that those specs run first, before the VM has been poluted.

Since the gradle/junit/rspec bridge that is currently in place
runs all specs in the same JVM, we also need to make sure that the
rspec "world" is reset before a run, to ensure that it doesn't
retain spec definitions from previous runs.

Also updates the rake invocation, although I'm not sure it is used
any more.
2019-02-04 16:36:11 -08:00