From 25d84e61724fb1f2bcfd46e63b92e6da8063b1ff Mon Sep 17 00:00:00 2001 From: Eduardo Apolinario <653394+eapolinario@users.noreply.github.com> Date: Fri, 6 Dec 2024 17:35:36 -0500 Subject: [PATCH] Use an empty config file to produce docs (#6092) * Use an empty config file to produce docs Signed-off-by: Eduardo Apolinario * Fix typo Signed-off-by: Eduardo Apolinario --------- Signed-off-by: Eduardo Apolinario Co-authored-by: Eduardo Apolinario --- .gitignore | 1 + script/generate_config_docs.sh | 39 +++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 6b280884f9..80120c5095 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,4 @@ docs/examples docs/_src docs/_projects docs/tests +empty-config.yaml diff --git a/script/generate_config_docs.sh b/script/generate_config_docs.sh index 2a1485aed8..e7358d9057 100755 --- a/script/generate_config_docs.sh +++ b/script/generate_config_docs.sh @@ -3,7 +3,7 @@ set -e echo "Generating Flyte Configuration Documents" -CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +CUR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" ROOT_DIR=${CUR_DIR}/.. OUTPUT_DIR="${ROOT_DIR}"/docs/deployment/configuration/generated GOBIN=${GOPATH:-~/go}/bin @@ -17,30 +17,35 @@ mv flyteadmin/bin/flytescheduler ${GOBIN}/scheduler make -C flytepropeller compile_flytepropeller mv flytepropeller/bin/flytepropeller ${GOBIN}/flytepropeller -output_config () { -CONFIG_NAME=$1 -COMPONENT=$2 -COMMAND=$3 -OUTPUT_PATH=${OUTPUT_DIR}/${COMMAND}_config.rst +# Config files are needed to generate docs, so we generate an empty +# file and reuse it to invoke the docs command in all components. +EMPTY_CONFIG_FILE=empty-config.yaml +touch empty-config.yaml -if [ -z "$CONFIG_NAME" ]; then - log_err "output_config CONFIG_NAME value not specified in arg1" - return 1 -fi +output_config() { + CONFIG_NAME=$1 + COMPONENT=$2 + COMMAND=$3 + OUTPUT_PATH=${OUTPUT_DIR}/${COMMAND}_config.rst -if [ -z "$COMPONENT" ]; then - log_err "output_config COMPONENT value not specified in arg2" - return 1 -fi + if [ -z "$CONFIG_NAME" ]; then + log_err "output_config CONFIG_NAME value not specified in arg1" + return 1 + fi -echo ".. _$COMPONENT-config-specification: + if [ -z "$COMPONENT" ]; then + log_err "output_config COMPONENT value not specified in arg2" + return 1 + fi + + echo ".. _$COMPONENT-config-specification: ######################################### Flyte $CONFIG_NAME Configuration ######################################### -" > "${OUTPUT_PATH}" +" >"${OUTPUT_PATH}" -$GOBIN/$COMMAND config docs >> "${OUTPUT_PATH}" + $GOBIN/$COMMAND config --config $EMPTY_CONFIG_FILE docs >>"${OUTPUT_PATH}" } output_config "Admin" flyteadmin flyteadmin