Skip to content

Instantly share code, notes, and snippets.

@jmcarp
Created July 15, 2016 01:22
Show Gist options
  • Select an option

  • Save jmcarp/911e81b7c38dfe8c833baeb255173874 to your computer and use it in GitHub Desktop.

Select an option

Save jmcarp/911e81b7c38dfe8c833baeb255173874 to your computer and use it in GitHub Desktop.
jumpbox
#!/usr/bin/expect
set timeout 30
set target [lindex $argv 0];
set environment [lindex $argv 1];
spawn ./trigger.sh $target $environment
expect "choose a container"
set lines [split $expect_out(buffer) \n]
set count [llength $lines]
set index [expr {$count - 3}]
send $index\r
interact
#/bin/bash
set -e
target=${1}
environment=${2}
trigger=$(fly -t ${target} trigger-job -j jumpbox/container-bosh-${environment})
build=$(echo ${trigger} | sed 's/.*#\([0-9]\{1,\}\)/\1/')
while ! containers=$(fly -t ${target} containers | grep "task" | grep "container-bosh-${environment}\s\{1,\}${build}\s")
do
sleep 1
done
fly -t ${target} intercept -j jumpbox/container-bosh-${environment} -b ${build} -s jumpbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment