Skip to content

Conversation

@andrej1991
Copy link
Collaborator

@andrej1991 andrej1991 commented Aug 27, 2025

The 2 scripts in the commit can check if CI provided the needed image. If yes then that image is used to deploy the pods. If not then the latest image is downloaded from the repositories. Also fixing some debug logging issues. Turns out that most of the logs are already collected

Summary by CodeRabbit

  • New Features

    • Dynamic image/tag resolution for deployments and automatic detection of the current managed service pod; explicit "Waiting for pod ... to be ready..." readiness messages.
  • Chores

    • Unified success/failure reporting and simplified rollout failure handling; logs and diagnostics now point to artifacts/eval-test/gather-extra/artifacts/pods/ for both success and failure, with clearer exit behavior.

@openshift-ci openshift-ci bot requested review from eranco74 and jhernand August 27, 2025 14:50
@coderabbitai
Copy link

coderabbitai bot commented Aug 27, 2025

Warning

Rate limit exceeded

@andrej1991 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 3 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 2a8fc2d and b211914.

📒 Files selected for processing (2)
  • scripts/ci_test.sh (3 hunks)
  • scripts/deploy_template.sh (2 hunks)

Walkthrough

Adds guarded image/tag resolution (use ASSISTED_CHAT_IMG or fallback to quay.io IMAGE_PATH:latest), selects the latest-started assisted-service-mcp pod for diagnostics, and changes CI readiness, success, and failure logging to reference artifact paths rather than printing final pod logs. Public interfaces unchanged.

Changes

Cohort / File(s) Summary of Changes
CI orchestration & diagnostics
scripts/ci_test.sh
Adds ASSISTED_CHAT_TEST handling and fallback image construction; derives SELECTOR from assisted-service-mcp deployment, selects latest-started MCP pod; adds explicit "Waiting for pod ... to be ready..." logging; shifts success/failure messages to reference artifacts/eval-test/gather-extra/artifacts/pods/; prints oc get events on failure and exits using the terminated pod exit code.
Deployment image resolution & failure behavior
scripts/deploy_template.sh
Guards parsing of ASSISTED_CHAT_IMG: when set, splits to IMAGE/TAG; when empty, sets IMAGE_PATH="redhat-services-prod/assisted-installer-tenant/saas/assisted-chat", IMAGE="quay.io/${IMAGE_PATH}", TAG="latest"; simplifies rollout-failure reporting to point to artifact paths and exit 1.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant CI as scripts/ci_test.sh
    participant Deploy as scripts/deploy_template.sh
    participant Quay as quay.io
    participant OC as oc
    participant MCP as assisted-service-mcp pods
    participant CHAT as assisted-chat pod

    rect rgb(240,248,255)
    Note over Deploy: Image/tag resolution
    Deploy->>Deploy: if ASSISTED_CHAT_IMG set -> split into IMAGE/TAG
    Deploy->>Quay: else -> IMAGE="quay.io/IMAGE_PATH", TAG="latest"
    end

    rect rgb(245,245,245)
    Note over CI,OC: Pod readiness & MCP-aware diagnostics
    CI->>OC: wait for assisted-chat pod to be ready
    OC-->>CI: pod status updates
    CI->>CI: log "Waiting for pod ... to be ready..."
    alt pod ready
        CI->>CI: print success message pointing to artifacts/
        CI-->>CI: exit 0
    else pod times out or fails
        CI->>OC: get selector from assisted-service-mcp deployment
        OC-->>CI: selector
        CI->>OC: get pods -l <selector> (sort by startTime)
        OC-->>CI: return latest MCP pod name
        CI->>CI: print artifact path guidance (artifacts/eval-test/gather-extra/artifacts/pods/)
        CI->>OC: oc get events -n $NAMESPACE
        OC-->>CI: events
        CI-->>CI: exit with main pod terminated exit code
    end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • jhernand
✨ 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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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.
  • 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 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/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/ci_test.sh (1)

41-49: Harden numeric checks against empty values under nounset/errexit.

oc get ... -o=jsonpath=... can yield empty strings transiently; [[ "$VAR" -gt 0 ]] risks “integer expression expected”. Use arithmetic context which treats unset/empty as 0.

-    if [[  "$JOB_SUCCEEDED" -gt 0  ]]; then
+    if (( ${JOB_SUCCEEDED:-0} > 0  )); then
         echo "Pod ${POD_NAME} is successfully completed, exiting"
         oc logs -n "$NAMESPACE" "$POD_NAME"
         exit 0
     fi

-    if [[  "$JOB_FAILED" -gt 0  ]]; then
+    if (( ${JOB_FAILED:-0} > 0  )); then
         echo "Pod ${POD_NAME} is Failed, exiting"
-        oc logs -n "$NAMESPACE" "$POD_NAME"
+        oc logs -n "$NAMESPACE" "$POD_NAME" || true
🧹 Nitpick comments (3)
scripts/ci_test.sh (3)

28-29: Fix misleading label in error message.

We searched with -l job-name="$JOB_NAME" but the message mentions app=. Align the message to avoid confusion when triaging.

-    echo "No pod found with label app=assisted-chat-eval-test in namespace ${NAMESPACE}"
+    echo "No pod found with label job-name=${JOB_NAME} in namespace ${NAMESPACE}"

18-18: Consistent quoting of variables.

Minor but safer: quote $NAMESPACE like elsewhere.

-    oc create secret generic -n $NAMESPACE gemini --from-file=api_key="${SECRETS_BASE_PATH}/gemini/api_key"
+    oc create secret generic -n "$NAMESPACE" gemini --from-file=api_key="${SECRETS_BASE_PATH}/gemini/api_key"

56-60: Don’t let describe/log failures mask other diagnostics.

Add || true so a failed oc describe won’t terminate the failure path before we emit the exit code.

-        oc events -n "$NAMESPACE"
+        oc events -n "$NAMESPACE" || true
         echo "oc describe pod -n \"$NAMESPACE\" \"$ASSISTED_CHAT_POD\""
-        oc describe pod -n "$NAMESPACE" "$ASSISTED_CHAT_POD"
+        oc describe pod -n "$NAMESPACE" "$ASSISTED_CHAT_POD" || true
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between aa4cd6f and 170c432.

📒 Files selected for processing (2)
  • scripts/ci_test.sh (1 hunks)
  • scripts/deploy_template.sh (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Red Hat Konflux / assisted-chat-saas-main-on-pull-request

Comment on lines 84 to 93
if ! oc rollout status -n $NAMESPACE deployment/assisted-chat --timeout=300s; then
echo "Deploying assisted-chat failed"
ASSISTED_CHAT_POD=$(oc get pods -n "$NAMESPACE" | tr -s ' ' | cut -d ' ' -f1 | grep assisted-chat)
echo "The logs of the pod ${ASSISTED_CHAT_POD}"
oc logs -n $NAMESPACE "$ASSISTED_CHAT_POD"
oc logs -n $NAMESPACE "$ASSISTED_CHAT_POD" --all-containers=true
echo "The events in the namespace '${NAMESPACE}'"
oc events -n $NAMESPACE
echo "oc describe pod ${ASSISTED_CHAT_POD}"
oc describe pod $ASSISTED_CHAT_POD
echo "oc describe pod -n $NAMESPACE ${ASSISTED_CHAT_POD}"
oc describe pod -n $NAMESPACE $ASSISTED_CHAT_POD
fi
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Ensure failure-path diagnostics don’t abort; quote namespace.

Keep collecting logs/events/describe even if a single command fails; also quote $NAMESPACE for consistency.

-if  ! oc rollout status  -n $NAMESPACE deployment/assisted-chat --timeout=300s; then
+if  ! oc rollout status  -n "$NAMESPACE" deployment/assisted-chat --timeout=300s; then
     echo "Deploying assisted-chat failed"
     ASSISTED_CHAT_POD=$(oc get pods -n "$NAMESPACE" | tr -s ' ' | cut -d ' ' -f1 | grep assisted-chat)
     echo "The logs of the pod ${ASSISTED_CHAT_POD}"
-    oc logs -n $NAMESPACE "$ASSISTED_CHAT_POD"  --all-containers=true
+    oc logs -n "$NAMESPACE" "$ASSISTED_CHAT_POD" --all-containers=true || true
     echo "The events in the namespace '${NAMESPACE}'"
-    oc events -n $NAMESPACE
-    echo "oc describe pod -n $NAMESPACE ${ASSISTED_CHAT_POD}"
-    oc describe pod -n $NAMESPACE $ASSISTED_CHAT_POD
+    oc events -n "$NAMESPACE" || true
+    echo "oc describe pod -n \"$NAMESPACE\" ${ASSISTED_CHAT_POD}"
+    oc describe pod -n "$NAMESPACE" "$ASSISTED_CHAT_POD" || true
 fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if ! oc rollout status -n $NAMESPACE deployment/assisted-chat --timeout=300s; then
echo "Deploying assisted-chat failed"
ASSISTED_CHAT_POD=$(oc get pods -n "$NAMESPACE" | tr -s ' ' | cut -d ' ' -f1 | grep assisted-chat)
echo "The logs of the pod ${ASSISTED_CHAT_POD}"
oc logs -n $NAMESPACE "$ASSISTED_CHAT_POD"
oc logs -n $NAMESPACE "$ASSISTED_CHAT_POD" --all-containers=true
echo "The events in the namespace '${NAMESPACE}'"
oc events -n $NAMESPACE
echo "oc describe pod ${ASSISTED_CHAT_POD}"
oc describe pod $ASSISTED_CHAT_POD
echo "oc describe pod -n $NAMESPACE ${ASSISTED_CHAT_POD}"
oc describe pod -n $NAMESPACE $ASSISTED_CHAT_POD
fi
if ! oc rollout status -n "$NAMESPACE" deployment/assisted-chat --timeout=300s; then
echo "Deploying assisted-chat failed"
ASSISTED_CHAT_POD=$(oc get pods -n "$NAMESPACE" | tr -s ' ' | cut -d ' ' -f1 | grep assisted-chat)
echo "The logs of the pod ${ASSISTED_CHAT_POD}"
oc logs -n "$NAMESPACE" "$ASSISTED_CHAT_POD" --all-containers=true || true
echo "The events in the namespace '${NAMESPACE}'"
oc events -n "$NAMESPACE" || true
echo "oc describe pod -n \"$NAMESPACE\" ${ASSISTED_CHAT_POD}"
oc describe pod -n "$NAMESPACE" "$ASSISTED_CHAT_POD" || true
fi
🤖 Prompt for AI Agents
In scripts/deploy_template.sh around lines 84-93, the failure-path diagnostics
currently can abort early and use unquoted $NAMESPACE; update the block so
diagnostics continue even if individual commands fail (e.g., temporarily disable
errexit or append "|| true" to each diagnostic command) and quote variables
consistently (use "$NAMESPACE" and "$ASSISTED_CHAT_POD" when passed to
oc/get/describe/logs) so logs/events/describe are always attempted and
namespace/pod names are safely quoted.

@andrej1991
Copy link
Collaborator Author

/retest required

@openshift-ci
Copy link

openshift-ci bot commented Aug 28, 2025

@andrej1991: The /retest command does not accept any targets.
The following commands are available to trigger required jobs:

/test eval-test
/test images

Use /test all to run all jobs.

In response to this:

/retest required

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.

@andrej1991
Copy link
Collaborator Author

/test eval-test

@andrej1991 andrej1991 force-pushed the debug_logging branch 2 times, most recently from ea4116d to cd7db5a Compare August 28, 2025 09:05
@andrej1991
Copy link
Collaborator Author

/test eval-test

Copy link

@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

♻️ Duplicate comments (2)
scripts/deploy_template.sh (1)

84-86: Quote NAMESPACE and keep minimal diagnostics before exit.

Unquoted $NAMESPACE is brittle. Also, exiting without any inline describe/events reduces signal during failures (contrary to the PR goal of “adding even more logging”). Add lightweight, non-fatal diagnostics before exiting.

-if  ! oc rollout status  -n $NAMESPACE deployment/assisted-chat --timeout=300s; then
-    echo "Deploying assisted-chat failed, the logs of the pods are in artifacts/eval-test/gather-extra/artifacts/pods/ directory."
-    exit 1
+if  ! oc rollout status -n "$NAMESPACE" deployment/assisted-chat --timeout=300s; then
+    echo "Deploying assisted-chat failed. Attempting quick diagnostics (non-fatal):"
+    echo "oc describe -n \"$NAMESPACE\" deployment/assisted-chat"
+    oc describe -n "$NAMESPACE" deployment/assisted-chat || true
+    echo "oc events -n \"$NAMESPACE\" --sort-by=.lastTimestamp | tail -n 200"
+    oc events -n "$NAMESPACE" --sort-by=.lastTimestamp | tail -n 200 || true
+    echo "Detailed pod logs should be in artifacts/eval-test/gather-extra/artifacts/pods/."
+    exit 1
 fi
scripts/ci_test.sh (1)

54-59: Make failure-path log collection resilient; avoid aborting diagnostics.

With errexit, any oc logs failure will exit early. Also, guard empty pod vars; recomputing SELECTOR is unnecessary—reuse it if present.

-        SELECTOR=$(oc get deploy -n "$NAMESPACE" assisted-service-mcp -o json | jq -r '.spec.selector.matchLabels | to_entries | map("\(.key)=\(.value)") | join(",")')
-        ASSISTED_SERVICE_MCP_POD=$(oc get pods -n "$NAMESPACE" -l "$SELECTOR" -o json | jq -r '.items | sort_by(.status.startTime) | last | .metadata.name')
-        echo "oc logs -n \"$NAMESPACE\" \"$ASSISTED_CHAT_POD\" --all-containers=true"
-        oc logs -n "$NAMESPACE" "$ASSISTED_CHAT_POD" --all-containers=true
-        echo "oc logs -n \"$NAMESPACE\" \"$ASSISTED_SERVICE_MCP_POD\" --all-containers=true"
-        oc logs -n "$NAMESPACE" "$ASSISTED_SERVICE_MCP_POD" --all-containers=true
+        # Reuse SELECTOR/ASSISTED_SERVICE_MCP_POD computed earlier; if empty, attempt best-effort recompute.
+        if [[ -z "${SELECTOR:-}" ]]; then
+          SELECTOR="$(
+            { oc get deploy -n "$NAMESPACE" assisted-service-mcp -o json 2>/dev/null || true; } \
+            | jq -r '.spec.selector.matchLabels | to_entries | map("\(.key)=\(.value)") | join(",") // empty' 2>/dev/null || true
+          )"
+        fi
+        if [[ -z "${ASSISTED_SERVICE_MCP_POD:-}" && -n "${SELECTOR:-}" ]]; then
+          ASSISTED_SERVICE_MCP_POD="$(
+            oc get pods -n "$NAMESPACE" -l "$SELECTOR" -o json 2>/dev/null \
+            | jq -r '.items | sort_by(.status.startTime) | last? | .metadata.name // empty' 2>/dev/null || true
+          )"
+        fi
+        if [[ -n "${ASSISTED_CHAT_POD:-}" ]]; then
+          echo "oc logs -n \"$NAMESPACE\" \"$ASSISTED_CHAT_POD\" --all-containers=true"
+          oc logs -n "$NAMESPACE" "$ASSISTED_CHAT_POD" --all-containers=true || true
+        else
+          echo "No assisted-chat pod name resolved; skipping assisted-chat logs."
+        fi
+        if [[ -n "${ASSISTED_SERVICE_MCP_POD:-}" ]]; then
+          echo "oc logs -n \"$NAMESPACE\" \"$ASSISTED_SERVICE_MCP_POD\" --all-containers=true"
+          oc logs -n "$NAMESPACE" "$ASSISTED_SERVICE_MCP_POD" --all-containers=true || true
+        else
+          echo "No assisted-service-mcp pod found in namespace $NAMESPACE; skipping MCP logs."
+        fi
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cd7db5a and 4b0bca9.

