mirror of
https://github.com/elastic/logstash.git
synced 2025-04-25 07:07:54 -04:00
Add jenkins job creator
This commit is contained in:
parent
cde71f9c76
commit
0581bb278e
2 changed files with 93 additions and 0 deletions
70
test/jenkins/config.xml.erb
Normal file
70
test/jenkins/config.xml.erb
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<project>
|
||||||
|
<actions/>
|
||||||
|
<description></description>
|
||||||
|
<keepDependencies>false</keepDependencies>
|
||||||
|
<properties/>
|
||||||
|
<scm class="hudson.plugins.git.GitSCM" plugin="git@1.1.25">
|
||||||
|
<configVersion>2</configVersion>
|
||||||
|
<userRemoteConfigs>
|
||||||
|
<hudson.plugins.git.UserRemoteConfig>
|
||||||
|
<name></name>
|
||||||
|
<refspec></refspec>
|
||||||
|
<url>https://github.com/logstash/logstash.git</url>
|
||||||
|
</hudson.plugins.git.UserRemoteConfig>
|
||||||
|
</userRemoteConfigs>
|
||||||
|
<branches>
|
||||||
|
<hudson.plugins.git.BranchSpec>
|
||||||
|
<name>master</name>
|
||||||
|
</hudson.plugins.git.BranchSpec>
|
||||||
|
</branches>
|
||||||
|
<disableSubmodules>false</disableSubmodules>
|
||||||
|
<recursiveSubmodules>false</recursiveSubmodules>
|
||||||
|
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||||
|
<authorOrCommitter>false</authorOrCommitter>
|
||||||
|
<clean>false</clean>
|
||||||
|
<wipeOutWorkspace>false</wipeOutWorkspace>
|
||||||
|
<pruneBranches>false</pruneBranches>
|
||||||
|
<remotePoll>false</remotePoll>
|
||||||
|
<ignoreNotifyCommit>false</ignoreNotifyCommit>
|
||||||
|
<useShallowClone>false</useShallowClone>
|
||||||
|
<buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
|
||||||
|
<gitTool>Default</gitTool>
|
||||||
|
<submoduleCfg class="list"/>
|
||||||
|
<relativeTargetDir></relativeTargetDir>
|
||||||
|
<reference></reference>
|
||||||
|
<excludedRegions></excludedRegions>
|
||||||
|
<excludedUsers></excludedUsers>
|
||||||
|
<gitConfigName></gitConfigName>
|
||||||
|
<gitConfigEmail></gitConfigEmail>
|
||||||
|
<skipTag>false</skipTag>
|
||||||
|
<includedRegions></includedRegions>
|
||||||
|
<scmName></scmName>
|
||||||
|
</scm>
|
||||||
|
<canRoam>true</canRoam>
|
||||||
|
<disabled>false</disabled>
|
||||||
|
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
||||||
|
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
||||||
|
<triggers class="vector"/>
|
||||||
|
<concurrentBuild>false</concurrentBuild>
|
||||||
|
<builders>
|
||||||
|
<hudson.tasks.Shell>
|
||||||
|
<command>export JRUBY_OPTS=--1.9
|
||||||
|
|
||||||
|
bundle install
|
||||||
|
bundle exec rspec spec/<%= plugin_path %>
|
||||||
|
</command>
|
||||||
|
</hudson.tasks.Shell>
|
||||||
|
</builders>
|
||||||
|
<publishers/>
|
||||||
|
<buildWrappers>
|
||||||
|
<ruby-proxy-object>
|
||||||
|
<ruby-object ruby-class="Jenkins::Plugin::Proxies::BuildWrapper" pluginid="rvm">
|
||||||
|
<pluginid pluginid="rvm" ruby-class="String">rvm</pluginid>
|
||||||
|
<object ruby-class="RvmWrapper" pluginid="rvm">
|
||||||
|
<impl pluginid="rvm" ruby-class="String">1.6.8@logstash</impl>
|
||||||
|
</object>
|
||||||
|
</ruby-object>
|
||||||
|
</ruby-proxy-object>
|
||||||
|
</buildWrappers>
|
||||||
|
</project>
|
23
test/jenkins/create-jobs.rb
Normal file
23
test/jenkins/create-jobs.rb
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require "erb"
|
||||||
|
|
||||||
|
if ENV["JENKINS_HOME"].nil?
|
||||||
|
puts "No JENKINS_HOME set."
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
plugindir = File.join(File.dirname(__FILE__), "..", "..", "lib", "logstash")
|
||||||
|
|
||||||
|
plugins = %w(inputs filters outputs).collect { |t| Dir.glob(File.join(plugindir, t, "*.rb")) }.flatten
|
||||||
|
|
||||||
|
template = ERB.new("config.xml.erb")
|
||||||
|
plugins.each do |path|
|
||||||
|
job = path.gsub(/.*\/([^\/]+)\/([^\/]+)\.rb$/, '\1-\2')
|
||||||
|
plugin_path = path.gsub(/.*\/([^\/]+)\/([^\/]+)\.rb$/, '\1/\2')
|
||||||
|
|
||||||
|
jobdir = File.join(ENV["JENKINS_HOME"], job)
|
||||||
|
puts "Writing #{jobdir}/config.xml"
|
||||||
|
Dir.mkdir(jobdir) if !Dir.exists?(jobdir)
|
||||||
|
File.write(File.join(jobdir, "config.xml"), template.result(binding))
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue