Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Fix for Issue #56 #57

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ruby-tools/cli/jenkins.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
require "jenkins/version"

Gem::Specification.new do |s|
s.name = "jenkins"
s.name = "jenkins-maestrodev"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to remove this for the PR?

s.version = Jenkins::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Charles Lowell", "Nic Williams"]
Expand Down
24 changes: 22 additions & 2 deletions ruby-tools/cli/lib/jenkins/job_config_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Jenkins
class JobConfigBuilder
attr_accessor :job_type
attr_accessor :steps, :rubies
attr_accessor :steps, :rubies, :user_axes
attr_accessor :triggers
attr_accessor :publishers
attr_accessor :log_rotate
Expand Down Expand Up @@ -121,9 +121,17 @@ def build_scm(b)
end

def matrix_project?
!(rubies.blank? && node_labels.blank?)
!(rubies.blank? && node_labels.blank? && user_axes.blank?)
end

#<hudson.matrix.TextAxis>
# <name>user_defined_axis</name>
# <values>
# <string>custom_value_1</string>
# <string>custom_value_2</string>
# <string>custom_value_3</string>
# </values>
# </hudson.matrix.TextAxis>
# <hudson.matrix.TextAxis>
# <name>RUBY_VERSION</name>
# <values>
Expand All @@ -142,6 +150,18 @@ def matrix_project?
# </hudson.matrix.LabelAxis>
def build_axes(b)
b.axes do
unless user_axes.blank?
user_axes.each do |axis|
b.tag! "hudson.matrix.TextAxis" do
b.name axis[:name]
b.values do
axis[:values].each do |value|
b.string value
end
end
end
end
end
unless rubies.blank?
b.tag! "hudson.matrix.TextAxis" do
b.name "RUBY_VERSION"
Expand Down
2 changes: 1 addition & 1 deletion ruby-tools/cli/lib/jenkins/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Jenkins
VERSION = "0.6.8"
VERSION = "0.6.9"
end
69 changes: 69 additions & 0 deletions ruby-tools/cli/spec/fixtures/ruby.user-defined-axis.config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<matrix-project>
<actions/>
<description/>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.plugins.git.GitSCM">
<configVersion>1</configVersion>
<remoteRepositories>
<org.spearce.jgit.transport.RemoteConfig>
<string>origin</string>
<int>5</int>
<string>fetch</string>
<string>+refs/heads/*:refs/remotes/origin/*</string>
<string>receivepack</string>
<string>git-upload-pack</string>
<string>uploadpack</string>
<string>git-upload-pack</string>
<string>url</string>
<string>http://github.com/drnic/picasa_plucker.git</string>
<string>tagopt</string>
<string/>
</org.spearce.jgit.transport.RemoteConfig>
</remoteRepositories>
<branches>
<hudson.plugins.git.BranchSpec>
<name>master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<localBranch/>
<mergeOptions/>
<recursiveSubmodules>false</recursiveSubmodules>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<authorOrCommitter>false</authorOrCommitter>
<clean>false</clean>
<wipeOutWorkspace>false</wipeOutWorkspace>
<buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
<gitTool>Default</gitTool>
<submoduleCfg class="list"/>
<relativeTargetDir/>
<excludedRegions/>
<excludedUsers/>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<axes>
<hudson.matrix.TextAxis>
<name>user_defined_axis</name>
<values>
<string>custom_value_1</string>
<string>custom_value_2</string>
</values>
</hudson.matrix.TextAxis>
</axes>
<builders>
<hudson.tasks.Shell>
<command>bundle install</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>bundle exec rake</command>
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers/>
<runSequentially>false</runSequentially>
</matrix-project>
11 changes: 11 additions & 0 deletions ruby-tools/cli/spec/job_config_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@
config_xml("ruby", "multi-ruby-multi-labels").should == @config.to_xml
end
end

describe "user-defined axes" do

it "have user-defined axes" do
@config = Jenkins::JobConfigBuilder.new(:ruby) do |c|
c.scm = "http://github.com/drnic/picasa_plucker.git"
c.user_axes =[ { :name => 'user_defined_axis', :values => ["custom_value_1", "custom_value_2"] } ]
end
config_xml("ruby", "user-defined-axis").should == @config.to_xml
end
end

describe "assigned slave nodes for slave usage" do
before do
Expand Down