logstash/rakelib/plugin.rake
Joao Duarte fa0eeb579f add single command release task and other release support tooling
Purpose:

* manage releases through a minimum number of rake tasks
* simplify building of snapshot builds
* create staged artifacts, candidates for releases, that required no changes to become releases
* this means the snapshot release process will not involve publishing gems, therefore:
* the gem artifacts should only be published to rubygems as a final artifact, at the time of GA

Changes:

* release artifacts no longer depend on gems of core components
* all core components are used locally AS-IS to minimize code changes between snapshot, RC and GA
* `versions.yml` describes the versions of all logstash parts and package
  * `rake version:set[version]` manage the yaml file and push the changes to the gemspecs/version.rb files
  * `rake version:set_plugin_api[version]` manage the yaml file and push the changes to the gemspecs/version.rb files
  * `rake artifact:all` generates SNAPSHOT artifacts: tar.gz, zip, rpm, deb
  * `RELEASE=1 rake artifact:all` creates release candidate artifacts + 4 gems: logstash-core, logstash-core-event, logstash-core-event-java and logstash-core-plugin-api

implements #5416 and #5414

Fixes #5460
2016-06-21 12:29:18 +01:00

116 lines
3.6 KiB
Ruby

require_relative "default_plugins"
require 'rubygems'
namespace "plugin" do
def install_plugins(*args)
system("bin/logstash-plugin", "install", *args)
raise(RuntimeError, $!.to_s) unless $?.success?
end
task "install-development-dependencies" do
puts("[plugin:install-development-dependencies] Installing development dependencies of all installed plugins")
install_plugins("--development", "--preserve")
task.reenable # Allow this task to be run again
end
task "install", :name do |task, args|
name = args[:name]
puts("[plugin:install] Installing plugin: #{name}")
install_plugins("--no-verify", "--preserve", name)
task.reenable # Allow this task to be run again
end # task "install"
task "install-default" do
puts("[plugin:install-default] Installing default plugins")
install_plugins("--no-verify", "--preserve", *LogStash::RakeLib::DEFAULT_PLUGINS)
task.reenable # Allow this task to be run again
end
task "install-core" do
puts("[plugin:install-core] Installing core plugins")
install_plugins("--no-verify", "--preserve", *LogStash::RakeLib::CORE_SPECS_PLUGINS)
task.reenable # Allow this task to be run again
end
task "install-jar-dependencies" do
puts("[plugin:install-jar-dependencies] Installing jar_dependencies plugins for testing")
install_plugins("--no-verify", "--preserve", *LogStash::RakeLib::TEST_JAR_DEPENDENCIES_PLUGINS)
task.reenable # Allow this task to be run again
end
task "install-vendor" do
puts("[plugin:install-jar-dependencies] Installing vendor plugins for testing")
install_plugins("--no-verify", "--preserve", *LogStash::RakeLib::TEST_VENDOR_PLUGINS)
task.reenable # Allow this task to be run again
end
task "install-all" do
puts("[plugin:install-all] Installing all plugins from https://github.com/logstash-plugins")
p = *LogStash::RakeLib.fetch_all_plugins
# Install plugin one by one, ignoring plugins that have issues. Otherwise, one bad plugin will
# blow up the entire install process.
# TODO Push this downstream to #install_plugins
p.each do |plugin|
begin
install_plugins("--no-verify", "--preserve", plugin)
rescue
puts "Unable to install #{plugin}. Skipping"
next
end
end
task.reenable # Allow this task to be run again
end
task "clean-local-core-gem", [:name, :path] do |task, args|
name = args[:name]
path = args[:path]
Dir[File.join(path, "#{name}*.gem")].each do |gem|
puts("[plugin:clean-local-core-gem] Cleaning #{gem}")
rm(gem)
end
task.reenable # Allow this task to be run again
end
task "build-local-core-gem", [:name, :path] => ["build/gems"] do |task, args|
name = args[:name]
path = args[:path]
Rake::Task["plugin:clean-local-core-gem"].invoke(name, path)
puts("[plugin:build-local-core-gem] Building #{File.join(path, name)}.gemspec")
gem_path = nil
Dir.chdir(path) do
spec = Gem::Specification.load("#{name}.gemspec")
gem_path = Gem::Package.build(spec)
end
FileUtils.cp(File.join(path, gem_path), "build/gems/")
task.reenable # Allow this task to be run again
end
task "install-local-core-gem", [:name, :path] do |task, args|
name = args[:name]
path = args[:path]
Rake::Task["plugin:build-local-core-gem"].invoke(name, path)
gems = Dir[File.join(path, "#{name}*.gem")]
abort("ERROR: #{name} gem not found in #{path}") if gems.size != 1
puts("[plugin:install-local-core-gem] Installing #{gems.first}")
install_plugins("--no-verify", gems.first)
task.reenable # Allow this task to be run again
end
end # namespace "plugin"