This continuous integration/continuous deployment plugin for Atlassian Bamboo enables easy configuration of build and deployment tasks to run various ruby based build tools including bundler, rake, and capistrano.
Via Bamboo tasks, this plugin enables configure a ruby runtime environment once per plan and run:
- Bundler
- Rake (with
bundle execandxvfb-runoptions) - Capistrano
Using the miscellaneous tab on the plan configuration, you can select the appropriate RVM environment as well as specify common environment variables such as RAILS_ENV. These settings are shared across all build and deploy tasks.
The preferred method for managing ruby runtimes and gemsets is RVM.
Notes:
- The RVM utilized is exclusively designated in the Bamboo Plan Miscellaneous tab and does not recognize any files such as .rvmrc, .ruby-version or .ruby-manager.
- If your latest RVM gemset is not showing up in the dropdown, navigate to the Bamboo
Administration | Server capabilitiesand clickDetect server capabilities
Download the plugin binary or get via Atlassian UPM
This is still a bit clunky, but a shared runtime configuration is much more maintainable than the known alternatives. (ideas are welcome)
- Install the
bamboozled-ruby-plugin
- Obtain via the Atlassian Plugin site (TODO)
- or download the binary and upload to via the Bamboo universal plugin manager.
- Navigate to the Bamboo
Administration | Server capabilitiesand clickDetect server capabilities, this will detect existing RVM/ruby and their associated gemsets. - Configure a New Plan:
Create | Create a new planand fill out appropriate information then clickConfigure tasks- Skip adding tasks and click
Createwithout the plan enabled (this is a workaround for configuring a global ruby runtime) - Now follow the existing plan instructions starting with second bullet below
- Existing Plan
- Choose
Actions | Configure plan - Choose the
Miscellaneoustab to select the appropriate RVM or ruby runtime and set any common environment variables - Choose the
Taskstab - Choose the
Stagei.e.Default Stage - Click
Add taskand choose your weapon of choice i.e.Bundler Install,Bundler CLI,Rake, orCapistrano
Rails app to be deployed to AWS Elastic Beanstalk
Assumes you have followed Installation and Usage above.
-
Add a Source Code Checkout task
-
Add a Bundler Install task (it should display the RVM chosen if you followed the Installation and Usage instructions)
-
Add a Rake task:
Tasks: db:drop db:create db:migrate db:seed spec cucumber Additional Environment Variables: RAILS_ENV=test Bundler Exec: checked -
Optional step to package elastic-beanstalk for deployment. Add a Rake task:
Tasks: eb:package Additional Environment Variables: RAILS_ENV=test Bundler Exec: checked
To AWS Elastic Beanstalk
Assumes you have followed the Example Build Configuration above, and that the build produces the artifacts eb:package, eb:yml, eb:gemfiles for an elastic-beanstalk deployment.
-
Add a Clean working directory task.
-
Add an Artifact download task with each of
eb:package,eb:yml,eb:gemfileslisted. -
Add a Bundler Install task (it should display the RVM chosen if you followed the Installation and Usage instructions)
-
Add a Bundler CLI task:
Task description: bundle binstubs elastic-beanstalk Arguments: binstubs elastic-beanstalk -
Add a Bundle CLI task:
Task description: bundle exec ./bin/elastic-beanstalk eb:deploy Arguments: ./bin/elastic-beanstalk eb:deploy[${bamboo.buildNumber}] Additional Environment Variables: RAILS_ENV=staging Bundler Exec: checked
The Bundler Install task by default is setup to quickly execute bundle install dependencies during the build process. Note will only work when RVM is installed in the home directory of the user the build server is running under.
The Bundler CLI is setup to allow for any variations on command line execution of bundler
The Rake task has the option to be run from bundle exec, as well as prefixed with xvfb-run -a for headless exection of tests.
To enable the RSpec JUnit XML Formatter
-
Add the this fragment to your Gemfile.
group :test do gem "rspec_junit_formatter" end -
Edit your the .rspec file in the base of your project and replace the contents with.
--format RspecJunitFormatter --out test-reports/rspec.xml -
Add a JUnit Parser task to the
Final taskssection of your Job with**/test-reports/*.xmlin theSpecify custom results directoriesfield.
-
Edit the
config/cucumber.ymland change thestd_optsto include thejunitformatter as well as specifiy the output directory. For example:std_opts = "-r features/support/ -r features/step_definitions --quiet -f pretty -f junit -o test-reports --strict --tags ~@wip --tags ~@todo" -
Add a JUnit Parser task to the
Final taskssection of your Job with**/test-reports/*.xmlin theSpecify custom results directoriesfield (if not already done for rspec above).
We use Linux, RVM, Bundler and Rake in a continuous integration/continuous deployment environment. These will have the most attention given to them, while Windows and other ruby configurations (i.e. rbenv, system rubies) will likely be neglected unless contributors step up to fill the gaps (which we welcome!).
Please contribute! We will readily accept contributions and try to stay on top of them. Any contribution should contain additional Junit tests and all tests should pass.
- More reuse to reduce duplicate code
- Make available via Atlassian UPM (@rosskevin)
Setup your development environment according to the wiki (and feel free to update the instructions with anything missing)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
We include an eclipse formatting-standard.xml in the root to make changes easier to understand for all contributors.