📒 Files selected for processing (2)
  • scripts/ci_test.sh (2 hunks)
  • scripts/deploy_template.sh (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Red Hat Konflux / assisted-chat-saas-main-on-pull-request

Copy link

@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: 4

♻️ Duplicate comments (2)
scripts/deploy_template.sh (1)

110-113: Quote namespace and collect failure diagnostics without aborting.

Keep gathering logs/events/describe even if a single command fails, and quote variables. Also remove extra spaces.

-if  ! oc rollout status  -n $NAMESPACE deployment/assisted-chat --timeout=300s; then
-    echo "Deploying assisted-chat failed, the logs of the pods are in artifacts/eval-test/gather-extra/artifacts/pods/ directory."
-    exit 1
+if ! oc rollout status -n "$NAMESPACE" deployment/assisted-chat --timeout=300s; then
+    echo "Deploying assisted-chat failed. Attempting to collect diagnostics; artifacts will be under artifacts/eval-test/gather-extra/artifacts/pods/."
+    ASSISTED_CHAT_POD="$(oc get pods -n "$NAMESPACE" -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' \
+      | grep '^assisted-chat' | head -n1 || true)"
+    if [[ -n "${ASSISTED_CHAT_POD:-}" ]]; then
+      echo "oc logs -n \"$NAMESPACE\" \"$ASSISTED_CHAT_POD\" --all-containers=true"
+      oc logs -n "$NAMESPACE" "$ASSISTED_CHAT_POD" --all-containers=true || true
+      echo "oc describe pod -n \"$NAMESPACE\" \"$ASSISTED_CHAT_POD\""
+      oc describe pod -n "$NAMESPACE" "$ASSISTED_CHAT_POD" || true
+    else
+      echo "No assisted-chat pod found in namespace \"$NAMESPACE\""
+    fi
+    echo "oc events -n \"$NAMESPACE\""
+    oc events -n "$NAMESPACE" || true
+    exit 1
 fi
scripts/ci_test.sh (1)

63-66: Guard missing MCP deployment; make jq selection null-safe; don’t abort under errexit/pipefail.

-SELECTOR=$(oc get deploy -n "$NAMESPACE" assisted-service-mcp -o json | jq -r '.spec.selector.matchLabels | to_entries | map("\(.key)=\(.value)") | join(",")')
-ASSISTED_SERVICE_MCP_POD=$(oc get pods -n "$NAMESPACE" -l "$SELECTOR" -o json | jq -r '.items | sort_by(.status.startTime) | last | .metadata.name')
-echo $ASSISTED_SERVICE_MCP_POD
+SELECTOR="$(
+  { oc get deploy -n "$NAMESPACE" assisted-service-mcp -o json 2>/dev/null || true; } \
+  | jq -r '.spec.selector.matchLabels | to_entries | map("\(.key)=\(.value)") | join(",") // empty' 2>/dev/null || true
+)"
+ASSISTED_SERVICE_MCP_POD=""
+if [[ -n "${SELECTOR:-}" ]]; then
+  ASSISTED_SERVICE_MCP_POD="$(
+    oc get pods -n "$NAMESPACE" -l "$SELECTOR" -o json 2>/dev/null \
+    | jq -r '.items | sort_by(.status.startTime) | last? | .metadata.name // empty' 2>/dev/null || true
+  )"
+fi
+echo "${ASSISTED_SERVICE_MCP_POD:-}"
🧹 Nitpick comments (4)
scripts/deploy_template.sh (1)

28-34: Optional: Prefer Docker manifest v2 for creation time.

Schema v1 .history[0].v1Compatibility is deprecated and brittle. Consider requesting v2 and reading the config blob’s created.

-            MANIFEST=$(curl -Lf "https://quay.io/v2/${IMAGE_PATH}/manifests/${TAG}" | jq -r '.history[0].v1Compatibility')
-            CREATED_DATE=$(echo "$MANIFEST" | jq -r '.created' | xargs -I {} date -d {} +%s)
+            # v2: get manifest, then fetch config blob to read .created
+            MANIFEST=$(curl -sLf -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' \
+              "https://quay.io/v2/${IMAGE_PATH}/manifests/${TAG}") || continue
+            CONFIG_DIGEST=$(echo "$MANIFEST" | jq -r '.config.digest // empty') || continue
+            [[ -n "$CONFIG_DIGEST" ]] || continue
+            CREATED_RAW=$(curl -sLf "https://quay.io/v2/${IMAGE_PATH}/blobs/${CONFIG_DIGEST}" | jq -r '.created // empty') || continue
+            [[ -n "$CREATED_RAW" ]] || continue
+            CREATED_DATE=$(date -d "$CREATED_RAW" +%s 2>/dev/null || echo 0)

Also applies to: 37-42

scripts/ci_test.sh (3)

44-47: Quote namespace when creating secrets.

-    oc create secret generic -n $NAMESPACE gemini --from-file=api_key="${SECRETS_BASE_PATH}/gemini/api_key"
+    oc create secret generic -n "$NAMESPACE" gemini --from-file=api_key="${SECRETS_BASE_PATH}/gemini/api_key"

72-75: Fix user-facing grammar/typos.

-        echo "The evaluation test were successful. The logs of the tests are stored in the directory artifacts/eval-test/gather-extra/artifacts/pods/ in the logs of the pod ${POD_NAME}."
+        echo "The evaluation tests were successful. The logs are under artifacts/eval-test/gather-extra/artifacts/pods/ for pod ${POD_NAME}."
@@
-echo "Timeout reached. Pod $POD_NAME did not become ready in time. PLease check the logs of the pods under the directory artifacts/eval-test/gather-extra/artifacts/pods/."
+echo "Timeout reached. Pod $POD_NAME did not become ready in time. Please check the pod logs under artifacts/eval-test/gather-extra/artifacts/pods/."

Also applies to: 91-92


19-30: Optional: Prefer Docker manifest v2 for creation time (align with deploy script suggestion).

-            MANIFEST=$(curl -Lf "https://quay.io/v2/${IMAGE_PATH}/manifests/${TAG}" | jq -r '.history[0].v1Compatibility') || continue
-            CREATED_RAW=$(echo "$MANIFEST" | jq -r '.created' 2>/dev/null || true)
+            MANIFEST=$(curl -sLf -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' \
+              "https://quay.io/v2/${IMAGE_PATH}/manifests/${TAG}") || continue
+            CONFIG_DIGEST=$(echo "$MANIFEST" | jq -r '.config.digest // empty') || continue
+            CREATED_RAW=$(curl -sLf "https://quay.io/v2/${IMAGE_PATH}/blobs/${CONFIG_DIGEST}" | jq -r '.created // empty' 2>/dev/null || true)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4b0bca9 and e284b48.

📒 Files selected for processing (2)
  • scripts/ci_test.sh (3 hunks)
  • scripts/deploy_template.sh (2 hunks)

Comment on lines 10 to 16
if [[ -n $ASSISTED_CHAT_TEST ]]; then
echo "The variable ASSISTED_CHAT_TEST was proided with the value ${ASSISTED_CHAT_TEST}, using that for creating the IMAGE and TAG variables for the template"
else
IMAGE_PATH="redhat-user-workloads/assisted-installer-tenant/assisted-chat-test-image-saas-main/assisted-chat-test-image-saas-main"
IMAGE="quay.io/${IMAGE_PATH}"
echo "The variable ASSISTED_CHAT_TEST was not provieded, downloading the latest image from ${IMAGE}"
NEWEST_TAG=""
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Fix nounset crash when ASSISTED_CHAT_TEST is unset; make tag resolution resilient; fix typos.

Use default expansion under nounset, tolerate empty grep/manifests, and correct user-facing strings.

-if [[ -n $ASSISTED_CHAT_TEST ]]; then
-    echo "The variable ASSISTED_CHAT_TEST was proided with the value ${ASSISTED_CHAT_TEST}, using that for creating the IMAGE and TAG variables for the template"
+if [[ -n "${ASSISTED_CHAT_TEST:-}" ]]; then
+    echo "The variable ASSISTED_CHAT_TEST was provided with the value ${ASSISTED_CHAT_TEST}; using it to create the IMAGE and TAG variables for the template"
 else
     IMAGE_PATH="redhat-user-workloads/assisted-installer-tenant/assisted-chat-test-image-saas-main/assisted-chat-test-image-saas-main"
     IMAGE="quay.io/${IMAGE_PATH}"
-    echo "The variable ASSISTED_CHAT_TEST was not provieded, downloading the latest image from ${IMAGE}"
+    echo "The variable ASSISTED_CHAT_TEST was not provided; resolving the latest image from ${IMAGE}"
     NEWEST_TAG=""
     NEWEST_DATE=0
 
-    TAGS=$(curl -Lf https://quay.io/v2/${IMAGE_PATH}/tags/list | jq -r '.tags[]'|grep -v sha256)
+    TAGS=$(curl -Lf "https://quay.io/v2/${IMAGE_PATH}/tags/list" | jq -r '.tags[]' | grep -v sha256 || true)
     for TAG in $TAGS; do
         if [[ "${#TAG}" == "7" ]]; then
-            MANIFEST=$(curl -Lf "https://quay.io/v2/${IMAGE_PATH}/manifests/${TAG}" | jq -r '.history[0].v1Compatibility')
-            CREATED_DATE=$(echo "$MANIFEST" | jq -r '.created' | xargs -I {} date -d {} +%s)
+            MANIFEST=$(curl -Lf "https://quay.io/v2/${IMAGE_PATH}/manifests/${TAG}" | jq -r '.history[0].v1Compatibility') || continue
+            CREATED_RAW=$(echo "$MANIFEST" | jq -r '.created' 2>/dev/null || true)
+            [[ -n "$CREATED_RAW" && "$CREATED_RAW" != "null" ]] || continue
+            CREATED_DATE=$(date -d "$CREATED_RAW" +%s 2>/dev/null || echo 0)

Also applies to: 19-36

🤖 Prompt for AI Agents
In scripts/ci_test.sh around lines 10 to 16 (and similarly apply to 19-36), the
script currently crashes under nounset and prints typos; fix by using parameter
expansion with a safe default (e.g. ${ASSISTED_CHAT_TEST:-}) wherever
ASSISTED_CHAT_TEST is read so the script doesn't error when nounset; ensure
NEWEST_TAG is initialized to an empty string and that tag resolution commands
tolerate empty outputs (use checks for empty grep/manifests output or append ||
true) so downstream uses won't fail; also correct user-facing messages to
"provided" and rephrase to mention the derived IMAGE and TAG variables.

oc events -n "$NAMESPACE"
echo "oc describe pod -n \"$NAMESPACE\" \"$ASSISTED_CHAT_POD\""
oc describe pod -n "$NAMESPACE" "$ASSISTED_CHAT_POD"
exit "$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}')"
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

❓ Verification inconclusive

Exit code retrieval can be empty; provide a safe fallback.

Avoid “numeric argument required” if the jsonpath yields empty.

-        exit "$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}')"
+        EC="$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}' 2>/dev/null || true)"
+        [[ -n "${EC:-}" ]] || EC=1
+        exit "$EC"

Use a safe fallback exit code to prevent “numeric argument required”
Shell’s exit "" fails when the JSONPath returns empty; capture the exit code with a default of 1:

-        exit "$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}')"
+        EC="$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}' 2>/dev/null || true)"
+        [[ -n "${EC}" ]] || EC=1
+        exit "$EC"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
exit "$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}')"
EC="$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}' 2>/dev/null || true)"
[[ -n "${EC}" ]] || EC=1
exit "$EC"
🤖 Prompt for AI Agents
In scripts/ci_test.sh around line 82, the script directly exits with the command
substitution which can produce an empty string and cause “numeric argument
required”; capture the pod container exit code into a variable by running the oc
jsonpath command and then exit using that variable with a safe default of 1
(e.g. use shell parameter expansion so if the captured value is empty the script
exits with 1).

@openshift-ci
Copy link

openshift-ci bot commented Aug 29, 2025

@andrej1991: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/eval-test e284b48 link false /test eval-test

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

Copy link

@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: 0

♻️ Duplicate comments (6)
scripts/deploy_template.sh (3)

14-21: Harden ASSISTED_CHAT_IMG handling; fix typos; quote and avoid nounset crash

Use default expansion under nounset, quote vars, and correct user-facing text.

-if [[ -n $ASSISTED_CHAT_IMG ]]; then
-    echo "The variable ASSISTED_CHAT_IMG was proided with the value ${ASSISTED_CHAT_IMG}, using that for creating the IMAGE and TAG variables for the template"
-    IMAGE=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f1)
-    TAG=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f2)
+if [[ -n "${ASSISTED_CHAT_IMG:-}" ]]; then
+    echo "The variable ASSISTED_CHAT_IMG was provided with the value ${ASSISTED_CHAT_IMG}; using it to create the IMAGE and TAG variables for the template"
+    IMAGE="$(echo "${ASSISTED_CHAT_IMG}" | cut -d ':' -f1)"
+    TAG="$(echo "${ASSISTED_CHAT_IMG}" | cut -d ':' -f2)"
 else
     IMAGE_PATH="redhat-services-prod/assisted-installer-tenant/saas/assisted-chat"
     IMAGE="quay.io/${IMAGE_PATH}"
-    echo "The variable ASSISTED_CHAT_IMG was not provieded, downloading the latest image from ${IMAGE}"
+    echo "The variable ASSISTED_CHAT_IMG was not provided; resolving the latest image from ${IMAGE}"

25-36: Make tag resolution resilient under errexit/pipefail; skip bad tags instead of aborting

Tolerate empty/failed curl|jq and malformed dates; quote URLs and vars.

-    TAGS=$(curl -Lf https://quay.io/v2/${IMAGE_PATH}/tags/list | jq -r '.tags[]'|grep -v sha256)
+    TAGS=$(curl -Lf "https://quay.io/v2/${IMAGE_PATH}/tags/list" | jq -r '.tags[]' | grep -v sha256 || true)
     for TAG in $TAGS; do
         if [[ "${#TAG}" == "7" ]]; then
-            MANIFEST=$(curl -Lf "https://quay.io/v2/${IMAGE_PATH}/manifests/${TAG}" | jq -r '.history[0].v1Compatibility')
-            CREATED_DATE=$(echo "$MANIFEST" | jq -r '.created' | xargs -I {} date -d {} +%s)
+            MANIFEST=$(curl -Lf "https://quay.io/v2/${IMAGE_PATH}/manifests/${TAG}" | jq -r '.history[0].v1Compatibility') || continue
+            CREATED_RAW="$(echo "$MANIFEST" | jq -r '.created' 2>/dev/null || true)"
+            [[ -n "${CREATED_RAW:-}" && "$CREATED_RAW" != "null" ]] || continue
+            CREATED_DATE="$(date -d "$CREATED_RAW" +%s 2>/dev/null || echo 0)"
             
             if [[ $CREATED_DATE -gt $NEWEST_DATE ]]; then
                 NEWEST_DATE=$CREATED_DATE
                 NEWEST_TAG=$TAG
             fi
         fi
     done

109-113: Quote NAMESPACE and keep failure-path diagnostics (logs/events/describe) resilient

Ensure diagnostics still run even if one command fails; also point to artifacts.

-sleep 5
-if  ! oc rollout status  -n $NAMESPACE deployment/assisted-chat --timeout=300s; then
-    echo "Deploying assisted-chat failed, the logs of the pods are in artifacts/eval-test/gather-extra/artifacts/pods/ directory."
-    exit 1
-fi
+sleep 5
+if ! oc rollout status -n "$NAMESPACE" deployment/assisted-chat --timeout=300s; then
+    echo "Deploying assisted-chat failed"
+    ASSISTED_CHAT_POD="$(oc get pods -n "$NAMESPACE" -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep '^assisted-chat' | head -n1 || true)"
+    if [[ -n "${ASSISTED_CHAT_POD:-}" ]]; then
+      echo "oc logs -n \"$NAMESPACE\" \"$ASSISTED_CHAT_POD\" --all-containers=true"
+      oc logs -n "$NAMESPACE" "$ASSISTED_CHAT_POD" --all-containers=true || true
+      echo "oc describe pod -n \"$NAMESPACE\" \"$ASSISTED_CHAT_POD\""
+      oc describe pod -n "$NAMESPACE" "$ASSISTED_CHAT_POD" || true
+    else
+      echo "No assisted-chat pod found in namespace $NAMESPACE"
+    fi
+    echo "oc events -n \"$NAMESPACE\""
+    oc events -n "$NAMESPACE" || true
+    echo "Also see artifacts/eval-test/gather-extra/artifacts/pods/ for collected logs."
+    exit 1
+fi
scripts/ci_test.sh (3)

10-17: Guard ASSISTED_CHAT_TEST under nounset; fix typos in user-facing messages

Use default expansion and improve wording.

-if [[ -n $ASSISTED_CHAT_TEST ]]; then
-    echo "The variable ASSISTED_CHAT_TEST was proided with the value ${ASSISTED_CHAT_TEST}, using that for creating the IMAGE and TAG variables for the template"
+if [[ -n "${ASSISTED_CHAT_TEST:-}" ]]; then
+    echo "The variable ASSISTED_CHAT_TEST was provided with the value ${ASSISTED_CHAT_TEST}; using it to create the IMAGE and TAG variables for the template"
 else
     IMAGE_PATH="redhat-user-workloads/assisted-installer-tenant/assisted-chat-test-image-saas-main/assisted-chat-test-image-saas-main"
     IMAGE="quay.io/${IMAGE_PATH}"
-    echo "The variable ASSISTED_CHAT_TEST was not provieded, downloading the latest image from ${IMAGE}"
+    echo "The variable ASSISTED_CHAT_TEST was not provided; resolving the latest image from ${IMAGE}"
     ASSISTED_CHAT_TEST="${IMAGE}:latest"
 fi

44-46: Make MCP pod discovery null-safe and resilient under pipefail

Handle missing deployment and empty lists; avoid bare echo of empty name.

-SELECTOR=$(oc get deploy -n "$NAMESPACE" assisted-service-mcp -o json | jq -r '.spec.selector.matchLabels | to_entries | map("\(.key)=\(.value)") | join(",")')
-ASSISTED_SERVICE_MCP_POD=$(oc get pods -n "$NAMESPACE" -l "$SELECTOR" -o json | jq -r '.items | sort_by(.status.startTime) | last | .metadata.name')
-echo $ASSISTED_SERVICE_MCP_POD
+SELECTOR="$(
+  { oc get deploy -n "$NAMESPACE" assisted-service-mcp -o json 2>/dev/null || true; } \
+  | jq -r '.spec.selector.matchLabels | to_entries | map("\(.key)=\(.value)") | join(",") // empty' 2>/dev/null || true
+)"
+ASSISTED_SERVICE_MCP_POD=""
+if [[ -n "${SELECTOR:-}" ]]; then
+  ASSISTED_SERVICE_MCP_POD="$(
+    oc get pods -n "$NAMESPACE" -l "$SELECTOR" -o json 2>/dev/null \
+    | jq -r '.items | sort_by(.status.startTime) | last? | .metadata.name // empty' 2>/dev/null || true
+  )"
+fi
+if [[ -n "${ASSISTED_SERVICE_MCP_POD:-}" ]]; then
+  echo "assisted-service-mcp pod: ${ASSISTED_SERVICE_MCP_POD}"
+else
+  echo "No assisted-service-mcp pod found in namespace $NAMESPACE"
+fi

58-64: Make failure diagnostics resilient; safe fallback for empty exit code

Don’t abort on events failure; avoid “numeric argument required” on empty JSONPath.

-        echo "The evaluation tests failed, you can see the logs of the pods under the directory artifacts/eval-test/gather-extra/artifacts/pods/."
-        echo "oc events"
-        oc events -n "$NAMESPACE"
-        exit "$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}')"
+        echo "The evaluation tests failed. See logs under artifacts/eval-test/gather-extra/artifacts/pods/."
+        echo "oc events -n \"$NAMESPACE\""
+        oc events -n "$NAMESPACE" || true
+        EC="$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}' 2>/dev/null || true)"
+        [[ -n "${EC:-}" ]] || EC=1
+        exit "$EC"
🧹 Nitpick comments (2)
scripts/ci_test.sh (2)

53-55: Fix grammar in success message

Minor copy edit.

-        echo "The evaluation test were successful. The logs of the tests are stored in the directory artifacts/eval-test/gather-extra/artifacts/pods/ in the logs of the pod ${POD_NAME}."
+        echo "The evaluation tests were successful. Logs are stored under artifacts/eval-test/gather-extra/artifacts/pods/ for pod ${POD_NAME}."

72-73: Fix typo in timeout message

“PLease” → “Please”.

