Make site validation runnable on external sites
This tweaks the site manifest validation scripts so that they can be run on sites outside the airshipctl repository. The result can be used to validate sites in the treasuremap repository, operator-specific repositories, etc. Change-Id: I39d7cdcdc748e9ad71e735b9f1294acdf3db81a8
This commit is contained in:
parent
7c6f727783
commit
7d29ef51eb
@ -14,7 +14,14 @@
|
||||
|
||||
set -e
|
||||
|
||||
: ${PROJECT_ROOT:=${PWD}}
|
||||
# The root of the manifest structure to be validated.
|
||||
# This corresponds to the targetPath in an airshipctl config
|
||||
: ${MANIFEST_ROOT:="${PWD}"}
|
||||
# The location of sites whose manifests should be validated.
|
||||
# This are relative to MANIFEST_ROOT above, and correspond to
|
||||
# the base of the subPath in an airshipctl config
|
||||
: ${SITE_ROOT:="manifests/site"}
|
||||
|
||||
: ${SITE:="test-workload"}
|
||||
: ${CONTEXT:="kind-airship"}
|
||||
: ${KUBECONFIG:="${HOME}/.airship/kubeconfig"}
|
||||
@ -89,8 +96,8 @@ manifests:
|
||||
force: false
|
||||
tag: ""
|
||||
url: https://opendev.org/airship/treasuremap
|
||||
subPath: manifests/site/${SITE}
|
||||
targetPath: .
|
||||
subPath: ${SITE_ROOT}/${SITE}
|
||||
targetPath: ${MANIFEST_ROOT}
|
||||
users:
|
||||
${CONTEXT}_${cluster}: {}
|
||||
EOL
|
||||
@ -104,7 +111,7 @@ trap cleanup EXIT
|
||||
|
||||
# Loop over all cluster types and phases for the given site
|
||||
for cluster in ephemeral target; do
|
||||
if [[ -d "manifests/site/${SITE}/${cluster}" ]]; then
|
||||
if [[ -d "${MANIFEST_ROOT}/${SITE_ROOT}/${SITE}/${cluster}" ]]; then
|
||||
echo -e "\n**** Rendering phases for cluster: ${cluster}"
|
||||
# Start a fresh, empty kind cluster for validating documents
|
||||
./tools/document/start_kind.sh
|
||||
@ -126,7 +133,7 @@ for cluster in ephemeral target; do
|
||||
|
||||
for phase in $phases; do
|
||||
# Guard against bootstrap or initinfra being missing, which could be the case for some configs
|
||||
if [ -d "manifests/site/${SITE}/${cluster}/${phase}" ]; then
|
||||
if [ -d "${MANIFEST_ROOT}/${SITE_ROOT}/${SITE}/${cluster}/${phase}" ]; then
|
||||
echo -e "\n*** Rendering ${cluster}/${phase}"
|
||||
|
||||
# step 1: actually apply all crds in the phase
|
||||
|
@ -16,6 +16,14 @@
|
||||
# Expected to be run from the project root
|
||||
set -xe
|
||||
|
||||
# The root of the manifest structure to be validated.
|
||||
# This corresponds to the targetPath in an airshipctl config
|
||||
: ${MANIFEST_ROOT:="${PWD}"}
|
||||
# The space-separated locations of sites whose manifests should be validated.
|
||||
# These are relative to MANIFEST_ROOT above, and correspond to
|
||||
# the base of the subPath in an airshipctl config
|
||||
: ${SITE_ROOTS:="manifests/site"}
|
||||
|
||||
# get kind
|
||||
echo "Fetching kind from ${KIND_URL}..."
|
||||
TMP=$(KIND_URL=${KIND_URL} ./tools/document/get_kind.sh)
|
||||
@ -24,9 +32,12 @@ export KUBECTL_URL
|
||||
|
||||
./tools/document/build_kustomize_plugin.sh
|
||||
|
||||
for site in $(ls manifests/site); do
|
||||
echo -e "\nValidating site: ${site}\n****************"
|
||||
SITE=${site} ./tools/document/validate_site_docs.sh
|
||||
echo "Validation of site ${site} is succesful!"
|
||||
for site_root in ${SITE_ROOTS}; do
|
||||
for site in $(ls ${MANIFEST_ROOT}/${site_root}); do
|
||||
echo -e "\nValidating site: ${MANIFEST_ROOT}/${site_root}/${site}\n****************"
|
||||
MANIFEST_ROOT=${MANIFEST_ROOT} SITE_ROOT=${site_root} SITE=${site} \
|
||||
./tools/document/validate_site_docs.sh
|
||||
echo "Validation of site ${site} is succesful!"
|
||||
done
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user