Make validate_doc script reusable in manifest outsite airshipctl

Currently tools path and manifest path is hardcoded in validate_doc
script which make is hard to be resuable outside airshipctl project.
The aim of this PS is to overcome this issue and make validate_doc
script reused (in Make file) outsite airshipctl project manifest.

Change-Id: I2e9277c206e5e0c635c241abf1c4c6ec58f5a592
This commit is contained in:
Pallav Gupta 2021-05-09 18:05:28 -07:00
parent a2b70338c0
commit 0394caea47
2 changed files with 13 additions and 7 deletions

View File

@ -19,13 +19,14 @@ set -xe
: ${MANIFEST_ROOT:="$(basename "${PWD}")/manifests"}
# The location of sites whose manifests should be validated.
# This are relative to MANIFEST_ROOT above
: ${SITE_ROOT:="$(basename "${PWD}")/manifests/site"}
: ${MANIFEST_PATH:="manifests/site"}
: ${SITE_ROOT:="$(basename "${PWD}")/${MANIFEST_PATH}"}
: ${MANIFEST_REPO_URL:="https://review.opendev.org/airship/airshipctl"}
: ${SITE:="test-workload"}
: ${CONTEXT:="kind-airship"}
: ${AIRSHIPKUBECONFIG:="${HOME}/.airship/kubeconfig"}
: ${AIRSHIPKUBECONFIG_BACKUP:="${AIRSHIPKUBECONFIG}-backup"}
: ${TOOLS_PATH:="${MANIFEST_ROOT}/airshipctl/tools"}
: ${KUBECTL:="/usr/local/bin/kubectl"}
TMP=$(mktemp -d)
@ -76,7 +77,7 @@ manifests:
tag: ""
url: ${MANIFEST_REPO_URL}
targetPath: ${MANIFEST_ROOT}
metadataPath: manifests/site/${SITE}/metadata.yaml
metadataPath: ${MANIFEST_PATH}/${SITE}/metadata.yaml
EOL
}
@ -113,7 +114,7 @@ for plan in $phase_plans; do
export CLUSTER="${cluster}"
# Start a fresh, empty kind cluster for validating documents
./tools/document/start_kind.sh
${TOOLS_PATH}/document/start_kind.sh
generate_airshipconf ${cluster}

View File

@ -21,11 +21,14 @@ set -xe
: ${MANIFEST_ROOT:="$(dirname "${PWD}")"}
# The space-separated locations of sites whose manifests should be validated.
# These are relative to MANIFEST_ROOT above
: ${SITE_ROOTS:="$(basename "${PWD}")/manifests/site"}
: ${MANIFEST_PATH:="manifests/site"}
: ${SITE_ROOTS:="$(basename "${PWD}")/${MANIFEST_PATH}"}
: ${MANIFEST_REPO_URL:="https://review.opendev.org/airship/airshipctl"}
: ${TOOLS_PATH:="${MANIFEST_ROOT}/airshipctl/tools"}
# get kind
echo "Fetching kind from ${KIND_URL}..."
TMP=$(KIND_URL=${KIND_URL} ./tools/document/get_kind.sh)
TMP=$(KIND_URL=${KIND_URL} ${TOOLS_PATH}/document/get_kind.sh)
export KIND=${TMP}/kind
export KUBECTL_URL
@ -38,7 +41,9 @@ for site_root in ${SITE_ROOTS}; do
fi
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
MANIFEST_REPO_URL=${MANIFEST_REPO_URL} MANIFEST_PATH=${MANIFEST_PATH} MANIFEST_REPO_URL=${MANIFEST_REPO_URL} \
TOOLS_PATH=${TOOLS_PATH} \
${TOOLS_PATH}/document/validate_site_docs.sh
echo "Validation of site ${site} is successful!"
done
done