Skip to content

Fix unbound variable from get_ocp_docs.sh#86

Open
umago wants to merge 1 commit intoopenstack-lightspeed:mainfrom
umago:unbound-var-ocp
Open

Fix unbound variable from get_ocp_docs.sh#86
umago wants to merge 1 commit intoopenstack-lightspeed:mainfrom
umago:unbound-var-ocp

Conversation

@umago
Copy link
Contributor

@umago umago commented Jan 28, 2026

Trivial fix for the get_ocp_docs.sh script, trying to use it without setting the OLS_DOC_REPO and OCP_VERSIONS explicitly failed with an "unbound variable" error instead of fallbacking to the default values.

Trivial fix for the get_ocp_docs.sh script, trying to use it without
setting the OLS_DOC_REPO and OCP_VERSIONS explicitly failed with an
"unbound variable" error instead of fallbacking to the default values.

Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
@umago umago requested a review from a team as a code owner January 28, 2026 14:00
Copy link
Contributor

@lpiwowar lpiwowar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!:)

OLS_DOC_REPO=${OLS_DOC_REPO:-"https://github.com/openshift/lightspeed-rag-content.git"}
# OpenShift Versions to create DBs for
# If we set it to empty string, it will generate all the available ones.
OCP_VERSIONS=${OCP_VERSIONS:-"4.16 4.18 latest"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing code is tailored for our current make target.
Your change breaks it because we always pass it:

OCP_VERSIONS ?= ""

I advocate for removing the u on the set command.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Akrog how does the change break the compatibility with the Makefile exactly? Maybe my brain is not thinking enough today but I really do not see it.

IMO this changes keeps the existing behavior intact plus ensures that the script can be used nicely standalone even without the Makefile (by dealing with the unbound variable). I like it.

I would keep the -u. I like the strictness of it. But I do not have super strong opinion on this.

Copy link
Contributor Author

@umago umago Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Akrog thanks for the review.

@lpiwowar I think he means as the comment in the code says, if the variable is empty it will generate the docs for all available versions. But with my change, if the variable is empty it will then fallback to the default values.

I think the behavior is strange but yeah my change does break that assumption indeed. I will keep this open so we can discuss what would be best.

For context, the reason I made this change is because I was working on the per-rendering of the docs and I used the scripts in standalone mode, then I noticed this problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking at the code and if the variable is empty it will fallback to the default values as well... So I don't think this break anything ?

The comment in the code is not accurate, because in other to build all available versions we need to set OCP_VERSIONS="all"

# If "all" versions, we need to list them ourselves
if [ "$OCP_VERSIONS" == "all" ]; then
OCP_VERSIONS="$(find lightspeed-rag-content/ocp-product-docs-plaintext/* -maxdepth 0 -printf '%f ')"
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants