Skip to content

Instantly share code, notes, and snippets.

@rkoster
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save rkoster/6d7e9f9e2c5de3577429 to your computer and use it in GitHub Desktop.

Select an option

Save rkoster/6d7e9f9e2c5de3577429 to your computer and use it in GitHub Desktop.
Script for deploying cf with bosh-workspace from CI
# Make ruby 2.0 available
source ~/.bash_profile
# Install gems from Gemfile into vendor/bundle
bundle install --path vendor/bundle
# Install spiff
wget -c https://github.com/cloudfoundry-incubator/spiff/releases/download/v1.0/spiff_linux_amd64.zip
unzip -o spiff_linux_amd64.zip
PATH=$PATH:$WORKSPACE
# Cleanup previous tmp files and set it again
rm -rf /var/lib/jenkins/tmp/$JOB_NAME
mkdir -p /var/lib/jenkins/tmp/$JOB_NAME
export TMPDIR=/var/lib/jenkins/tmp/$JOB_NAME
# Target microbosh and login
bundle exec "bosh -n target <ip>"
bundle exec "bosh -n login admin admin"
# For all deployments in this tenant
for deployment in $(find deployments -name "*dev2*.yml" | sort)
do
# Set deployment and prepare (uploads releases & stemcell)
bundle exec "bosh deployment $deployment"
bundle exec "bosh prepare deployment"
# Deploy
echo "yes" | bundle exec bosh deploy
# Bosh tasks always return normal exit code so check for errors
bundle exec "bosh task last" | tail -n 1 | grep -v error
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment