jenkins 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +6 -0
- data/Changelog.md +40 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +58 -0
- data/README.md +154 -0
- data/Rakefile +82 -0
- data/bin/jenkins +10 -0
- data/features/default_host.feature +19 -0
- data/features/development.feature +14 -0
- data/features/launch_server.feature +16 -0
- data/features/listing_jobs.feature +34 -0
- data/features/manage_jobs.feature +208 -0
- data/features/manage_slave_nodes.feature +82 -0
- data/features/step_definitions/common_steps.rb +192 -0
- data/features/step_definitions/fixture_project_steps.rb +8 -0
- data/features/step_definitions/jenkins_steps.rb +104 -0
- data/features/step_definitions/scm_steps.rb +12 -0
- data/features/support/common.rb +37 -0
- data/features/support/env.rb +19 -0
- data/features/support/hooks.rb +16 -0
- data/features/support/jenkins_helpers.rb +6 -0
- data/features/support/matchers.rb +10 -0
- data/fixtures/jenkins/envfile.hpi +0 -0
- data/fixtures/jenkins/git.hpi +0 -0
- data/fixtures/jenkins/github.hpi +0 -0
- data/fixtures/jenkins/greenballs.hpi +0 -0
- data/fixtures/jenkins/rake.hpi +0 -0
- data/fixtures/jenkins/ruby.hpi +0 -0
- data/fixtures/projects/non-bundler/Rakefile +4 -0
- data/fixtures/projects/rails-3/.gitignore +4 -0
- data/fixtures/projects/rails-3/Gemfile +30 -0
- data/fixtures/projects/rails-3/Gemfile.lock +74 -0
- data/fixtures/projects/rails-3/README +256 -0
- data/fixtures/projects/rails-3/Rakefile +7 -0
- data/fixtures/projects/rails-3/app/controllers/application_controller.rb +3 -0
- data/fixtures/projects/rails-3/app/helpers/application_helper.rb +2 -0
- data/fixtures/projects/rails-3/app/views/layouts/application.html.erb +14 -0
- data/fixtures/projects/rails-3/config.ru +4 -0
- data/fixtures/projects/rails-3/config/application.rb +42 -0
- data/fixtures/projects/rails-3/config/boot.rb +13 -0
- data/fixtures/projects/rails-3/config/database.yml +22 -0
- data/fixtures/projects/rails-3/config/environment.rb +5 -0
- data/fixtures/projects/rails-3/config/environments/development.rb +26 -0
- data/fixtures/projects/rails-3/config/environments/production.rb +49 -0
- data/fixtures/projects/rails-3/config/environments/test.rb +35 -0
- data/fixtures/projects/rails-3/config/initializers/backtrace_silencers.rb +7 -0
- data/fixtures/projects/rails-3/config/initializers/inflections.rb +10 -0
- data/fixtures/projects/rails-3/config/initializers/mime_types.rb +5 -0
- data/fixtures/projects/rails-3/config/initializers/secret_token.rb +7 -0
- data/fixtures/projects/rails-3/config/initializers/session_store.rb +8 -0
- data/fixtures/projects/rails-3/config/locales/en.yml +5 -0
- data/fixtures/projects/rails-3/config/routes.rb +58 -0
- data/fixtures/projects/rails-3/db/seeds.rb +7 -0
- data/fixtures/projects/rails-3/doc/README_FOR_APP +2 -0
- data/fixtures/projects/rails-3/lib/tasks/.gitkeep +0 -0
- data/fixtures/projects/rails-3/public/404.html +26 -0
- data/fixtures/projects/rails-3/public/422.html +26 -0
- data/fixtures/projects/rails-3/public/500.html +26 -0
- data/fixtures/projects/rails-3/public/favicon.ico +0 -0
- data/fixtures/projects/rails-3/public/images/rails.png +0 -0
- data/fixtures/projects/rails-3/public/index.html +239 -0
- data/fixtures/projects/rails-3/public/javascripts/application.js +2 -0
- data/fixtures/projects/rails-3/public/javascripts/controls.js +965 -0
- data/fixtures/projects/rails-3/public/javascripts/dragdrop.js +974 -0
- data/fixtures/projects/rails-3/public/javascripts/effects.js +1123 -0
- data/fixtures/projects/rails-3/public/javascripts/prototype.js +6001 -0
- data/fixtures/projects/rails-3/public/javascripts/rails.js +175 -0
- data/fixtures/projects/rails-3/public/robots.txt +5 -0
- data/fixtures/projects/rails-3/public/stylesheets/.gitkeep +0 -0
- data/fixtures/projects/rails-3/script/rails +6 -0
- data/fixtures/projects/rails-3/test/performance/browsing_test.rb +9 -0
- data/fixtures/projects/rails-3/test/test_helper.rb +13 -0
- data/fixtures/projects/rails-3/vendor/plugins/.gitkeep +0 -0
- data/fixtures/projects/ruby/Gemfile +3 -0
- data/fixtures/projects/ruby/Gemfile.lock +10 -0
- data/fixtures/projects/ruby/Rakefile +4 -0
- data/jenkins.gemspec +34 -0
- data/lib/jenkins.rb +6 -0
- data/lib/jenkins/api.rb +219 -0
- data/lib/jenkins/cli.rb +249 -0
- data/lib/jenkins/cli/formatting.rb +53 -0
- data/lib/jenkins/config.rb +27 -0
- data/lib/jenkins/core_ext/hash.rb +9 -0
- data/lib/jenkins/core_ext/object/blank.rb +77 -0
- data/lib/jenkins/hudson-cli.jar +0 -0
- data/lib/jenkins/job_config_builder.rb +287 -0
- data/lib/jenkins/project_scm.rb +22 -0
- data/lib/jenkins/remote.rb +11 -0
- data/lib/jenkins/version.rb +3 -0
- data/spec/fixtures/ec2_global.config.xml +103 -0
- data/spec/fixtures/rails.multi.config.xml +82 -0
- data/spec/fixtures/rails.single.config.triggers.xml +84 -0
- data/spec/fixtures/rails.single.config.xml +80 -0
- data/spec/fixtures/ruby.multi-ruby-multi-labels.config.xml +84 -0
- data/spec/fixtures/ruby.multi.config.xml +77 -0
- data/spec/fixtures/ruby.single.config.xml +58 -0
- data/spec/fixtures/therubyracer.config.xml +77 -0
- data/spec/hash_key_cleaner_spec.rb +25 -0
- data/spec/job_config_builder_spec.rb +137 -0
- data/spec/spec_helper.rb +15 -0
- metadata +355 -0
data/.gitignore
ADDED
data/Changelog.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.5.0 - 2010/12/1
|
|
4
|
+
|
|
5
|
+
* hudson warfile no longer bundled with hudson gem
|
|
6
|
+
* rubygem is now 235K instead of 31M!
|
|
7
|
+
* upgrade hudson server and related plugins without requiring a new gem release
|
|
8
|
+
* hudson gem now fully drinks the bundler koolaid.
|
|
9
|
+
* hudson create
|
|
10
|
+
* --node-labels 'ubuntu,gentoo' - run tests against multiple slave nodes by their label
|
|
11
|
+
* --no-template - do not generate any default steps (well, a silly one)
|
|
12
|
+
* hudson add_node
|
|
13
|
+
* --vagrant - provide alternate default values when adding nodes if the node is a Vagrant VM
|
|
14
|
+
* hudson default_host
|
|
15
|
+
* NEW - displays the current default host:port URI
|
|
16
|
+
|
|
17
|
+
## 0.4.0 - 2010/11/11
|
|
18
|
+
|
|
19
|
+
* hudson create
|
|
20
|
+
* --rubies '1.8.7,1.9.2,rbx-head,jruby' - uses RVM and Hudson's Axes support to run tests within different Ruby environments
|
|
21
|
+
* --scm git://some-alternate.com/repo.git - can override the "origin" URI
|
|
22
|
+
* --scm-branches 'master,other,branches' - specify which branches can be pulled from to trigger tests
|
|
23
|
+
|
|
24
|
+
* hudson job
|
|
25
|
+
* Can dump information/status about a job
|
|
26
|
+
|
|
27
|
+
## 0.3.1 - 2010/11/8
|
|
28
|
+
|
|
29
|
+
* fixed error in the rails3 template's test for schema.rb
|
|
30
|
+
|
|
31
|
+
## 0.3.0 - 2010/11/8
|
|
32
|
+
|
|
33
|
+
MAJOR RELEASE!
|
|
34
|
+
|
|
35
|
+
* All new commands for CLI: build, remove, nodes, add_node
|
|
36
|
+
* Updated to Hudson CI 1.381
|
|
37
|
+
|
|
38
|
+
## 0.2.7 2010/8/25
|
|
39
|
+
|
|
40
|
+
* Updated to Hudson CI 1.373
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
jenkins (0.6.0)
|
|
5
|
+
builder (~> 2.1.2)
|
|
6
|
+
hpricot
|
|
7
|
+
httparty (~> 0.6.1)
|
|
8
|
+
term-ansicolor (>= 1.0.4)
|
|
9
|
+
thor (~> 0.14.2)
|
|
10
|
+
yajl-ruby (>= 0.7.6)
|
|
11
|
+
|
|
12
|
+
GEM
|
|
13
|
+
remote: http://rubygems.org/
|
|
14
|
+
specs:
|
|
15
|
+
awesome_print (0.2.1)
|
|
16
|
+
builder (2.1.2)
|
|
17
|
+
crack (0.1.8)
|
|
18
|
+
cucumber (0.9.3)
|
|
19
|
+
builder (~> 2.1.2)
|
|
20
|
+
diff-lcs (~> 1.1.2)
|
|
21
|
+
gherkin (~> 2.2.9)
|
|
22
|
+
json (~> 1.4.6)
|
|
23
|
+
term-ansicolor (~> 1.0.5)
|
|
24
|
+
diff-lcs (1.1.2)
|
|
25
|
+
gherkin (2.2.9)
|
|
26
|
+
json (~> 1.4.6)
|
|
27
|
+
term-ansicolor (~> 1.0.5)
|
|
28
|
+
hpricot (0.8.3)
|
|
29
|
+
httparty (0.6.1)
|
|
30
|
+
crack (= 0.1.8)
|
|
31
|
+
jenkins-war (1.396)
|
|
32
|
+
json (1.4.6)
|
|
33
|
+
rake (0.8.7)
|
|
34
|
+
rspec (2.0.1)
|
|
35
|
+
rspec-core (~> 2.0.1)
|
|
36
|
+
rspec-expectations (~> 2.0.1)
|
|
37
|
+
rspec-mocks (~> 2.0.1)
|
|
38
|
+
rspec-core (2.0.1)
|
|
39
|
+
rspec-expectations (2.0.1)
|
|
40
|
+
diff-lcs (>= 1.1.2)
|
|
41
|
+
rspec-mocks (2.0.1)
|
|
42
|
+
rspec-core (~> 2.0.1)
|
|
43
|
+
rspec-expectations (~> 2.0.1)
|
|
44
|
+
term-ansicolor (1.0.5)
|
|
45
|
+
thor (0.14.6)
|
|
46
|
+
yajl-ruby (0.7.8)
|
|
47
|
+
|
|
48
|
+
PLATFORMS
|
|
49
|
+
ruby
|
|
50
|
+
|
|
51
|
+
DEPENDENCIES
|
|
52
|
+
awesome_print
|
|
53
|
+
cucumber (~> 0.9.0)
|
|
54
|
+
jenkins!
|
|
55
|
+
jenkins-war (>= 1.396)
|
|
56
|
+
json (~> 1.4.0)
|
|
57
|
+
rake (~> 0.8.7)
|
|
58
|
+
rspec (~> 2.0.0)
|
data/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Jenkins
|
|
2
|
+
======
|
|
3
|
+
|
|
4
|
+
[Jenkins CI](http://jenkins-ci.org/) is a sweet continuous integration platform. Jenkins.rb makes it easy to get started, add/remove Ruby jobs and slave nodes; either from a CLI or an API.
|
|
5
|
+
|
|
6
|
+
* Email: [http://groups.google.com/group/jenkinsrb](http://groups.google.com/group/jenkinsrb)
|
|
7
|
+
* IRC: [irc://irc.freenode.net/jenkins.rb](irc://irc.freenode.net/jenkins.rb)
|
|
8
|
+
* CI: [http://jenkins.thefrontside.net/job/jenkins.rb/](http://jenkins.thefrontside.net/job/jenkins.rb/)
|
|
9
|
+
|
|
10
|
+
Install
|
|
11
|
+
=======
|
|
12
|
+
|
|
13
|
+
gem install jenkins
|
|
14
|
+
|
|
15
|
+
You do not need to download Jenkins CI. It is bundled in the RubyGem.
|
|
16
|
+
|
|
17
|
+
Example
|
|
18
|
+
=======
|
|
19
|
+
|
|
20
|
+
Jenkins.rb is continuously tested using Jenkins at [http://jenkins.thefrontside.net/job/jenkins.rb/](http://jenkins.thefrontside.net/job/jenkins.rb/).
|
|
21
|
+
|
|
22
|
+
The `jenkins` application allows you to see the projects/jobs and their statuses:
|
|
23
|
+
|
|
24
|
+
$ jenkins list --host jenkins.thefrontside.net --port 80
|
|
25
|
+
jenkins.rb - http://jenkins.thefrontside.net/job/jenkins.rb/
|
|
26
|
+
TheRubyRacer - http://jenkins.thefrontside.net/job/TheRubyRacer/
|
|
27
|
+
|
|
28
|
+
Alternately use environment variables:
|
|
29
|
+
|
|
30
|
+
$ JENKINS_HOST=jenkins.thefrontside.net JENKINS_PORT=80 jenkins list
|
|
31
|
+
|
|
32
|
+
Alternately, it will remember the last Jenkins CI master used.
|
|
33
|
+
|
|
34
|
+
$ jenkins list
|
|
35
|
+
|
|
36
|
+
Usage
|
|
37
|
+
=====
|
|
38
|
+
|
|
39
|
+
To run your own Jenkins server (by default opens at http://localhost:3001):
|
|
40
|
+
|
|
41
|
+
Usage: jenkins server [options]
|
|
42
|
+
-p, --port [3001] run jenkins server on this port
|
|
43
|
+
-c, --control [3002] set the shutdown/control port
|
|
44
|
+
--daemon fork into background and run as a daemon
|
|
45
|
+
--logfile [PATH] redirect log messages to this file
|
|
46
|
+
-k, --kill send shutdown signal to control port
|
|
47
|
+
--home [/Users/drnic/.jenkins/server] use this directory to store server data
|
|
48
|
+
|
|
49
|
+
The remaining CLI tasks are for communicating with a running Jenkins server; either the one created above or hosted remotely.
|
|
50
|
+
|
|
51
|
+
### Jobs
|
|
52
|
+
|
|
53
|
+
To list Jobs/Projects on a Jenkins server:
|
|
54
|
+
|
|
55
|
+
Usage: jenkins list [options]
|
|
56
|
+
|
|
57
|
+
To add Jobs/Projects (create a Job) on a Jenkins server:
|
|
58
|
+
|
|
59
|
+
Usage: jenkins create PROJECT_PATH [options]
|
|
60
|
+
--public-scm use public scm URL
|
|
61
|
+
--template [ruby] template of job steps (available: rails,rails3,ruby,rubygem)
|
|
62
|
+
--assigned-node [ASSIGNED-NODE] only use slave nodes with this label
|
|
63
|
+
--override override if job exists
|
|
64
|
+
--no-build create job without initial build
|
|
65
|
+
|
|
66
|
+
To trigger a Job to build:
|
|
67
|
+
|
|
68
|
+
Usage: jenkins build
|
|
69
|
+
|
|
70
|
+
To remove a Job from a Jenkins server:
|
|
71
|
+
|
|
72
|
+
Usage: jenkins remove PROJECT_PATH
|
|
73
|
+
|
|
74
|
+
### Slave nodes
|
|
75
|
+
|
|
76
|
+
To list slaves on a Jenkins server (including itself):
|
|
77
|
+
|
|
78
|
+
Usage: jenkins nodes
|
|
79
|
+
|
|
80
|
+
To add a remote machine/remote VM to a Jenkins server as a slave:
|
|
81
|
+
|
|
82
|
+
Usage: jenkins add_node SLAVE_HOST
|
|
83
|
+
--slave-port [22] SSH port for Jenkins to connect to slave node
|
|
84
|
+
--label [LABEL] Labels for a job --assigned_node to match against to select a slave. --master-key [MASTER-KEY] Location of master public key or identity file
|
|
85
|
+
--slave-fs [SLAVE-FS] Location of file system on slave for Jenkins to use
|
|
86
|
+
--name [NAME] Name of slave node (default SLAVE_HOST)
|
|
87
|
+
--slave-user [deploy] SSH user for Jenkins to connect to slave node
|
|
88
|
+
|
|
89
|
+
### Selecting a Jenkins CI server
|
|
90
|
+
|
|
91
|
+
**For all client-side commands, there are `--host` and `--port` options flags.** These are cached after first used, so are only required for the first request to a Jenkins CI server. For example:
|
|
92
|
+
|
|
93
|
+
jenkins create . --host localhost --port 3001
|
|
94
|
+
jenkins list
|
|
95
|
+
jenkins create . --override
|
|
96
|
+
|
|
97
|
+
Alternately, `$JENKINS_HOST` and `$JENKINS_PORT` can be provided in lieu of the cached target Jenkins CI server
|
|
98
|
+
|
|
99
|
+
JENKINS_HOST=localhost JENKINS_PORT=3001 jenkins list
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
Developer Instructions
|
|
103
|
+
======================
|
|
104
|
+
|
|
105
|
+
The dependencies for the gem and for developing the gem are managed by bundler.
|
|
106
|
+
|
|
107
|
+
gem install bundler
|
|
108
|
+
git clone http://github.com/cowboyd/jenkins.rb.git
|
|
109
|
+
bundle install
|
|
110
|
+
|
|
111
|
+
The test suite is run with:
|
|
112
|
+
|
|
113
|
+
rake
|
|
114
|
+
|
|
115
|
+
This launches a Jenkins server, runs cucumber features, and kills the Jenkins server.
|
|
116
|
+
|
|
117
|
+
Alternately, manually launch the Jenkins server, run features and close the Jenkins server:
|
|
118
|
+
|
|
119
|
+
rake jenkins:server:test
|
|
120
|
+
rake cucumber:ok
|
|
121
|
+
rake jenkins:server:killtest
|
|
122
|
+
|
|
123
|
+
Contributors
|
|
124
|
+
============
|
|
125
|
+
|
|
126
|
+
* Charles Lowell
|
|
127
|
+
* Dr Nic Williams
|
|
128
|
+
* Bo Jeanes
|
|
129
|
+
|
|
130
|
+
License
|
|
131
|
+
=======
|
|
132
|
+
|
|
133
|
+
(The MIT License)
|
|
134
|
+
|
|
135
|
+
Copyright (c) 2010 Charles Lowell, cowboyd@thefrontside.net
|
|
136
|
+
|
|
137
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
138
|
+
a copy of this software and associated documentation files (the
|
|
139
|
+
'Software'), to deal in the Software without restriction, including
|
|
140
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
141
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
142
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
143
|
+
the following conditions:
|
|
144
|
+
|
|
145
|
+
The above copyright notice and this permission notice shall be
|
|
146
|
+
included in all copies or substantial portions of the Software.
|
|
147
|
+
|
|
148
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
149
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
150
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
151
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
152
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
153
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
154
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
require 'bundler'
|
|
2
|
+
Bundler::GemHelper.install_tasks
|
|
3
|
+
|
|
4
|
+
require "rspec/core/rake_task"
|
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
6
|
+
|
|
7
|
+
namespace :cucumber do
|
|
8
|
+
require 'cucumber/rake/task'
|
|
9
|
+
Cucumber::Rake::Task.new(:wip, 'Run features that are being worked on') do |t|
|
|
10
|
+
t.cucumber_opts = "--tags @wip"
|
|
11
|
+
end
|
|
12
|
+
Cucumber::Rake::Task.new(:ok, 'Run features that should be working') do |t|
|
|
13
|
+
t.cucumber_opts = "--tags ~@wip"
|
|
14
|
+
end
|
|
15
|
+
task :all => [:ok, :wip]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
desc 'Alias for cucumber:ok'
|
|
19
|
+
task :cucumber => 'cucumber:ok'
|
|
20
|
+
|
|
21
|
+
desc "Start test server; Run cucumber:ok; Kill Test Server;"
|
|
22
|
+
task :default => [:spec, "jenkins:server:killtest", "jenkins:server:test"] do
|
|
23
|
+
require 'socket'
|
|
24
|
+
require 'net/http'
|
|
25
|
+
print "waiting for at most 30 seconds for the server to start"
|
|
26
|
+
tries = 1
|
|
27
|
+
begin
|
|
28
|
+
print "."; $stdout.flush
|
|
29
|
+
tries += 1
|
|
30
|
+
Net::HTTP.start("localhost", "3010") { |http| http.get('/') }
|
|
31
|
+
sleep(10)
|
|
32
|
+
puts ""
|
|
33
|
+
result = Rake::Task["cucumber:ok"].invoke
|
|
34
|
+
rescue Exception => e
|
|
35
|
+
if tries <= 15
|
|
36
|
+
sleep 2
|
|
37
|
+
retry
|
|
38
|
+
end
|
|
39
|
+
raise
|
|
40
|
+
ensure
|
|
41
|
+
Rake::Task["jenkins:server:killtest"].tap do |task|
|
|
42
|
+
task.reenable
|
|
43
|
+
task.invoke
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
raise unless result
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
namespace :jenkins do
|
|
50
|
+
namespace :server do
|
|
51
|
+
require 'fileutils'
|
|
52
|
+
|
|
53
|
+
directory plugin_dir = File.expand_path("var/jenkins/plugins")
|
|
54
|
+
desc "Run a server for tests"
|
|
55
|
+
task :test => plugin_dir do
|
|
56
|
+
port = 3010
|
|
57
|
+
control = 3011
|
|
58
|
+
FileUtils.chdir(File.dirname(__FILE__)) do
|
|
59
|
+
Dir["fixtures/jenkins/*.hpi"].each do |plugin|
|
|
60
|
+
FileUtils.cp plugin, plugin_dir
|
|
61
|
+
end
|
|
62
|
+
logfile = File.expand_path("var/jenkins/test.log")
|
|
63
|
+
puts "Launching jenkins test server at http://localhost:#{port}..."
|
|
64
|
+
puts " output will be logged to #{logfile}"
|
|
65
|
+
`ruby bin/jenkins server --home #{File.dirname(plugin_dir)} --port #{port} --control #{control} --daemon --logfile #{logfile}`
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
desc "Kill jenkins test server if it is running."
|
|
70
|
+
task :killtest do
|
|
71
|
+
FileUtils.chdir(File.dirname(__FILE__)) do
|
|
72
|
+
puts "Killing any running server processes..."
|
|
73
|
+
`ruby bin/jenkins server --control 3011 --kill 2>/dev/null`
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
Dir['tasks/**/*.rake'].each {|f| load f}
|
|
81
|
+
|
|
82
|
+
|
data/bin/jenkins
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
$:.unshift(File.expand_path(File.dirname(File.dirname(__FILE__) + "/../lib/jenkins.rb")))
|
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../lib/jenkins')
|
|
4
|
+
require 'jenkins/cli'
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
Jenkins::CLI.start
|
|
8
|
+
rescue Errno::ECONNREFUSED, Errno::EAFNOSUPPORT
|
|
9
|
+
Jenkins::CLI.new.shell.say "No connection available to the server.", :red
|
|
10
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Feature: Display default host information
|
|
2
|
+
|
|
3
|
+
Scenario: Display default host information if it is setup
|
|
4
|
+
Given I run local executable "jenkins" with arguments "list --host localhost --port 3010"
|
|
5
|
+
When I run local executable "jenkins" with arguments "default_host"
|
|
6
|
+
Then I should see exactly
|
|
7
|
+
"""
|
|
8
|
+
http://localhost:3010
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
Scenario: Display warning if never used Jenkins.rb before
|
|
12
|
+
When I run local executable "jenkins" with arguments "default_host"
|
|
13
|
+
Then I should see exactly
|
|
14
|
+
"""
|
|
15
|
+
ERROR: Either use --host or add remote servers.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Feature: Development processes of jenkins itself (rake tasks)
|
|
2
|
+
|
|
3
|
+
As a Newgem maintainer or contributor
|
|
4
|
+
I want rake tasks to maintain and release the gem
|
|
5
|
+
So that I can spend time on the tests and code, and not excessive time on maintenance processes
|
|
6
|
+
|
|
7
|
+
Scenario: Generate RubyGem
|
|
8
|
+
Given this project is active project folder
|
|
9
|
+
When I invoke task "rake clean" so that I start with nothing
|
|
10
|
+
And I invoke task "rake build"
|
|
11
|
+
Then file with name matching "pkg/jenkins-*.gem" is created
|
|
12
|
+
And file with name matching "jenkins.gemspec" is created
|
|
13
|
+
And the file "jenkins.gemspec" is a valid gemspec
|
|
14
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Feature: Running a Jenkins Server
|
|
2
|
+
As a jenkins server administrator
|
|
3
|
+
I want to be able to easily control a jenkins server
|
|
4
|
+
In order to spend my time on how the process operates, not how to start stop and control it.
|
|
5
|
+
|
|
6
|
+
Scenario: Start a Jenkins Server (jenkins server)
|
|
7
|
+
Given env variable $HOME set to project path "home"
|
|
8
|
+
And "home/.jenkins" folder is deleted
|
|
9
|
+
And there is nothing listening on port 5001
|
|
10
|
+
And there is nothing listening on port 5002
|
|
11
|
+
And I cleanup any jenkins processes with control port 5002
|
|
12
|
+
When I run jenkins server with arguments "--port 5001 --control 5002 --daemon --logfile=server.log"
|
|
13
|
+
Then I should see a jenkins server on port 5001
|
|
14
|
+
And folder "home/.jenkins/server" is created
|
|
15
|
+
And folder "home/.jenkins/server/javatmp" is created
|
|
16
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Feature: Listing jobs
|
|
2
|
+
I want to see the status of jobs on servers I'm interested in
|
|
3
|
+
|
|
4
|
+
Scenario: List jobs on a non-existent server (jenkins list)
|
|
5
|
+
When I run local executable "jenkins" with arguments "list --host localhost --port 9999"
|
|
6
|
+
Then I should see exactly
|
|
7
|
+
"""
|
|
8
|
+
No connection available to the server.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
Scenario: List jobs on a server with no jobs (jenkins list)
|
|
12
|
+
Given I have a Jenkins server running
|
|
13
|
+
And the Jenkins server has no current jobs
|
|
14
|
+
When I run local executable "jenkins" with arguments "list --host localhost --port 3010"
|
|
15
|
+
Then I should see exactly
|
|
16
|
+
"""
|
|
17
|
+
http://localhost:3010: no jobs
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
Scenario: List jobs on a server with jobs (jenkins list)
|
|
21
|
+
Given I have a Jenkins server running
|
|
22
|
+
And the Jenkins server has no current jobs
|
|
23
|
+
And I am in the "ruby" project folder
|
|
24
|
+
And the project uses "git" scm
|
|
25
|
+
When I run local executable "jenkins" with arguments "create . --host localhost --port 3010"
|
|
26
|
+
When I run local executable "jenkins" with arguments "list"
|
|
27
|
+
Then I should see exactly
|
|
28
|
+
"""
|
|
29
|
+
http://localhost:3010:
|
|
30
|
+
* ruby
|
|
31
|
+
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
|