From 1e0a4a9c61057bc08674d8d63beb417c3c124c43 Mon Sep 17 00:00:00 2001 From: Andrew Costa Date: Mon, 26 Aug 2019 12:26:18 -0700 Subject: [PATCH] Allow bosh deploy with custom release tarball [#167721359](https://www.pivotaltracker.com/story/show/167721359) Co-authored-by: Dave Walter --- bosh-deploy-with-created-release/task | 8 +++++++- bosh-deploy-with-created-release/task.yml | 10 ++++++++-- shared-functions | 17 ++++++++++++++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/bosh-deploy-with-created-release/task b/bosh-deploy-with-created-release/task index 785b23e9..ef57ebf2 100755 --- a/bosh-deploy-with-created-release/task +++ b/bosh-deploy-with-created-release/task @@ -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 diff --git a/bosh-deploy-with-created-release/task.yml b/bosh-deploy-with-created-release/task.yml index c3085930..ede4a854 100644 --- a/bosh-deploy-with-created-release/task.yml +++ b/bosh-deploy-with-created-release/task.yml @@ -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: diff --git a/shared-functions b/shared-functions index 1d750a0b..38217e3e 100644 --- a/shared-functions +++ b/shared-functions @@ -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 @@ -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} @@ -121,6 +134,8 @@ function bosh_interpolate() { version: create url: file://${root_dir}/release EOF + fi + arguments="${arguments} -o create-provided-release.yml" fi