Skip to content

Add chatbot param to UI deployment#3095

Closed
dudyas6 wants to merge 1 commit intoopenshift-assisted:masterfrom
dudyas6:adjust-skipper-deployment
Closed

Add chatbot param to UI deployment#3095
dudyas6 wants to merge 1 commit intoopenshift-assisted:masterfrom
dudyas6:adjust-skipper-deployment

Conversation

@dudyas6
Copy link
Copy Markdown

@dudyas6 dudyas6 commented Aug 4, 2025

Summary by CodeRabbit

  • New Features
    • Added support for configuring a new environment variable, AIUI_CHAT_API_URL, in the deployment setup.
    • Introduced a new deployment option to override the chat API URL during deployment configuration.

@openshift-ci openshift-ci bot requested review from ammont82 and jgyselov August 4, 2025 14:53
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Aug 4, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dudyas6
Once this PR has been reviewed and has the lgtm label, please assign batzionb for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Aug 4, 2025

Welcome @dudyas6! It looks like this is your first PR to openshift-assisted/assisted-installer-ui 🎉

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 4, 2025
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Aug 4, 2025

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@openshift-ci openshift-ci bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 4, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 4, 2025

Walkthrough

A new environment variable, AIUI_CHAT_API_URL, has been introduced into the deployment template and deployment configuration script for the assisted-installer UI. The deployment script now supports a -c flag to override this variable, and the template injects it into the container environment using a placeholder.

Changes

Cohort / File(s) Change Summary
Deployment Script Update
apps/assisted-ui/deploy/deploy_config.sh
Added AIUI_CHAT_API_URL variable with default, new -c flag for override, and placeholder substitution logic.
Deployment Template Update
apps/assisted-ui/deploy/deployment-template.yaml
Added AIUI_CHAT_API_URL as a new environment variable with a placeholder in the container spec.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

  • Define default URL for chatbot API #3087: Both PRs introduce and manage the AIUI_CHAT_API_URL environment variable with the same default value http://localhost:1234 in different deployment-related scripts for the assisted UI, showing a direct connection in handling this configuration variable.

Suggested labels

lgtm, approved, size/XS

Suggested reviewers

  • batzionb
  • celdrake
  • ammont82

Poem

A bunny hops with nimble feet,
Deploying configs, oh so neat!
A new chat URL, fresh and bright,
Now set by flag, or left to default’s delight.
The YAML’s env grows by one—
More hops ahead, the work is done! 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 -c flag

You introduced parsing for -c (chat API URL) but the help string shown by usage() 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>&2

Also 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 clean

Line 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

📥 Commits

Reviewing files that changed from the base of the PR and between f0976fa and ebd5202.

📒 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)

Comment on lines +54 to 59
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}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

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.

@dudyas6 dudyas6 marked this pull request as draft August 5, 2025 09:11
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 5, 2025
@dudyas6 dudyas6 closed this Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant