Skip to content

Commit

Permalink
Allow bosh deploy with custom release tarball
Browse files Browse the repository at this point in the history
  • Loading branch information
acosta11 and davewalter committed Aug 27, 2019
1 parent 93d71cf commit 1e0a4a9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
8 changes: 7 additions & 1 deletion bosh-deploy-with-created-release/task
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ main() {
check_input_params
optional_submodule_bump
setup_bosh_env_vars
bosh_interpolate "${root_dir}" "$(grep final_name release/config/final.yml | awk '{print $2}')"

if [[ -r "${root_dir}/release_tarball_name/name" ]]; then
bosh_interpolate "${root_dir}" "$(grep final_name release/config/final.yml | awk '{print $2}')" "$(cat ${root_dir}/release_tarball_name/name)"
else
bosh_interpolate "${root_dir}" "$(grep final_name release/config/final.yml | awk '{print $2}')"
fi

if [ "$REGENERATE_CREDENTIALS" == true ]; then
remove_credentials_from_credhub
fi
Expand Down
10 changes: 8 additions & 2 deletions bosh-deploy-with-created-release/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ inputs:
- name: ops-files # - Operations files to be made available
- name: vars-files # - Variable files to be made available
- name: release
# - BOSH release source repo
# - A dev release will be created from this repo and used in the deployment
# - BOSH release source repo or directory containing a release tarball
# - If the input is a git repository, a dev release will be created from
# this repo and used in the deployment. If the input is a directory
# containing a pre-built release tarball, then the release_tarball_name
# input needs to point at a directory containing a "name" file containing
# the full name of the tarball to be used.
- name: release_tarball_name
optional: true
- name: cf-deployment-concourse-tasks # - This repo

run:
Expand Down
17 changes: 16 additions & 1 deletion shared-functions
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ function bosh_interpolate() {

local release_name
release_name="${2}"

local release_tarball_name
release_tarball_name="${3}"
set -u

local bosh_manifest
Expand All @@ -112,7 +115,17 @@ function bosh_interpolate() {
done

if [ -n "${release_name}" ]; then
cat << EOF > create-provided-release.yml
if [ -n "${release_tarball_name}" ]; then
cat << EOF > create-provided-release.yml
---
- type: replace
path: /releases/name=${release_name}
value:
name: ${release_name}
url: file://${root_dir}/release/${release_tarball_name}
EOF
else
cat << EOF > create-provided-release.yml
---
- type: replace
path: /releases/name=${release_name}
Expand All @@ -121,6 +134,8 @@ function bosh_interpolate() {
version: create
url: file://${root_dir}/release
EOF
fi

arguments="${arguments} -o create-provided-release.yml"
fi

Expand Down

0 comments on commit 1e0a4a9

Please sign in to comment.