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. Supports auto detection of capabilities on remote agents for ruby
and xvfb-run
types, as well as allows for configured shared capabilies.
Before getting started, it may be of interest to use docker-rails with Bamboo for fully discrete execution environments. This is a different approach that does not use a plugin. Otherwise, continue on! Nothing to see here!
Via Bamboo tasks, this plugin enables configure a ruby runtime environment once per plan and run:
bundle exec
and xvfb-run
options)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:
Administration | Server capabilities
and click Detect server capabilities
This is still a bit clunky, but a shared runtime configuration is much more maintainable than the known alternatives. (ideas are welcome)
Administration | Server capabilities
and click Detect server capabilities
, this will detect existing RVM/ruby and their associated gemsets.Create | Create a new plan
and fill out appropriate information then click Configure tasks
Create
without the plan enabled (this is a workaround for configuring a global ruby runtime)Actions | Configure plan
Miscellaneous
tab to select the appropriate RVM or ruby runtime and set any common environment variablesTasks
tabStage
i.e. Default Stage
Add task
and choose your weapon of choice i.e. Bundler Install
, Bundler CLI
, Rake
, or Capistrano
Rails app to be deployed to AWS Elastic Beanstalk
Assumes you have followed Installation and Usage above.
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.
eb:package
, eb:yml
, eb:gemfiles
listed.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 tasks
section of your Job with **/test-reports/*.xml
in the Specify custom results directories
field.
Edit the config/cucumber.yml
and change the std_opts
to include the junit
formatter 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 tasks
section of your Job with **/test-reports/*.xml
in the Specify custom results directories
field (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.
Setup your development environment according to the wiki (and feel free to update the instructions with anything missing)
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)We include an eclipse formatting-standard.xml
in the root to make changes easier to understand for all contributors.