engineyard-jenkins 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/.gitignore +5 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +87 -0
  4. data/History.md +32 -0
  5. data/README.md +186 -0
  6. data/Rakefile +24 -0
  7. data/bin/ey-jenkins +7 -0
  8. data/engineyard-jenkins.gemspec +33 -0
  9. data/features/install.feature +53 -0
  10. data/features/install_server.feature +69 -0
  11. data/features/step_definitions/api_steps.rb +10 -0
  12. data/features/step_definitions/common_steps.rb +211 -0
  13. data/features/step_definitions/fixture_project_steps.rb +14 -0
  14. data/features/step_definitions/jenkins_steps.rb +9 -0
  15. data/features/support/common.rb +51 -0
  16. data/features/support/engineyard.rb +24 -0
  17. data/features/support/env.rb +14 -0
  18. data/features/support/matchers.rb +10 -0
  19. data/fixtures/cookbooks/main/recipes/default.rb +1 -0
  20. data/fixtures/cookbooks/redis/recipes/default.rb +0 -0
  21. data/fixtures/jenkins_boot_sequence/jenkins_booting.html +1 -0
  22. data/fixtures/jenkins_boot_sequence/jenkins_ready.html +1 -0
  23. data/fixtures/jenkins_boot_sequence/pre_jenkins_booting.html +1 -0
  24. data/fixtures/projects/rails/Gemfile +3 -0
  25. data/fixtures/projects/rails/Gemfile.lock +10 -0
  26. data/fixtures/projects/rails/Rakefile +4 -0
  27. data/lib/engineyard-jenkins.rb +4 -0
  28. data/lib/engineyard-jenkins/appcloud_env.rb +49 -0
  29. data/lib/engineyard-jenkins/cli.rb +134 -0
  30. data/lib/engineyard-jenkins/cli/install_generator.rb +55 -0
  31. data/lib/engineyard-jenkins/cli/install_generator/templates/attributes.rb.tt +17 -0
  32. data/lib/engineyard-jenkins/cli/install_generator/templates/cookbooks/main/attributes/recipe.rb +3 -0
  33. data/lib/engineyard-jenkins/cli/install_generator/templates/cookbooks/main/definitions/ey_cloud_report.rb +6 -0
  34. data/lib/engineyard-jenkins/cli/install_generator/templates/cookbooks/main/libraries/ruby_block.rb +40 -0
  35. data/lib/engineyard-jenkins/cli/install_generator/templates/cookbooks/main/libraries/run_for_app.rb +12 -0
  36. data/lib/engineyard-jenkins/cli/install_generator/templates/recipes.rb +95 -0
  37. data/lib/engineyard-jenkins/cli/install_server_generator.rb +25 -0
  38. data/lib/engineyard-jenkins/cli/install_server_generator/templates/attributes.rb.tt +3 -0
  39. data/lib/engineyard-jenkins/cli/install_server_generator/templates/cookbooks/jenkins_master/recipes/default.rb +95 -0
  40. data/lib/engineyard-jenkins/cli/install_server_generator/templates/cookbooks/jenkins_master/templates/default/init.sh.erb +26 -0
  41. data/lib/engineyard-jenkins/cli/install_server_generator/templates/cookbooks/jenkins_master/templates/default/proxy.conf.erb +20 -0
  42. data/lib/engineyard-jenkins/cli/install_server_generator/templates/cookbooks/main/attributes/recipe.rb +3 -0
  43. data/lib/engineyard-jenkins/cli/install_server_generator/templates/cookbooks/main/definitions/ey_cloud_report.rb +6 -0
  44. data/lib/engineyard-jenkins/cli/install_server_generator/templates/cookbooks/main/libraries/ruby_block.rb +40 -0
  45. data/lib/engineyard-jenkins/cli/install_server_generator/templates/cookbooks/main/libraries/run_for_app.rb +12 -0
  46. data/lib/engineyard-jenkins/cli/install_server_generator/templates/cookbooks/main/recipes/default.rb +1 -0
  47. data/lib/engineyard-jenkins/thor-ext/actions/directory.rb +33 -0
  48. data/lib/engineyard-jenkins/version.rb +5 -0
  49. data/spec/appcloud_env_spec.rb +75 -0
  50. data/spec/spec_helper.rb +4 -0
  51. metadata +254 -0
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ .DS_Store
5
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in engineyard-jenkins.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,87 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ engineyard-jenkins (0.4.0)
5
+ engineyard (~> 1.3.17)
6
+ jenkins (~> 0.6.2)
7
+ thor (~> 0.14.6)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ awesome_print (0.3.2)
13
+ builder (2.1.2)
14
+ crack (0.1.8)
15
+ cucumber (0.9.4)
16
+ builder (~> 2.1.2)
17
+ diff-lcs (~> 1.1.2)
18
+ gherkin (~> 2.2.9)
19
+ json (~> 1.4.6)
20
+ term-ansicolor (~> 1.0.5)
21
+ diff-lcs (1.1.2)
22
+ engineyard (1.3.17)
23
+ engineyard-serverside-adapter (= 1.4.1)
24
+ escape (~> 0.0.4)
25
+ highline (~> 1.6.1)
26
+ json_pure
27
+ net-ssh (~> 2.1.0)
28
+ rest-client (~> 1.6.0)
29
+ thor (~> 0.14.6)
30
+ engineyard-serverside-adapter (1.4.1)
31
+ escape (~> 0.0.4)
32
+ json_pure
33
+ escape (0.0.4)
34
+ fakeweb (1.3.0)
35
+ gherkin (2.2.9)
36
+ json (~> 1.4.6)
37
+ term-ansicolor (~> 1.0.5)
38
+ highline (1.6.1)
39
+ hpricot (0.8.4)
40
+ httparty (0.6.1)
41
+ crack (= 0.1.8)
42
+ jenkins (0.6.2)
43
+ builder (>= 2.1.2)
44
+ hpricot
45
+ httparty (~> 0.6.1)
46
+ term-ansicolor (>= 1.0.4)
47
+ thor (~> 0.14.2)
48
+ json (1.4.6)
49
+ json_pure (1.5.1)
50
+ mime-types (1.16)
51
+ net-ssh (2.1.4)
52
+ open4 (1.0.1)
53
+ rack (1.2.1)
54
+ rake (0.8.7)
55
+ realweb (0.1.6)
56
+ rack (>= 1.1.0)
57
+ rest-client (1.6.1)
58
+ mime-types (>= 1.16)
59
+ rspec (2.1.0)
60
+ rspec-core (~> 2.1.0)
61
+ rspec-expectations (~> 2.1.0)
62
+ rspec-mocks (~> 2.1.0)
63
+ rspec-core (2.1.0)
64
+ rspec-expectations (2.1.0)
65
+ diff-lcs (~> 1.1.2)
66
+ rspec-mocks (2.1.0)
67
+ sinatra (1.2.0)
68
+ rack (~> 1.1)
69
+ tilt (< 2.0, >= 1.2.2)
70
+ term-ansicolor (1.0.5)
71
+ thor (0.14.6)
72
+ tilt (1.2.2)
73
+
74
+ PLATFORMS
75
+ ruby
76
+
77
+ DEPENDENCIES
78
+ awesome_print
79
+ cucumber (~> 0.9.4)
80
+ engineyard-jenkins!
81
+ fakeweb (~> 1.3.0)
82
+ json (~> 1.4.0)
83
+ open4
84
+ rake (~> 0.8.7)
85
+ realweb (~> 0.1.6)
86
+ rspec (~> 2.1.0)
87
+ sinatra
data/History.md ADDED
@@ -0,0 +1,32 @@
1
+ # History
2
+
3
+ ## 0.4.0 - 2011-4-11
4
+
5
+ * Rename to engineyard-jenkins
6
+ * Fix bug in "ey-jenkins install ." wiring into Thor
7
+
8
+ ## 0.3.2 - 2011-3-3
9
+
10
+ * remove dependency on ruby-debug
11
+
12
+ ## 0.3.1 - 2010-12-1
13
+
14
+ * install_server
15
+ * Updates the default host for `jenkins` CLI to newly created server
16
+ * Explicitly set $HOME/$USER so Jenkins/Java has access to .gitconfig
17
+
18
+ ## 0.3.0 - 2010-11-24
19
+
20
+ * Renamed task 'server' => 'install_server'
21
+ * install_server does the complete job of setup/installation of Jenkins into an environment on AppCloud
22
+ * install_server can take --environment/--account options OR auto-discover which environment to install Jenkins into
23
+
24
+
25
+ ## 0.2.0 - 2010-10-30
26
+
27
+ * Initial 'server' task implementation
28
+
29
+ ## 0.1.0 - 2010-10-30
30
+
31
+ * Initial 'ey-jenkins install .' command
32
+ * 'ey-jenkins server' shows 'Coming soon'
data/README.md ADDED
@@ -0,0 +1,186 @@
1
+ # Easier to do CI than not to.
2
+
3
+ Run your continuous integration (CI) tests against your Engine Yard AppCloud environments - the exact same configuration you are using in production!
4
+
5
+ You're developing on OS X or Windows, deploying to Engine Yard AppCloud (Gentoo/Linux), and you're running your CI on your local machine or a spare Ubuntu machine in the corner of the office, or ... you're not running CI at all?
6
+
7
+ It's a nightmare. It was for me.
8
+
9
+ But now, [Jenkins CI](http://jenkins-ci.org/), the [jenkins](http://github.com/cowboyd/jenkins.rb) CLI project, and **engineyard-jenkins** now make CI easier to do than not to for Engine Yard AppCloud users.
10
+
11
+ And here's some logos:
12
+
13
+ <img src="http://img.skitch.com/20101103-gcq2turgih14rjdqatt1kjkd6u.png">
14
+
15
+ ## Installation
16
+
17
+ gem install engineyard-jenkins
18
+
19
+ This will also install the `jenkins` CLI to interact with your Jenkins CI from the command line.
20
+
21
+ ## Hosting on Engine Yard AppCloud
22
+
23
+ Using Engine Yard AppCloud "Quick Start" wizard, create an application with Git Repo `git://github.com/engineyard/jenkins_server.git` (options: rails 3, passenger), and add your own SSH keys. This will create an environment called `jenkins_server_production`. Boot the environment as a Single instance (or Custom cluster with a single instance).
24
+
25
+ Optionally, though it is quite pretty, deploy/ship the jenkins_server application and visit the HTTP link to see the remaining "Almost there..." instructions.
26
+
27
+ Finally, install Jenkins CI and rebuild the environment:
28
+
29
+ $ ey-jenkins install_server
30
+
31
+ When this completes, visit the URL or refresh the "Almost there..." page to see your Jenkins CI server.
32
+
33
+ Using the `jenkins list` CLI task you can also test there is a working server with no jobs:
34
+
35
+ *For the Jenkins slaves' configuration, you'll need:*
36
+
37
+ The `jenkins_server_production` instance public key:
38
+
39
+ $ ey ssh -e jenkins_server_production
40
+ # cat /home/deploy/.ssh/id_rsa.pub
41
+
42
+ Do those steps, copy down the configuration and you're done! Now, you either visit your Jenkins CI site or use `jenkins list` to see the status of your projects being tested.
43
+
44
+ ## Hosting elsewhere
45
+
46
+ Hosting Jenkins CI on Engine Yard AppCloud is optional; yet delightfully simple. Jenkins CI can be hosted anywhere.
47
+
48
+ If you host your Jenkins CI elsewhere then you need the following information about your Jenkins CI environment to be able to add EngineYard AppCloud instances as Jenkins nodes/slaves:
49
+
50
+ * Jenkins CI public host & port
51
+ * Jenkins CI's user's public key (probably at `/home/deploy/.ssh/id_rsa.pub`)
52
+ * Jenkins CI's user's private key path (probably `/home/deploy/.ssh/id_rsa`)
53
+
54
+ ## Running your CI tests on Engine Yard AppCloud
55
+
56
+ This is the exciting part - ensuring that your CI tests are being run in the same environment as your production applications. In this case, on Engine Yard AppCloud.
57
+
58
+ It is assumed that you already have a production application environment (might have multiple applications in it):
59
+
60
+ <img src="http://img.skitch.com/20101103-k2u4dpnn6ukkwq1dafbtiuwi2s.png">
61
+
62
+ In the Engine Yard AppCloud UI, create another environment that matches the production environment exactly (same Ruby, same set of applications, same Unix libraries).
63
+
64
+ <img src="http://img.skitch.com/20101103-h58t3kfrpc2qm4eb6t4664m13.png">
65
+
66
+ Now, in just a few steps and you will have your applications' tests running in an environment that matches your production environment:
67
+
68
+ $ cd /my/project
69
+ $ ey-jenkins install .
70
+
71
+ Now edit `cookbooks/jenkins_slave/attributes/default.rb` to set up the Jenkins CI instance details gathered above.
72
+
73
+ $ ey recipes upload -e ci_demo_app_ci
74
+ $ ey recipes apply -e ci_demo_app_ci
75
+
76
+ Boot your `ci_demo_app_ci` environment, visit your Jenkins CI and WOW! jobs have been created, they are already running, and they are doing it upon your `ci_demo_app_ci` environment!
77
+
78
+ At any time from the command line you can use `jenkins list` to see the status of your jobs
79
+
80
+ ## Conventions/Requirements
81
+
82
+ * Do not use your production environment as your Jenkins CI slave. There are no guarantees what will happen. I expect bad things.
83
+ * You must name your CI environments with a suffix of `_ci` or `_jenkins_slave`.
84
+ * You should not name any other environments with a suffix of `_ci` or `_jenkins_slave`; lest they offer themselves to your Jenkins CI as slave nodes.
85
+ * Keep your production and CI environments exactly the same. Use the same Ruby implementation/version, same database, and include the same RubyGems and Unix packages. Why? This is the entire point of the exercise: to run your CI tests in the same environment as your production application runs.
86
+
87
+ For example, note the naming convention of the two CI environments below (one ends in `_jenkins_slave` and the other `_ci`).
88
+
89
+ <img src="http://img.skitch.com/20101031-dxnk7hbn32yce9rum1ctwjwt1w.png" style="width: 100%">
90
+
91
+ ## What happens?
92
+
93
+ When you boot your Engine Yard AppCloud CI environments, each resulting EC2 instance executes a special "jenkins_slave" recipe (see `cookbooks/jenkins_slave/recipes/default.rb` in your project). This does three things:
94
+
95
+ * Adds this instance to your Jenkins CI server as a slave
96
+ * Adds each Rails/Rack application for the AppCloud environment into your Jenkins CI as a "job".
97
+ * Commences the first build of any newly added job.
98
+
99
+ If your CI instances have already been booted and you re-apply the recipes over and over (`ey recipes apply`), nothing good or bad will happen. The instances will stay registered as slaves and the applications will stay registered as Jenkins CI jobs.
100
+
101
+ If a new application is on the instance, then a new job will be created on Jenkins CI.
102
+
103
+ To delete a job from Jenkins CI, you should also delete it from your AppCloud CI environment to ensure it isn't re-added the next time you re-apply or re-build or terminate/boot your CI environment. (To delete a job, use the Jenkins CI UI or `jenkins remove APP-NAME` from the CLI.)
104
+
105
+ In essence, to add new Rails/Rack applications into your Jenkins CI server you:
106
+
107
+ * Add them to one of your Engine Yard AppCloud CI environments (the one that matches the production environment where the application will be hosted)
108
+ * Rebuild the environment or re-apply the custom recipes (`ey recipes apply`)
109
+
110
+ ### Applications are run in their respective CI environment
111
+
112
+ Thusly demonstrated below: the application/job "ci_demo_app" is in the middle of a build on its target slave "ci_demo_app_ci". See the AppCloud UI example above to see the relationship between the application/job names and the environment/slave names.
113
+
114
+ <img src="http://img.skitch.com/20101031-tga2f23wems1acpad1ua41qdmb.png" style="width: 100%">
115
+
116
+ ### Can I add applications/jobs to Jenkins CI other ways?
117
+
118
+ Yes. There are three simple ways to get Jenkins CI to run tests for your application ("create a job to run builds"). Above is the first: all "applications" on the Engine Yard AppCloud CI environment will automatically become Jenkins CI jobs. The alternates are:
119
+
120
+ * Use the `jenkins create .` command from the [jenkins](http://github.com/cowboyd/jenkins.rb) CLI.
121
+
122
+ Pass the `--assigned_node xyz` flag to make the project's test be executed on a specific slave node. "xyz" is the name of another application on your AppCloud account; your tests will be executed on the same instance, with the same version of Ruby etc.
123
+
124
+ * Use the Jenkins CI UI to create a new job. As above, you can make sure the tests are run on a specific Engine Yard AppCloud instance by setting the assigned node label to be the same as another AppCloud application in your account that is being tested.
125
+
126
+ Specifically, Jenkins CI uses "labels" to match jobs to slaves. A common example usage is to label a Windows slave as "windows". A job could then be restricted to only running on slaves with label "windows". We are using this same mechanism.
127
+
128
+ ## Automatically triggering job builds
129
+
130
+ In Jenkins CI, a "job" is one of your projects. Each time it runs your tests, it is called a "build".
131
+
132
+ It is often desirable to have your SCM trigger Jenkins CI to run your job build whenever you push new code.
133
+
134
+ ### GitHub Service Hooks
135
+
136
+ * Go to the "Admin" section of your GitHub project
137
+ * Click "Service Hooks"
138
+ * Click "Post-Receive URLs"
139
+ * Enter the URL `http://HUDSON-CI-URL/job/APP-NAME/build`
140
+ * Click "Update Settings"
141
+
142
+ And here's a picture.
143
+
144
+ <img src="http://img.skitch.com/20101031-d5wrc7hysrahihqr9k53xgxi1t.png" style="width: 100%;">
145
+
146
+ You can also use the "Test Hook" link to test this is wired up correctly.
147
+
148
+ ### CLI
149
+
150
+ Using the `jenkins` CLI:
151
+
152
+ jenkins build path/to/APP-NAME
153
+
154
+ ### Curl
155
+
156
+ You are triggering the build via a GET call to an URL endpoint. So you can also use `curl`:
157
+
158
+ curl http://HUDSON-CI-URL/job/APP-NAME/build
159
+
160
+ ## Contributions
161
+
162
+ * Dr Nic Williams ([drnic](http://github.com/drnic))
163
+ * Bodaniel Jeanes ([bjeanes](http://github.com/bjeanes)) - initial chef recipes for [Jenkins server + slave](http://github.com/bjeanes/ey-cloud-recipes)
164
+
165
+ ## License
166
+
167
+ Copyright (c) 2010 Dr Nic Williams, Engine Yard
168
+
169
+ Permission is hereby granted, free of charge, to any person obtaining
170
+ a copy of this software and associated documentation files (the
171
+ "Software"), to deal in the Software without restriction, including
172
+ without limitation the rights to use, copy, modify, merge, publish,
173
+ distribute, sublicense, and/or sell copies of the Software, and to
174
+ permit persons to whom the Software is furnished to do so, subject to
175
+ the following conditions:
176
+
177
+ The above copyright notice and this permission notice shall be
178
+ included in all copies or substantial portions of the Software.
179
+
180
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
181
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
182
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
183
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
184
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
185
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
186
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+
6
+ desc "Run all examples"
7
+ RSpec::Core::RakeTask.new
8
+
9
+ namespace :cucumber do
10
+ require 'cucumber/rake/task'
11
+ Cucumber::Rake::Task.new(:wip, 'Run features that are being worked on') do |t|
12
+ t.cucumber_opts = "--tags @wip"
13
+ end
14
+ Cucumber::Rake::Task.new(:ok, 'Run features that should be working') do |t|
15
+ t.cucumber_opts = "--tags ~@wip"
16
+ end
17
+ task :all => [:ok, :wip]
18
+ end
19
+
20
+ desc 'Alias for cucumber:ok'
21
+ task :cucumber => 'cucumber:ok'
22
+
23
+ desc "Start test server; Run cucumber:ok; Kill Test Server;"
24
+ task :default => ["spec", "cucumber"]
data/bin/ey-jenkins ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
4
+ require 'engineyard-jenkins'
5
+ require 'engineyard-jenkins/cli'
6
+
7
+ Engineyard::Jenkins::CLI.start
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "engineyard-jenkins"
5
+ s.version = '0.4.0'
6
+ s.platform = Gem::Platform::RUBY
7
+ s.authors = ["Dr Nic Williams"]
8
+ s.email = ["drnicwilliams@gmail.com"]
9
+ s.homepage = "http://github.com/engineyard/engineyard-jenkins"
10
+ s.summary = %q{Easier to do CI than not to. Use Jenkins CI with Engine Yard AppCloud.}
11
+ s.description = %q{Run your continuous integration (CI) tests against your Engine Yard AppCloud environments - the exact same configuration you are using in production!}
12
+
13
+ s.rubyforge_project = "engineyard-jenkins"
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_dependency("thor", ["~> 0.14.6"])
21
+ s.add_dependency("engineyard", ["~> 1.3.17"])
22
+ s.add_dependency("jenkins", ["~> 0.6.2"])
23
+
24
+ s.add_development_dependency("rake", ["~> 0.8.7"])
25
+ s.add_development_dependency("cucumber", ["~> 0.9.4"])
26
+ s.add_development_dependency("rspec", ["~> 2.1.0"])
27
+ s.add_development_dependency("json", ["~>1.4.0"])
28
+ s.add_development_dependency("awesome_print")
29
+ s.add_development_dependency("realweb", '~>0.1.6')
30
+ s.add_development_dependency("open4")
31
+ s.add_development_dependency("sinatra")
32
+ s.add_development_dependency("fakeweb", "~>1.3.0")
33
+ end
@@ -0,0 +1,53 @@
1
+ Feature: Managing a rails project as a Jenkins CI job on AppCloud
2
+ I want to build/test my project in the same environment I run in Engine Yard AppCloud
3
+
4
+ Scenario: Setup first project as a slave for Jenkins
5
+ Given I am in the "rails" project folder
6
+ When I run local executable "ey-jenkins" with arguments "install ."
7
+ Then file "cookbooks/jenkins_slave/attributes/default.rb" is created
8
+ And file "cookbooks/jenkins_slave/recipes/default.rb" is created
9
+ And file "cookbooks/main/recipes/default.rb" is created
10
+ And file "cookbooks/main/libraries/ruby_block.rb" is created
11
+ And I should see exactly
12
+ """
13
+ create cookbooks
14
+ create cookbooks/main/attributes/recipe.rb
15
+ create cookbooks/main/definitions/ey_cloud_report.rb
16
+ create cookbooks/main/libraries/ruby_block.rb
17
+ create cookbooks/main/libraries/run_for_app.rb
18
+ create cookbooks/jenkins_slave/attributes/default.rb
19
+ create cookbooks/jenkins_slave/recipes/default.rb
20
+ create cookbooks/main/recipes/default.rb
21
+
22
+ Finally:
23
+ * edit cookbooks/jenkins_slave/attributes/default.rb as necessary.
24
+ * run: ey recipes upload # use --environment(-e) & --account(-c)
25
+ * run: ey recipes apply # to select environment
26
+ * Boot your environment if not already booted.
27
+ When the recipe completes, your project will commence its first build on Jenkins CI.
28
+ """
29
+
30
+ Scenario: Setup project with existing cookbooks as a slave for Jenkins
31
+ Given I am in the "rails" project folder
32
+ And I already have cookbooks installed
33
+ When I run local executable "ey-jenkins" with arguments "install ."
34
+ Then file "cookbooks/jenkins_slave/attributes/default.rb" is created
35
+ And file "cookbooks/jenkins_slave/recipes/default.rb" is created
36
+ And file "cookbooks/main/recipes/default.rb" is created
37
+ And file "cookbooks/redis/recipes/default.rb" is created
38
+ And I should see exactly
39
+ """
40
+ create cookbooks/jenkins_slave/attributes/default.rb
41
+ create cookbooks/jenkins_slave/recipes/default.rb
42
+ append cookbooks/main/recipes/default.rb
43
+
44
+ Finally:
45
+ * edit cookbooks/jenkins_slave/attributes/default.rb as necessary.
46
+ * run: ey recipes upload # use --environment(-e) & --account(-c)
47
+ * run: ey recipes apply # to select environment
48
+ * Boot your environment if not already booted.
49
+ When the recipe completes, your project will commence its first build on Jenkins CI.
50
+ """
51
+
52
+
53
+
@@ -0,0 +1,69 @@
1
+ Feature: Managing ey jenkins server
2
+ I want to install a Jenkins CI server hosted on Engine Yard AppCloud
3
+
4
+ Background:
5
+ Given I have setup my engineyard email/password for API access
6
+ And I have "two accounts, two apps, two environments, ambiguous"
7
+ And I want to fake out the boot sequence of Jenkins
8
+
9
+ Scenario: Install new Jenkins CI server on AppCloud
10
+ When I run local executable "ey-jenkins" with arguments "install_server . --account account_2 --environment giblets"
11
+ Then file "cookbooks/main/recipes/default.rb" is created
12
+ And file "cookbooks/jenkins_master/recipes/default.rb" is created
13
+ And file "cookbooks/jenkins_master/attributes/default.rb" contains ":plugins => %w[git github rake ruby greenballs envfile]"
14
+ And I should see exactly
15
+ """
16
+ create cookbooks
17
+ create cookbooks/jenkins_master/recipes/default.rb
18
+ create cookbooks/jenkins_master/templates/default/init.sh.erb
19
+ create cookbooks/jenkins_master/templates/default/proxy.conf.erb
20
+ create cookbooks/main/attributes/recipe.rb
21
+ create cookbooks/main/definitions/ey_cloud_report.rb
22
+ create cookbooks/main/libraries/ruby_block.rb
23
+ create cookbooks/main/libraries/run_for_app.rb
24
+ create cookbooks/main/recipes/default.rb
25
+ create cookbooks/jenkins_master/attributes/default.rb
26
+
27
+ Uploading to 'giblets' environment on 'account_2' account...
28
+ Environment is rebuilding...
29
+ ..
30
+ Jenkins is starting...
31
+ .
32
+ Done! Jenkins CI hosted at http://app-master-hostname.compute-1.amazonaws.com
33
+ """
34
+ When I run executable "jenkins" with arguments "default_host"
35
+ Then I should see "http://app-master-hostname.compute-1.amazonaws.com"
36
+
37
+ @wip
38
+ Scenario: Install Jenkins CI server with additional Jenkins plugins
39
+ When I run local executable "ey-jenkins" with arguments "install_server . -p ' chucknorris , googleanalytics ' -c account_2 -e giblets"
40
+ Then file "cookbooks/main/recipes/default.rb" is created
41
+ And file "cookbooks/jenkins_master/recipes/default.rb" is created
42
+ And file "cookbooks/jenkins_master/attributes/default.rb" contains ":plugins => %w[git github rake ruby greenballs envfile chucknorris googleanalytics]"
43
+
44
+ Scenario: Display example explicit calls if multiple accounts/options
45
+ When I run local executable "ey-jenkins" with arguments "install_server . -e giblets"
46
+ Then file "cookbooks/main/recipes/default.rb" is not created
47
+ And I should see exactly
48
+ """
49
+ Multiple environments possible, please be more specific:
50
+
51
+ ey-jenkins install_server --environment 'giblets' --account 'main'
52
+ ey-jenkins install_server --environment 'giblets' --account 'account_2'
53
+ """
54
+
55
+ Scenario: Ask for environment/account details if no obvious jenkins environment on AppCloud
56
+ When I run local executable "ey-jenkins" with arguments "install_server ."
57
+ Then file "cookbooks/main/recipes/default.rb" is not created
58
+ And I should see exactly
59
+ """
60
+ No environments with name jenkins, jenkins_server, jenkins_production, jenkins_server_production.
61
+ Either:
62
+ * Create an AppCloud environment called jenkins, jenkins_server, jenkins_production, jenkins_server_production
63
+ * Use --environment/--account flags to select AppCloud environment
64
+ """
65
+
66
+
67
+
68
+
69
+