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
This commit is contained in:
Andrew Cholakian 2018-05-15 16:35:59 -05:00
parent 82cd7105e4
commit 8f03e82249
5 changed files with 26 additions and 8 deletions

View file

@ -35,8 +35,7 @@ RUN echo 'eval "$(rbenv init -)"' >> .bashrc && \
# Create a cache for the dependencies based on the current master, any dependencies not cached will be downloaded at runtime # Create a cache for the dependencies based on the current master, any dependencies not cached will be downloaded at runtime
RUN git clone https://github.com/elastic/logstash.git /tmp/logstash && \ RUN git clone https://github.com/elastic/logstash.git /tmp/logstash && \
cd /tmp/logstash && \ cd /tmp/logstash && \
rake test:install-core && \ ./gradlew bootstrap compileJava compileTestJava && \
./gradlew compileJava compileTestJava && \
cd qa/integration && \ cd qa/integration && \
/home/logstash/.rbenv/shims/bundle install && \ /home/logstash/.rbenv/shims/bundle install && \
mv /tmp/logstash/vendor /tmp/vendor && \ mv /tmp/logstash/vendor /tmp/vendor && \

View file

@ -149,6 +149,19 @@ task downloadAndInstallJRuby(dependsOn: verifyFile, type: Copy) {
into "${projectDir}/vendor/jruby" into "${projectDir}/vendor/jruby"
} }
task installDefaultGems(dependsOn: downloadAndInstallJRuby) {
inputs.files file("${projectDir}/Gemfile.template")
inputs.files fileTree("${projectDir}/rakelib")
inputs.files file("${projectDir}/versions.yml")
outputs.file("${projectDir}/Gemfile")
outputs.file("${projectDir}/Gemfile.lock")
outputs.dir("${projectDir}/logstash-core/lib/jars")
outputs.dir("${projectDir}/vendor/bundle/jruby/2.3.0")
doLast {
rubyGradleUtils.rake('plugin:install-default')
}
}
task installTestGems(dependsOn: downloadAndInstallJRuby) { task installTestGems(dependsOn: downloadAndInstallJRuby) {
inputs.files file("${projectDir}/Gemfile.template") inputs.files file("${projectDir}/Gemfile.template")
inputs.files fileTree("${projectDir}/rakelib") inputs.files fileTree("${projectDir}/rakelib")

View file

@ -1,7 +1,7 @@
#!/bin/bash -i #!/bin/bash -i
export GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.logging.level=info" export GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.logging.level=info"
rake plugin:install-default ./gradlew installDefaultGems
bin/dependencies-report --csv report.csv bin/dependencies-report --csv report.csv
# We want this to show on the CI server # We want this to show on the CI server
cat report.csv cat report.csv

View file

@ -20,11 +20,17 @@ class LogStash::DependencyReport < Clamp::Command
jars.each { |d| csv << d } jars.each { |d| csv << d }
end end
# Copy in COPYING.csv which is a best-effort, hand-maintained file of dependency license information. puts "Wrote temporary ruby deps CSV to #{ruby_output_path}"
File.open(output_path, "a+") do |file|
extra = File.join(File.dirname(__FILE__), "..", "..", "..", "COPYING.csv") # Use gradle to find the rest and add to the ruby CSV
file.write(IO.read(extra)) puts "Find gradle jar dependencies #{Dir.pwd}"
command = ["./gradlew", "generateLicenseReport", "-PlicenseReportInputCSV=#{ruby_output_path}", "-PlicenseReportOutputCSV=#{output_path}"]
puts "Executing #{command}"
system(*command)
if $?.exitstatus != 0
raise "Could not run gradle java deps! Exit status #{$?.exitstatus}"
end end
nil nil
end end

View file

@ -1,4 +1,4 @@
# encoding: utf-8 :# encoding utf-8
require "spec_helper" require "spec_helper"
require "logstash/plugin" require "logstash/plugin"
require "logstash/outputs/base" require "logstash/outputs/base"