Skip to content

Commit

Permalink
Make bosh-cli work with 1.5.1 concourse
Browse files Browse the repository at this point in the history
Because latest concourse doesn't support exec when using custom resources
( concourse/concourse#318 )
we instead run a bosh-cli job defined directly in the pipeline and hijack
it.
  • Loading branch information
mtekel committed Jul 25, 2016
1 parent b0c38ae commit 23375c7
Showing 1 changed file with 4 additions and 39 deletions.
43 changes: 4 additions & 39 deletions concourse/scripts/bosh-cli.sh
Expand Up @@ -13,44 +13,9 @@ $("${SCRIPT_DIR}/environment.sh")
OUTPUT_FILE=$(mktemp -t bosh-cli.XXXXXX)
trap 'rm -f "${OUTPUT_FILE}"' EXIT

generate_config(){
cat <<EOF
---
platform: linux
image_resource:
type: docker-image
source:
repository: governmentpaas/bosh-cli
inputs:
- name: paas-cf
- name: cf-manifest
- name: bosh-secrets
run:
path: sh
args:
- -c
- -e
- |
./paas-cf/concourse/scripts/bosh_login.sh bosh.${SYSTEM_DNS_ZONE_NAME} bosh-secrets/bosh-secrets.yml
$FLY_CMD -t "${FLY_TARGET}" trigger-job -j create-bosh-cloudfoundry/bosh-cli -w | tee "${OUTPUT_FILE}"

uuid=\$(bosh status --uuid)
sed -e "s/^director_uuid:.*$/director_uuid: \${uuid}/" cf-manifest/cf-manifest.yml > cf-manifest-with-uuid.yml
bosh deployment ./cf-manifest-with-uuid.yml
EOF
}
BUILD_NUMBER=$(awk '/started create-bosh-cloudfoundry\/bosh-cli/ { print $3 }' "${OUTPUT_FILE}" | tr -d '#')

generate_config > /dev/null

$FLY_CMD -t "${FLY_TARGET}" \
execute \
--inputs-from=create-bosh-cloudfoundry/cf-deploy \
--config=<(generate_config) \
| tee "${OUTPUT_FILE}"

BUILD_NUMBER=$(awk '/executing build/ { print $3 }' "${OUTPUT_FILE}")

$FLY_CMD -t "${FLY_TARGET}" \
intercept \
--build="${BUILD_NUMBER}"\
--step=one-off \
"${@:-sh}"
$FLY_CMD -t "${FLY_TARGET}" intercept -j create-bosh-cloudfoundry/bosh-cli -b "${BUILD_NUMBER}" \
-s run-bosh-cli "${@:-ash}"

0 comments on commit 23375c7

Please sign in to comment.