Merge "Make site validation runnable on external sites"

This commit is contained in:
Zuul 2020-08-05 20:02:40 +00:00 committed by Gerrit Code Review
commit b31d90c1d3
2 changed files with 27 additions and 9 deletions

View File

@ -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

View File

@ -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