From 663527ceebac74b40972fbda2161434f62fe06e1 Mon Sep 17 00:00:00 2001 From: James Gu Date: Mon, 7 Jun 2021 15:00:55 -0400 Subject: [PATCH] Allow validate script to read airship config Changed the validate script to read the airship config file for manifest root, site root, and repo url values. This enables the use case where the user runs the init_site script and creates their own project and site folder outside of the treasuremap directory strucuture. Change-Id: I0eefdc385bffa600f5e942cec14f42ebd392782f --- tools/validate_docs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tools/validate_docs b/tools/validate_docs index a6903ec22..5970c7b30 100755 --- a/tools/validate_docs +++ b/tools/validate_docs @@ -17,9 +17,21 @@ set -xe : ${AIRSHIPCTL_PROJECT:="../airshipctl"} -: ${MANIFEST_ROOT:="$(dirname "${PWD}")"} -: ${SITE_ROOTS:="$(basename "${PWD}")/manifests/site"} -: ${MANIFEST_REPO_URL:="https://review.opendev.org/airship/treasuremap"} +: ${CURRENT_MANIFEST:="$(airshipctl config get-contexts --current 2> /dev/null | \ + yq '.contexts."ephemeral-cluster".manifest' | \ + sed 's/"//g')"} +: ${PRIMARY_REPO:="$(airshipctl config get-manifest $CURRENT_MANIFEST 2> /dev/null | \ + yq .${CURRENT_MANIFEST}.phaseRepositoryName | \ + sed 's/"//g')"} +: ${MANIFEST_REPO_URL:="$(airshipctl config get-manifest $CURRENT_MANIFEST 2> /dev/null | \ + yq .${CURRENT_MANIFEST}.repositories.${PRIMARY_REPO}.url | \ + sed 's/"//g')"} +: ${MANIFEST_ROOT:="$(airshipctl config get-manifest $CURRENT_MANIFEST 2> /dev/null | \ + yq .${CURRENT_MANIFEST}.targetPath | \ + sed 's/"//g')"} +: ${PROJECT:="treasuremap"} +: ${SITE_ROOTS:="${PROJECT}/manifests/site"} + export MANIFEST_ROOT=$MANIFEST_ROOT export SITE_ROOTS=$SITE_ROOTS export MANIFEST_REPO_URL=$MANIFEST_REPO_URL