-echo "Timeout reached. Pod $POD_NAME did not become ready in time. PLease check the logs of the pods under the directory artifacts/eval-test/gather-extra/artifacts/pods/."
+echo "Timeout reached. Pod $POD_NAME did not become ready in time. Please check the logs of the pods under artifacts/eval-test/gather-extra/artifacts/pods/."
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e284b48 and 2f80bc6.

📒 Files selected for processing (2)
  • scripts/ci_test.sh (3 hunks)
  • scripts/deploy_template.sh (2 hunks)

Copy link

@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

♻️ Duplicate comments (4)
scripts/deploy_template.sh (1)

91-93: Quote namespace; consider keeping diagnostics resilient.

Unquoted $NAMESPACE can break for odd names. If you later add diagnostics here, ensure they’re suffix-guarded with || true so errexit/pipefail don’t abort early.

-if  ! oc rollout status  -n $NAMESPACE deployment/assisted-chat --timeout=300s; then
+if ! oc rollout status -n "$NAMESPACE" deployment/assisted-chat --timeout=300s; then
scripts/ci_test.sh (3)

10-17: Guard ASSISTED_CHAT_TEST under nounset; fix typos; align message with actual usage.

Use default expansion; correct strings; message shouldn’t mention IMAGE/TAG since you pass IMAGE_NAME.

-if [[ -n $ASSISTED_CHAT_TEST ]]; then
-    echo "The variable ASSISTED_CHAT_TEST was proided with the value ${ASSISTED_CHAT_TEST}, using that for creating the IMAGE and TAG variables for the template"
+if [[ -n "${ASSISTED_CHAT_TEST:-}" ]]; then
+    echo "The variable ASSISTED_CHAT_TEST was provided with the value ${ASSISTED_CHAT_TEST}; using it as IMAGE_NAME for the template"
 else
     IMAGE_PATH="redhat-user-workloads/assisted-installer-tenant/assisted-chat-test-image-saas-main/assisted-chat-test-image-saas-main"
     IMAGE="quay.io/${IMAGE_PATH}"
-    echo "The variable ASSISTED_CHAT_TEST was not provieded, downloading the latest image from ${IMAGE}"
+    echo "The variable ASSISTED_CHAT_TEST was not provided; using ${IMAGE}:latest"
     ASSISTED_CHAT_TEST="${IMAGE}:latest"
 fi

44-46: Make MCP pod selection resilient under pipefail; handle missing deploy and empty lists.

If the deployment doesn’t exist or returns empty, this pipeline can abort or print “null”. Guard both steps and default to empty.

-SELECTOR=$(oc get deploy -n "$NAMESPACE" assisted-service-mcp -o json | jq -r '.spec.selector.matchLabels | to_entries | map("\(.key)=\(.value)") | join(",")')
-ASSISTED_SERVICE_MCP_POD=$(oc get pods -n "$NAMESPACE" -l "$SELECTOR" -o json | jq -r '.items | sort_by(.status.startTime) | last | .metadata.name')
-echo $ASSISTED_SERVICE_MCP_POD
+SELECTOR="$(
+  { oc get deploy -n "$NAMESPACE" assisted-service-mcp -o json 2>/dev/null || true; } \
+  | jq -r '.spec.selector.matchLabels | to_entries | map("\(.key)=\(.value)") | join(",") // empty' 2>/dev/null || true
+)"
+ASSISTED_SERVICE_MCP_POD=""
+if [[ -n "${SELECTOR:-}" ]]; then
+  ASSISTED_SERVICE_MCP_POD="$(
+    oc get pods -n "$NAMESPACE" -l "$SELECTOR" -o json 2>/dev/null \
+    | jq -r '.items | sort_by(.status.startTime) | last? | .metadata.name // empty' 2>/dev/null || true
+  )"
+fi
+[[ -n "${ASSISTED_SERVICE_MCP_POD:-}" ]] && echo "$ASSISTED_SERVICE_MCP_POD" || echo "No assisted-service-mcp pod found"

60-64: Exit code may be empty; oc events should not abort diagnostics.

Empty JSONPath yields exit ""; also oc events may fail under pipefail. Capture exit code with a safe default and don’t let events abort.

-        echo "The evaluation tests failed, you can see the logs of the pods under the directory artifacts/eval-test/gather-extra/artifacts/pods/."
-        echo "oc events"
-        oc events -n "$NAMESPACE"
-        exit "$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}')"
+        echo "The evaluation tests failed. Logs are under artifacts/eval-test/gather-extra/artifacts/pods/."
+        echo "oc events"
+        oc events -n "$NAMESPACE" || true
+        EC="$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}' 2>/dev/null || true)"
+        [[ -n "${EC:-}" ]] || EC=1
+        exit "$EC"
🧹 Nitpick comments (3)
scripts/deploy_template.sh (1)

19-23: Fix message typos and align wording with behavior.

Minor grammar and clarity; also we aren’t “downloading” here.

-    echo "The variable ASSISTED_CHAT_IMG was not provieded, downloading the latest image from ${IMAGE}"
+    echo "The variable ASSISTED_CHAT_IMG was not provided; using ${IMAGE}:latest"
scripts/ci_test.sh (2)

53-55: Grammar nit: pluralize and clarify success message.

-        echo "The evaluation test were successful. The logs of the tests are stored in the directory artifacts/eval-test/gather-extra/artifacts/pods/ in the logs of the pod ${POD_NAME}."
+        echo "The evaluation tests were successful. Logs are under artifacts/eval-test/gather-extra/artifacts/pods/ for pod ${POD_NAME}."

72-73: Fix typo in timeout message.

-echo "Timeout reached. Pod $POD_NAME did not become ready in time. PLease check the logs of the pods under the directory artifacts/eval-test/gather-extra/artifacts/pods/."
+echo "Timeout reached. Pod $POD_NAME did not become ready in time. Please check logs under artifacts/eval-test/gather-extra/artifacts/pods/."
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2f80bc6 and 6ac375b.

📒 Files selected for processing (2)
  • scripts/ci_test.sh (3 hunks)
  • scripts/deploy_template.sh (2 hunks)

Comment on lines 14 to 18
if [[ -n $ASSISTED_CHAT_IMG ]]; then
echo "The variable ASSISTED_CHAT_IMG was proided with the value ${ASSISTED_CHAT_IMG}, using that for creating the IMAGE and TAG variables for the template"
IMAGE=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f1)
TAG=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f2)
else
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Guard ASSISTED_CHAT_IMG under nounset; fix typos; handle @sha256 digest safely.

Reading an unset var with nounset aborts. Also, parsing image@sha256:digest with cut yields IMAGE containing “@sha256”. Strip digest properly; fix messages.

-if [[ -n $ASSISTED_CHAT_IMG ]]; then
-    echo "The variable ASSISTED_CHAT_IMG was proided with the value ${ASSISTED_CHAT_IMG}, using that for creating the IMAGE and TAG variables for the template"
-    IMAGE=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f1)
-    TAG=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f2)
+if [[ -n "${ASSISTED_CHAT_IMG:-}" ]]; then
+    echo "The variable ASSISTED_CHAT_IMG was provided with the value ${ASSISTED_CHAT_IMG}; deriving IMAGE and TAG for the template"
+    # Supported forms:
+    #   repo/name:tag
+    #   repo/name@sha256:digest
+    IMG_NO_TAG="${ASSISTED_CHAT_IMG%%:*}"
+    TAG_OR_DIGEST="${ASSISTED_CHAT_IMG#*:}"
+    # If digest form, strip '@sha256' from IMAGE and keep digest in TAG (template must support it or you should pass a full ref param instead).
+    IMAGE="${IMG_NO_TAG%%@sha256*}"
+    TAG="${TAG_OR_DIGEST}"
+    if [[ -z "${TAG}" || "${TAG}" == "${ASSISTED_CHAT_IMG}" ]]; then
+      echo "ASSISTED_CHAT_IMG doesn't include a ':'; falling back to 'latest' tag"
+      TAG="latest"
+    fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [[ -n $ASSISTED_CHAT_IMG ]]; then
echo "The variable ASSISTED_CHAT_IMG was proided with the value ${ASSISTED_CHAT_IMG}, using that for creating the IMAGE and TAG variables for the template"
IMAGE=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f1)
TAG=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f2)
else
if [[ -n "${ASSISTED_CHAT_IMG:-}" ]]; then
echo "The variable ASSISTED_CHAT_IMG was provided with the value ${ASSISTED_CHAT_IMG}; deriving IMAGE and TAG for the template"
# Supported forms:
# repo/name:tag
# repo/name@sha256:digest
IMG_NO_TAG="${ASSISTED_CHAT_IMG%%:*}"
TAG_OR_DIGEST="${ASSISTED_CHAT_IMG#*:}"
# If digest form, strip '@sha256' from IMAGE and keep digest in TAG.
IMAGE="${IMG_NO_TAG%%@sha256*}"
TAG="${TAG_OR_DIGEST}"
if [[ -z "${TAG}" || "${TAG}" == "${ASSISTED_CHAT_IMG}" ]]; then
echo "ASSISTED_CHAT_IMG doesn't include a ':'; falling back to 'latest' tag"
TAG="latest"
fi
else
# ... existing else-branch ...
🤖 Prompt for AI Agents
In scripts/deploy_template.sh around lines 14 to 18, the ASSISTED_CHAT_IMG check
must be resilient to nounset, the echo message has a typo, and image references
using a @sha256 digest must be parsed correctly; change the if test to use the
parameter expansion guard (e.g. [[ -n ${ASSISTED_CHAT_IMG-} ]]), fix the echo
text ("provided"), and parse the image safely: if the value contains '@' split
IMAGE as the substring before '@' and TAG as the substring after '@' (preserving
the sha256:digest), otherwise split IMAGE and TAG by the last ':' (IMAGE as
everything before the first ':' or using %%:* and TAG using ##*:), so you handle
both tag and digest forms without using cut.

@andrej1991 andrej1991 force-pushed the debug_logging branch 2 times, most recently from 2a8fc2d to b2f5e2d Compare August 29, 2025 15:32
@andrej1991 andrej1991 changed the title adding even more logging in case the deployment of assisted-chat or the eval test fails Dynamic image/tag resolution for deployments and automatic detection of the current managed service pod Aug 29, 2025
If yes then that image is used to deploy the pods. If not then the
latest image is downloaded from the repositories.
Also fixing some debug logging issues. Turns out that most of the logs
are already collected
@openshift-ci
Copy link

openshift-ci bot commented Aug 29, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrej1991, carbonin

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

The pull request process is described here

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-merge-bot openshift-merge-bot bot merged commit dda8372 into rh-ecosystem-edge:main Aug 29, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants