Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions scripts/generate-acceptance-tests-manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/bash

set -e

manifest_generation=$(dirname $0)/../manifest-generation
S=" - "

function usage() {
>&2 echo -e " Errors:\n${ERR_MSG}\n Usage:
$0 <MANDATORY ARGUMENTS>
Mandatory arguments:
-c CF manifest file
-i IaaS-settings stub file
-p property-overrides stub file

Example:
$0 -c ~/deployments/cf.yml \\
-i manifest-generation/bosh-lite-stubs/iaas-settings.yml \\
-p manifest-generation/bosh-lite-stubs/acceptance-tests-properties.yml
"
exit 1
}

while getopts "c:i:p:" opt; do
case $opt in
c)
deployments=$OPTARG
;;
i)
iaas_settings=$OPTARG
;;
p)
properties=$OPTARG
;;
*)
ERR_MSG="${S}Unknown arguments\n"
;;
esac
done

if [ -z ${deployments} ]; then
ERR_MSG="${ERR_MSG}${S}CF manifest file is missing\n"
fi

if [ -z ${iaas_settings} ]; then
ERR_MSG="${ERR_MSG}${S}IaaS-settings stub file is missing\n"
fi

if [ -z ${properties} ]; then
ERR_MSG="${ERR_MSG}${S}Property-overrides stub file is missing\n"
fi

if [[ ${deployments} && ! -f "${deployments}" ]]; then
ERR_MSG="${ERR_MSG}${S}CF manifest file '${deployments}' is not a regular file\n"
fi

if [[ ${iaas_settings} && ! -f "${iaas_settings}" ]]; then
ERR_MSG="${ERR_MSG}${S}IaaS Setting stub '${iaas_settings}' is not a regular file\n"
fi

if [[ ${properties} && ! -f "${properties}" ]]; then
ERR_MSG="${ERR_MSG}${S}property-overrides stub '${properties}' is not a regular file\n"
fi

if [[ $ERR_MSG ]]; then
usage
fi

tmpdir=$(mktemp -d /tmp/diego-manifest.XXXXX)

spiff merge \
${manifest_generation}/config-from-cf.yml \
${manifest_generation}/config-from-cf-internal.yml \
${deployments} \
> ${tmpdir}/config-from-cf.yml

spiff merge \
${manifest_generation}/misc-templates/bosh.yml \
${manifest_generation}/diego-acceptance-tests.yml \
${properties} \
${tmpdir}/config-from-cf.yml \
${iaas_settings}

rm -rf $tmpdir
83 changes: 83 additions & 0 deletions scripts/generate-smoke-tests-manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash

set -e

manifest_generation=$(dirname $0)/../manifest-generation
S=" - "

function usage() {
>&2 echo -e " Errors:\n${ERR_MSG}\n Usage:
$0 <MANDATORY ARGUMENTS>
Mandatory arguments:
-c CF manifest file
-i IaaS-settings stub file
-p property-overrides stub file

Example:
$0 -c ~/deployments/cf.yml \\
-i manifest-generation/bosh-lite-stubs/iaas-settings.yml \\
-p manifest-generation/bosh-lite-stubs/smoke-tests-properties.yml
"
exit 1
}

while getopts "c:i:p:" opt; do
case $opt in
c)
deployments=$OPTARG
;;
i)
iaas_settings=$OPTARG
;;
p)
properties=$OPTARG
;;
*)
ERR_MSG="${S}Unknown arguments\n"
;;
esac
done

if [ -z ${deployments} ]; then
ERR_MSG="${ERR_MSG}${S}CF manifest file is missing\n"
fi

if [ -z ${iaas_settings} ]; then
ERR_MSG="${ERR_MSG}${S}IaaS-settings stub file is missing\n"
fi

if [ -z ${properties} ]; then
ERR_MSG="${ERR_MSG}${S}Property-overrides stub file is missing\n"
fi

if [[ ${deployments} && ! -f "${deployments}" ]]; then
ERR_MSG="${ERR_MSG}${S}CF manifest file '${deployments}' is not a regular file\n"
fi

if [[ ${iaas_settings} && ! -f "${iaas_settings}" ]]; then
ERR_MSG="${ERR_MSG}${S}IaaS Setting stub '${iaas_settings}' is not a regular file\n"
fi

if [[ ${properties} && ! -f "${properties}" ]]; then
ERR_MSG="${ERR_MSG}${S}property-overrides stub '${properties}' is not a regular file\n"
fi

if [[ $ERR_MSG ]]; then
usage
fi

tmpdir=$(mktemp -d /tmp/diego-manifest.XXXXX)

spiff merge \
${manifest_generation}/config-from-cf.yml \
${manifest_generation}/config-from-cf-internal.yml \
${deployments} \
> ${tmpdir}/config-from-cf.yml
spiff merge \
${manifest_generation}/misc-templates/bosh.yml \
${manifest_generation}/diego-smoke-tests.yml \
${properties} \
${tmpdir}/config-from-cf.yml \
${iaas_settings}

rm -rf $tmpdir