#!/bin/bash -exu

main() {
  local build_dir="${PWD}"
  local output_dir="$PWD/updated-bbl-state/"
  local env_assets="$PWD/bosh-src/ci/acceptance"

  mkdir -p bbl-state

  pushd bbl-state
    bbl version
    bbl plan > bbl_plan.txt

    # Customize environment
    cp $env_assets/*.sh .

    bbl --debug up

    cp bbl-state.json "${output_dir}"

    eval "$(bbl print-env)"
    bosh upload-stemcell ${build_dir}/stemcell/*.tgz -n
    bosh -d zookeeper deploy --recreate ${build_dir}/zookeeper-release/manifests/zookeeper.yml -n
  popd
}

main


#!/bin/bash -exu

save_state() {
  local output_dir=$1
  cp bbl-state.json "${output_dir}"
}

main() {
  local build_dir="${PWD}"
  local output_dir="$PWD/updated-bbl-state/"
  local env_assets="$PWD/bosh-src/ci/acceptance"

  trap "save_state ${output_dir}" EXIT

  mkdir -p bbl-state

  pushd bbl-state
    bbl version
    bbl plan > bbl_plan.txt

    # Customize environment
    cp $env_assets/*.sh .

    bbl --debug up

    eval "$(bbl print-env)"
    bosh upload-stemcell ${build_dir}/stemcell/*.tgz -n
    bosh -d zookeeper deploy --recreate ${build_dir}/zookeeper-release/manifests/zookeeper.yml -n
  popd
}

main "$@"


Make sure we move bbl-state to output directory
Make sure we move bbl-state to output directory

[#158917576](https://www.pivotaltracker.com/story/show/158917576)

Co-authored-by: Joshua Aresty <18e47c05d12d69c65baf02b69e877c81d203331d@emc.com>
