Skip to content

Commit

Permalink
Use an empty config file to produce docs
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Apolinario <[email protected]>
  • Loading branch information
eapolinario committed Dec 6, 2024
1 parent 9dc21f4 commit 616dbdd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ docs/examples
docs/_src
docs/_projects
docs/tests
empty-config.yaml
39 changes: 22 additions & 17 deletions script/generate_config_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 re-use it to invoke the docs command in all components.

Check failure on line 21 in script/generate_config_docs.sh

View workflow job for this annotation

GitHub Actions / Check for spelling errors

re-use ==> reuse
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
Expand Down

0 comments on commit 616dbdd

Please sign in to comment.