Commit graph

115 commits

Author SHA1 Message Date
Rob Bavey
d706e50b27 [build] Ensure more gradle tasks using task avoidance API
Release Manager builds were failing as `downloadEs` task was being
needlessly run during `rake artifact:all` task. When run with
`RELEASE=1`. this was causing build failures due to the non-availability
of Elasticsearch release artifacts. This commit aims to avoid running
the `downloadES` task when it is not needed, continuing the work done
in #11914

This commit also removes code that was repeated in different parts of
the build script.
2020-07-13 13:39:00 -07:00
Rob Bavey
0f5cdaee00 [build] Fix gradle typo
Inadvertent extra character causes aarch64 builds to fail.
2020-07-13 06:31:53 -07:00
Rob Bavey
5529998a85 Tests: Add support for alternative architectures
Enable filebeat and elasticsearch downloads to pull different
architectures, Filebeat and Elasticsearch use different suffixes
to denote their aarch64 architectures, with beats using arm64 and
elasticsearch aarch64
2020-06-16 08:12:00 -07:00
Rob Bavey
8df9d2c045 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 06:32:16 -07:00
João Duarte
7df8a660ef
Drop dependency:bundler task (#12017)
This is already accomplished by the gradle task "installBundler".

Also make bundler 2 install more generic to not be stuck with 2.1.4
2020-06-12 14:25:15 +01:00
João Duarte
d8b50deff3
update bundler to 2.x (#11994) 2020-06-12 10:17:02 +01:00
Rob Bavey
2b0ae1aac9
Retrieve branch version of Filebeat via gradle (#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-11 11:27:10 -04:00
Rob Bavey
ac95667c11
Use task avoidance API in gradle scripts (#11914)
* 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 10:25:52 -04:00
Rob Bavey
58314a7f0e
Update gradle version to 6.3 (#11742)
* 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-07 12:49:36 -04:00
Joao Duarte
53d4a78ce8 ensure mavencentral is always used before plugins.gradle.org
Fixes #11682
2020-03-12 12:04:54 +00:00
João Duarte
e9c9865f40
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:53:38 +00:00
Karol Bucek
27455f9dd5 Build: fix bundle bin path in bundler task
follow-up on d65f78728b

Fixes #11381
2019-12-03 10:37:51 +00:00
Joao Duarte
d65f78728b stop installing rake and json on every bootstrap
Fixes #11102
2019-12-02 14:59:43 +00:00
Ry Biesemeyer
8f471e3f68 add tasks for generating config parsers
Fixes #11195
2019-10-15 16:54:48 +00:00
João Duarte
15fb30823f
Cleanup gradle tasks and dependency installation (#10942)
- 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.
2019-07-12 09:11:07 +01:00
João Duarte
c657f90362
moved to openjdk 11 in docker testing (#10563)
- also fix javadoc warning when building on jdk11
2019-04-15 21:13:05 +01:00
Joao Duarte
2a40099718 updated bundler to 1.17.3
Fixes #10685
2019-04-12 21:07:54 +00:00
Colin Surprenant
a121ee4d42 download exact version artifact for release build otherwise download snapshot (#10664) 2019-04-11 22:23:48 +01:00
Dan Hermann
b8ce9d7aeb Move Gradle wrappers around Ruby operations to a separate file to facilitate sharing of common operations with Java plugins
Fixes #10642
2019-04-04 19:56:59 +00:00
Joao Duarte
0e115d31a6 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
Colin Surprenant
5ae5386d13
correctly handle unexecuted downloadEs task (#10555) 2019-03-13 17:56:26 -04:00
Colin Surprenant
dc7205a204 move download setup code inside the downloadEs task (#10547) 2019-03-12 16:01:16 -07:00
Joao Duarte
fe684f87fa factor in OS and architecture when downloading ES
- use artifacts api to fetch latest build
- use latest build info to find download url
- download package

Fixes #10422
2019-02-11 14:28:19 +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
Dan Hermann
e6d59de458
Update java dependencies (#10340) 2019-01-18 08:16:13 -06:00
Dan Hermann
76a1d0a664
Eliminate compiler and javadoc warnings (#10241) 2019-01-02 07:16:19 -06:00
João Duarte
bef984143d
Revert "remove forced dependency on old bundler (#9395)"
This reverts commit ab20b40e47.

Due to failing tests like https://logstash-ci.elastic.co/job/elastic+logstash+master+multijob--ruby-unit-tests/86/
2018-12-03 13:49:54 +00:00
João Duarte
ab20b40e47
remove forced dependency on old bundler (#9395)
* update bundler to 1.17.1

This commit required some tweaking of how we setup Bundler
due to changes in reset behaviour, an internal variable name change,
and the Bundler::Settings api changing.
2018-11-30 09:25:24 +00:00
Guy Boertje
1f7a369993
Add VERSION_QUALIFIER support for use by release manager (#10117)
* Add VERSION_QUALIFIER support for use by release manager

* Make the gem build processes aware of the version qualifier

* Try debugging xpack ci test failure.

* Try to use the artifacts-api.elastic.co api for ES download.

* It builds/tests locally now.

* add some comments explaining the artifacts-api and the version string

* cahnges requested in review.

Fixes #9956
2018-11-07 22:39:52 +00:00
Joao Duarte
f8af1762c5 create gradle task to generate plugin version manifesto
Fixes #9889
2018-08-10 16:45:16 +00:00
Joao Duarte
282ee06814 stop gradle from deleting NOTICE.TXT
Fixes #9888
2018-08-10 14:34:49 +00:00
Joao Duarte
6705ff0251 Update jruby artifact downloading
* download urls moved to maven
* tarball naming scheme has changed

Fixes #9806
2018-07-02 10:46:12 +00:00
Armin
f8860884fa JRUBY: install custom JRuby tar.gz
Fixes #9731
2018-06-14 12:28:39 +00:00
Armin
78dab87221 BUILD: Add Java wrapper for xpack integration tests
Fixes #9597
2018-05-20 14:50:08 +00:00
Andrew Cholakian
bf21f97eb3 Fix the license check CI task
This does a few small things:

1. Prefer invoking rake tasks via ./gradlew vs rake. This prevents Java from segfaulting on docker for unknown reasons
2. Remove use of COPYING.csv which has already been removed

Fixes #9583
2018-05-15 23:31:12 +00:00
Armin
8ebde04ae8 Load tests via JUnit
Fixes #9575
2018-05-15 16:15:39 +00:00
Andrew Cholakian
30e524e5ee Improved NOTICE.txt generation
Fixes #9530
2018-05-10 16:14:45 +00:00
Dan Hermann
48594baf2b Add license reporting task
Fixes #9331
2018-05-02 15:35:42 +00:00
Jenkins CI
93cad10da1 Migrate x-pack-logstash source to logstash 2018-04-24 10:46:15 -05:00
Armin
ebf50f750d BUILD: Fix inconsistent naming of output tar.gz
Fixes #9397
2018-04-18 13:16:24 +00:00
Armin
5ef2de9802 BUILD: Stop using Exec tasks for ITs
Fixes #9388
2018-04-17 14:02:55 +00:00
Armin
645c5c42cc MINOR+BUG: Clean doesn't delete gem jars for logstash-core
Fixes #9387
2018-04-17 11:53:52 +00:00
Andrew Cholakian
885134330d Hide proprietary tasks when OSS=true
Fixes #9238
2018-03-14 20:24:00 +00:00
Andrew Cholakian
126c054331 Add additional gradle tasks in anticipation of x-pack being opened
Fixes #9238
2018-03-14 20:23:59 +00:00
Andrew Cholakian
2ab6cbd3ce Add OSS variants of artifact rake tasks
These will omit the x-pack folder once it is merged in

Fixes #9223
2018-03-09 18:36:31 +00:00
Armin
c0bb875a30 BUILD: Fix wrong paths and wrong output declarations on installTestGems task
Fixes #9052
2018-01-29 14:27:54 +00:00
Armin
a5bac509d5 MINOR: Cleanup dead field and wrong ruby path in build.gradle
Fixes #9040
2018-01-29 09:55:03 +00:00
Colin Surprenant
2996062232 fix integration tests build 2018-01-24 10:26:56 -05:00
Armin
86bf8dbb37 BUILD: Run rake tasks in Gradle JVM
Fixes #8941
2018-01-17 11:57:16 +00:00