Public Repository

Last pushed: 2 months ago
Short Description
Jenkins CI, instrumented for Ruby-based projects, Selenium testing, and email notification
Full Description

Description

A collection of Dockerfiles for various methods of building a Jenkins
CI used for testing a Rails Web application.

  • images/jenkins-redis-postgres - docker-compose.yml and Makefile to
    start up necessary containers, making use of whichever jenkins image
    has been tagged with gonebusy/ci
  • images/jenkins-with-postfix - fully functioning image with Postfix
    for build notifications. Requires use of AWS IAM role-based authentication/authorization.
  • images/jenkins-with-sns - fully functioning image with AWS SNS for
    build notifications. Requires use of AWS IAM role-based authentication/authorization.
  • images/jenkins-ansible - (experimental) image leveraging Ansible
    roles. still under development.

Features

Various features are supported:

  • based on Ubuntu 14.04
  • Jenkins
  • git-lfs - NOTE: There is currently a bug in Jenkins git-plugin preventing proper functioning of checkout for repos that use git-lfs. Track the issue with workaround here.
  • RVM
  • Ruby 2.1.5 (via RVM)
  • Firefox - for Selenium-based tests
  • Xvfb - for headless Firefox
  • Postfix (only jenkins-with-postfix)
  • AWS SNS (only jenkins-with-sns)
  • Thinbackup support - will pull the most recent Thinbackup-created backup from S3 location, if found

Arguments

  • MAIL_DOMAIN - domain for Postfix to use
  • MAIL_FQDN - fully qualified hostname for the CI machine
  • S3_BACKUP_BUCKET - S3 bucket storing buckets
  • S3_BACKUP_PATH - path under S3 bucket

Sample Build Command

docker build --rm=true --build-arg MAIL_FQDN=ci.example.com --build-arg MAIL_DOMAIN=example.com \
  --build-arg S3_BACKUP_BUCKET=backup.example.com --build-arg S3_BACKUP_PATH=jenkins \
  -t jenkins-ci images/jenkins-with-postfix

docker build --rm=true --build-arg S3_BACKUP_BUCKET=backup.example.com --build-arg S3_BACKUP_PATH=jenkins \
  -t jenkins-ci images/jenkins-with-sns

Sample Container Run Command

docker run -p 8080:8080 -it jenkins-ci

Sample Jenkins Job Execution shell script

#!/bin/bash

# !!! DON'T FORGET TO SET SCREEN RESOLUTION OF 1600x1200x16 IN PLUGIN !!!
# export the DISPLAY so Capybara/FF can find Xvfb...
export DISPLAY=:$EXECUTOR_NUMBER
echo "DISPLAY=$DISPLAY"

# ensure that RVM hooks run...
cd .

# install bundler if not present...
gem install --no-ri --no-rdoc bundler

# update gems
bundle install --local

cp config/database.yml.ci config/database.yml
cp config/environments/test.rb.default config/environments/test.rb

RAILS_ENV=test rake db:drop
RAILS_ENV=test rake db:setup
RAILS_ENV=test rake db:migrate
bundle exec rake spec
Docker Pull Command
Owner
alexagranov

Comments (0)