#!/usr/bin/env sh set -eux #set -o pipefail _init_env() { # leading colon force successful return code : ${PUBLISH:=0} # If unset, default to 0 : ${REGISTRY:=docker.sendgrid.net} : ${NAMESPACE:=${USER}} : ${APPNAME=gridium} : ${COMPOSE_PROJECT_NAME:=$APPNAME} # If we're "jenkins" and on the "origin/master" branch, push to 'docker.sendgrid.net/sendgrid' [[ "${USER}" == "jenkins" ]] && [[ "${GIT_BRANCH}" == "origin/master" ]] && NAMESPACE=sendgrid export PUBLISH export REGISTRY export NAMESPACE export APPNAME export COMPOSE_PROJECT_NAME export BUILD_NUMBER } run_test(){ docker exec $(docker-compose ps -q gridium) bundle install; sleep 4 docker exec $(docker-compose ps -q gridium) rake spec } main() { echo "**** Arguments: $@" # Cleanup regardless trap bin/cleanup EXIT _init_env if [[ "${SKIPDOCKERPULL:=0}" -eq 1 ]]; then echo "Skipping docker pull" else bin/pull fi bin/start -i run_test } main