-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add darwin/osx support to slave class #351
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
shared_context 'a jenkins::slave catalog' do | ||
it { should contain_exec('get_swarm_client') } | ||
it { should contain_file('/etc/init.d/jenkins-slave') } | ||
it { should contain_file(slave_service_file) } | ||
it { should contain_service('jenkins-slave').with(:enable => true, :ensure => 'running') } | ||
it { should contain_user('jenkins-slave_user').with_uid(nil) } | ||
# Let the different platform blocks define `slave_runtime_file` separately below | ||
|
@@ -44,9 +44,9 @@ | |
end | ||
|
||
describe 'RedHat' do | ||
let(:facts) { { :osfamily => 'RedHat', :operatingsystem => 'CentOS' } } | ||
let(:facts) { { :osfamily => 'RedHat', :operatingsystem => 'CentOS', :kernel => 'Linux' } } | ||
let(:slave_runtime_file) { '/etc/sysconfig/jenkins-slave' } | ||
|
||
let(:slave_service_file) { '/etc/init.d/jenkins-slave' } | ||
it_behaves_like 'a jenkins::slave catalog' | ||
|
||
describe 'with slave_name' do | ||
|
@@ -56,8 +56,9 @@ | |
end | ||
|
||
describe 'Debian' do | ||
let(:facts) { { :osfamily => 'Debian', :lsbdistid => 'debian', :lsbdistcodename => 'natty', :operatingsystem => 'Debian' } } | ||
let(:facts) { { :osfamily => 'Debian', :lsbdistid => 'debian', :lsbdistcodename => 'natty', :operatingsystem => 'Debian', :kernel => 'Linux' } } | ||
let(:slave_runtime_file) { '/etc/default/jenkins-slave' } | ||
let(:slave_service_file) { '/etc/init.d/jenkins-slave' } | ||
|
||
it_behaves_like 'a jenkins::slave catalog' | ||
|
||
|
@@ -67,6 +68,19 @@ | |
end | ||
end | ||
|
||
# describe 'Darwin' do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any reason for these examples to be commented out? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still learning rspec, and can't figure out how to get the tests to ignore java install on darwin.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so the puppetlabs/java module doesn't support Darwin so I think part of why this is failing. |
||
# let(:facts) { { :osfamily => 'Darwin', :operatingsystem => 'Darwin', :kernel => 'Darwin' } } | ||
# let(:slave_runtime_file) { '/home/jenkins-slave/jenkins-slave' } | ||
# let(:slave_service_file) { '/Library/LaunchDaemons/org.jenkins-ci.slave.jnlp.plist' } | ||
# | ||
# it_behaves_like 'a jenkins::slave catalog' | ||
# | ||
# describe 'with slave_name' do | ||
# let(:params) { { :slave_name => 'jenkins-slave' } } | ||
# it_behaves_like 'using slave_name' | ||
# end | ||
# end | ||
|
||
describe 'Unknown' do | ||
let(:facts) { { :ostype => 'Unknown' } } | ||
it { expect { should raise_error(Puppet::Error) } } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-/Apple/DTD PLIST 1.0/EN" "http:/www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>org.jenkins-ci.slave.jnlp</string> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string><%= @slave_home %>/start-slave.sh</string> | ||
</array> | ||
<key>KeepAlive</key> | ||
<true/> | ||
<key>RunAtLoad</key> | ||
<true/> | ||
<key>UserName</key> | ||
<string><%= @slave_user %></string> | ||
<key>WorkingDirectory</key> | ||
<string><%= @slave_home %></string> | ||
<key>SessionCreate</key> | ||
<true/> | ||
<key>StandardInPath</key> | ||
<string>/dev/null</string> | ||
<key>StandardErrorPath</key> | ||
<string>/var/log/jenkins/org.jenkins-ci.slave.jnlp.log</string> | ||
<key>StandardOutPath</key> | ||
<string>/var/log/jenkins/org.jenkins-ci.slave.jnlp.log</string> | ||
</dict> | ||
</plist> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
source <%= @defaults_location %>/jenkins-slave | ||
java -jar <%= @slave_home %>/<%= @client_jar %> $JENKINS_SLAVE_ARGS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case statement smells a bit to me, would it be possible to refactor this into a
jenkins::slave::linux
and ajenkins::slave::darwin
module which would then be included depending on the kernel?