Add chatbot param to UI deployment#3095
Add chatbot param to UI deployment#3095dudyas6 wants to merge 1 commit intoopenshift-assisted:masterfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dudyas6 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @dudyas6! It looks like this is your first PR to openshift-assisted/assisted-installer-ui 🎉 |
|
Hi @dudyas6. Thanks for your PR. I'm waiting for a openshift-assisted member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
WalkthroughA new environment variable, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant deploy_config.sh
participant deployment-template.yaml
User->>deploy_config.sh: Run script with optional -c flag
deploy_config.sh->>deploy_config.sh: Parse flags, set AIUI_CHAT_API_URL
deploy_config.sh->>deployment-template.yaml: Substitute __AIUI_CHAT_API_URL__ placeholder
deployment-template.yaml-->>deploy_config.sh: Deployment template ready with correct env variable
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
apps/assisted-ui/deploy/deploy_config.sh (1)
7-9: Update the usage banner to include the new-cflagYou introduced parsing for
-c(chat API URL) but the help string shown byusage()still lists only-t -u -i -n. This will confuse users and automation that rely on-h.- echo "Usage: $0 [ -t deployment-template ] [ -u ASSISTED-SERVICE-URL ] [ -i UI_IMAGE_NAME ] [ -n NAMESPACE ]" 1>&2 + echo "Usage: $0 [ -t deployment-template ] [ -u ASSISTED-SERVICE-URL ] [ -c CHAT-API-URL ] [ -i UI_IMAGE_NAME ] [ -n NAMESPACE ]" 1>&2Also applies to: 19-26
🧹 Nitpick comments (1)
apps/assisted-ui/deploy/deployment-template.yaml (1)
37-38: Remove trailing whitespace to satisfy YAML lint and keep diffs cleanLine 38 has a trailing space that breaks the repository’s lint rule (
trailing-spaces) and adds noise to future diffs.- - name: AIUI_CHAT_API_URL - value: '__AIUI_CHAT_API_URL__'␠ + - name: AIUI_CHAT_API_URL + value: '__AIUI_CHAT_API_URL__'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/assisted-ui/deploy/deploy_config.sh(2 hunks)apps/assisted-ui/deploy/deployment-template.yaml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
apps/assisted-ui/deploy/deployment-template.yaml
[error] 38-38: trailing spaces
(trailing-spaces)
| AIUI_CHAT_API_URL=$(echo ${AIUI_CHAT_API_URL} | sed "s#__NAMESPACE__#${NAMESPACE}#g") | ||
|
|
||
| sed "s#__IMAGE__#${IMAGE}#g; | ||
| s#__ASSISTED_SERVICE_URL__#${ASSISTED_SERVICE_URL}#g; | ||
| s#__AIUI_CHAT_API_URL__#${AIUI_CHAT_API_URL}#g; | ||
| s#__NAMESPACE__#${NAMESPACE}#g" "${INPUT_TEMPLATE}" |
There was a problem hiding this comment.
Escape & characters in URLs before sed substitution to avoid silent corruption
If either URL contains an & (very common in query strings), sed treats it as “replace with matched text”, corrupting the rendered YAML.
Example: http://host/chat?x=1&y=2 becomes http://host/chat?x=1<matched>y=2.
Minimal, low-risk fix:
-ASSISTED_SERVICE_URL=$(echo ${ASSISTED_SERVICE_URL} | sed "s#__NAMESPACE__#${NAMESPACE}#g")
-AIUI_CHAT_API_URL=$(echo ${AIUI_CHAT_API_URL} | sed "s#__NAMESPACE__#${NAMESPACE}#g")
+ASSISTED_SERVICE_URL=$(echo "${ASSISTED_SERVICE_URL//&/\\&}" | sed "s#__NAMESPACE__#${NAMESPACE}#g")
+AIUI_CHAT_API_URL=$(echo "${AIUI_CHAT_API_URL//&/\\&}" | sed "s#__NAMESPACE__#${NAMESPACE}#g")
sed "s#__IMAGE__#${IMAGE}#g;
s#__ASSISTED_SERVICE_URL__#${ASSISTED_SERVICE_URL}#g;
s#__AIUI_CHAT_API_URL__#${AIUI_CHAT_API_URL}#g;
s#__NAMESPACE__#${NAMESPACE}#g" "${INPUT_TEMPLATE}"Alternatively, pre-escape both URLs once with:
escape() { printf '%s' "$1" | sed 's/[&/\]/\\&/g'; }
ASSISTED_SERVICE_URL=$(escape "${ASSISTED_SERVICE_URL//__NAMESPACE__/${NAMESPACE}}")
AIUI_CHAT_API_URL=$(escape "${AIUI_CHAT_API_URL//__NAMESPACE__/${NAMESPACE}}")🤖 Prompt for AI Agents
In apps/assisted-ui/deploy/deploy_config.sh around lines 54 to 59, the URLs used
in sed substitutions may contain '&' characters that sed interprets specially,
causing silent corruption of the output. To fix this, escape all '&' characters
in the URLs before using them in sed by defining an escape function that
replaces '&' with '\&' and applying it to ASSISTED_SERVICE_URL and
AIUI_CHAT_API_URL after substituting the namespace. Then use these escaped
variables in the sed command to ensure correct substitution without corruption.
Summary by CodeRabbit
AIUI_CHAT_API_URL, in the deployment setup.