-
Notifications
You must be signed in to change notification settings - Fork 75
/
task
executable file
·59 lines (49 loc) · 1.49 KB
/
task
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash -eux
# shellcheck disable=SC1091
source cf-deployment-concourse-tasks/shared-functions
optional_submodule_bump() {
set +x
if [ -z "${BUMP_SUBMODULE}" ] && ! [ -z "${SUBMODULE_BRANCH}" ]; then
echo "SUBMODULE_BRANCH must not be set without a path set for BUMP_SUBMODULE"
exit 1
fi
if [ -z "${SUBMODULE_BRANCH}" ] && ! [ -z "${BUMP_SUBMODULE}" ]; then
echo "BUMP_SUBMODULE must not be set without a ref set for SUBMODULE_BRANCH"
exit 1
fi
set -x
if ! [ -z "${BUMP_SUBMODULE}" ]; then
pushd "release/${BUMP_SUBMODULE}"
git checkout "${SUBMODULE_BRANCH}"
git pull
popd
fi
}
main() {
local root_dir
root_dir="${1}"
check_input_params
optional_submodule_bump
setup_bosh_env_vars
local release_name
release_name="$(yq -r '.name' release/config/final.yml)"
if [[ "${release_name}" == "null" ]]; then
release_name="$(yq -r '.final_name' release/config/final.yml)"
fi
if [[ "${release_name}" == "null" ]]; then
echo "Expected non-empty 'name' or 'final_name' in release/config/final.yml"
exit 1
fi
if [[ -r "${root_dir}/release_tarball_name/name" ]]; then
bosh_interpolate "${root_dir}" "${release_name}" "$(cat ${root_dir}/release_tarball_name/name)"
else
bosh_interpolate "${root_dir}" "${release_name}"
fi
if [ "$REGENERATE_CREDENTIALS" == true ]; then
remove_credentials_from_credhub
fi
upload_stemcells
# shellcheck disable=SC2086
bosh_deploy ${BOSH_DEPLOY_ARGS}
}
main "${PWD}"