Skip to content

Create a new role create-devflag#49

Merged
Jooho merged 7 commits intomainfrom
role-devflag
Jun 25, 2025
Merged

Create a new role create-devflag#49
Jooho merged 7 commits intomainfrom
role-devflag

Conversation

@Jooho
Copy link
Owner

@Jooho Jooho commented Jun 25, 2025

Summary by CodeRabbit

  • New Features

    • Introduced automation scripts and configuration for building, tagging, and pushing container images, managing Git repositories, updating manifests, and verifying image and branch states for KServe development workflows.
    • Added comprehensive configuration and usage documentation for new development flag creation workflows.
  • Chores

    • Updated CI workflow to exclude certain directories from triggering KIND cluster lifecycle tests.
    • Commented out the ROSA Openshift Cluster installation step in the KServe E2E test playbook.
  • Style

    • Removed an informational log line from the E2E test script output.

Jooho added 7 commits June 20, 2025 17:28
…with-existing-cluster'

Signed-off-by: Jooho Lee <jlee@redhat.com>
Signed-off-by: Jooho Lee <jlee@redhat.com>
…e tests

Signed-off-by: Jooho Lee <jlee@redhat.com>
Signed-off-by: Jooho Lee <jlee@redhat.com>
Signed-off-by: Jooho Lee <jlee@redhat.com>
Signed-off-by: Jooho Lee <jlee@redhat.com>
Signed-off-by: Jooho Lee <jlee@redhat.com>
@coderabbitai
Copy link

coderabbitai bot commented Jun 25, 2025

Walkthrough

This update introduces new automation scripts and configuration for managing container image builds, Git operations, and manifest updates for KServe development workflows. It also modifies workflow triggers for KIND cluster lifecycle tests, removes a logging line from an E2E test runner, and comments out the ROSA install step in a playbook.

Changes

File(s) Change Summary
.github/workflows/e2e-cluster-lifecycle.yml Adjusted workflow trigger: removed default_provided_services/ from file path pattern, so changes there no longer trigger KIND cluster lifecycle tests.
src/roles/kserve/tests/create-devflag/build.sh
src/roles/kserve/tests/create-devflag/main.sh
src/roles/kserve/tests/create-devflag/validation.sh
src/roles/kserve/tests/create-devflag/verify.sh
Added new Bash scripts for automating container image build/push, Git branch management, manifest updates, environment validation, and verification for the KServe devflag role.
src/roles/kserve/tests/create-devflag/config.yaml Added YAML configuration detailing environment variables, usage, and requirements for the new create-devflag role.
src/roles/kserve/tests/e2e-test/main.sh Removed a logging line for the PYTEST_MARKER variable before pytest execution.
unofficial_components/playbooks/odh-test/kserve-e2e-test-with-existing-cluster/config.yaml Commented out the "openshift-rosa-install" role step, disabling cluster installation in the playbook.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Script as create-devflag/main.sh
    participant Git as GitHub Repo
    participant Registry as Container Registry

    Dev->>Script: Run automation with env variables
    Script->>Script: Validate environment (validation.sh)
    Script->>Git: Clone/setup repo & checkout branch (build.sh)
    alt Custom image
        Script->>Registry: Use provided image
    else Build image
        Script->>Registry: Build & push image (build.sh)
    end
    Script->>Git: Update manifests & push branch (build.sh)
    Script->>Script: Run verifications (verify.sh)
    Script->>Dev: Output manifest tarball URL
Loading

Possibly related PRs

  • Jooho/loopy#29: Adds a composite GitHub Action for KIND cluster creation, related at the workflow level to cluster lifecycle automation.
  • Jooho/loopy#44: Refines cluster lifecycle workflow triggers in the same workflow file, closely related to trigger logic changes in this PR.

Suggested labels

lgtm

Suggested reviewers

  • github-actions

Poem

🐇
In the warren of code, new scripts now hop,
Building and pushing, they just won’t stop!
With branches and images, manifests in tow,
Automation’s magic helps releases flow.
Cluster triggers trimmed, logs now less chatty—
This bunny’s quite proud, and feeling quite happy!

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • @coderabbitai modularize this function.
  • 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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

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

🧹 Nitpick comments (10)
unofficial_components/playbooks/odh-test/kserve-e2e-test-with-existing-cluster/config.yaml (1)

70-72: Avoid commented-out YAML; use a conditional flag to disable the role

Commenting out list items works but gradually clutters the playbook and risks merge conflicts. Prefer keeping the step active and gating execution with a when: false (or a dedicated variable) so the structure remains intact and re-enabling is one-line.

-    # - role:
-    #     name: openshift-rosa-install
-    #     description: Install ROSA Openshift Cluster
+    - role:
+        name: openshift-rosa-install
+        description: Install ROSA Openshift Cluster
+        when: false            # temporarily disabled

This keeps YAML valid, self-documenting, and easier to toggle.

src/roles/kserve/tests/create-devflag/config.yaml (2)

1-3: Directory name violates repository naming convention

The coding guidelines mandate lowercase with underscores. The directory create-devflag/ contains a hyphen.
Consider renaming it to create_devflag/ for consistency across the repo.


18-23: Remove trailing whitespace to satisfy YAML-lint

Lines 18, 20 and 23 contain superfluous spaces flagged by YAML-lint.
Whitespace at EOL adds churn in diffs and may break strict CI linters.

 ...
 ...
src/roles/kserve/tests/create-devflag/main.sh (2)

33-34: role_name is never used

Shellcheck SC2034 is right; remove the dead variable to keep the script tidy.


75-80: exit renders following code unreachable

result=1 after an exit will never execute. Delete or move the assignment before exit.

src/roles/kserve/tests/create-devflag/validation.sh (1)

7-8: Utility script sourced on every call – move outside function

utils.sh is sourced each time validate_env_vars runs, which is unnecessary overhead and can lead to double definition of helpers. Source it once at file scope instead.

src/roles/kserve/tests/create-devflag/verify.sh (1)

47-49: repo_name parameter is unused

The third argument is accepted but never referenced; drop it or implement its intended use to avoid future confusion.

src/roles/kserve/tests/create-devflag/build.sh (3)

10-16: Misleading comment: looking for “.git” but messaging refers to “.github”
The loop correctly searches for a .git directory, yet the surrounding comments and the error message mention “.github”. This is confusing for future maintainers – please align the wording with the actual behaviour (or vice-versa).


88-92: Unquoted operands in string comparison – may expand globs (SC2053)
Guard against pathname expansion by quoting both sides:

-if [[ $(basename "$ORIGINAL_DIR") != ${COMPONENT_NAME} ]]; then
+if [[ "$(basename "$ORIGINAL_DIR")" != "${COMPONENT_NAME}" ]]; then

61-64: Hard-coded local image reference may break multi-arch or non-Docker workflows
The tag step assumes docker.io/library/${component}-controller:latest exists locally. In environments using Podman, a custom TAG, or a multi-arch build, this may be incorrect. Consider deriving the local image reference from the make docker-build target (e.g. via an output variable) or tag directly from the build output to avoid coupling to the Docker Hub namespace.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b73d564 and b6e424f.

📒 Files selected for processing (8)
  • .github/workflows/e2e-cluster-lifecycle.yml (1 hunks)
  • src/roles/kserve/tests/create-devflag/build.sh (1 hunks)
  • src/roles/kserve/tests/create-devflag/config.yaml (1 hunks)
  • src/roles/kserve/tests/create-devflag/main.sh (1 hunks)
  • src/roles/kserve/tests/create-devflag/validation.sh (1 hunks)
  • src/roles/kserve/tests/create-devflag/verify.sh (1 hunks)
  • src/roles/kserve/tests/e2e-test/main.sh (0 hunks)
  • unofficial_components/playbooks/odh-test/kserve-e2e-test-with-existing-cluster/config.yaml (1 hunks)
💤 Files with no reviewable changes (1)
  • src/roles/kserve/tests/e2e-test/main.sh
🧰 Additional context used
📓 Path-based instructions (1)
`**/*`: Use lowercase with underscores for directories and files (e.g., routers/user_routes.py).

**/*: Use lowercase with underscores for directories and files (e.g., routers/user_routes.py).

  • unofficial_components/playbooks/odh-test/kserve-e2e-test-with-existing-cluster/config.yaml
  • src/roles/kserve/tests/create-devflag/main.sh
  • src/roles/kserve/tests/create-devflag/verify.sh
  • src/roles/kserve/tests/create-devflag/build.sh
  • src/roles/kserve/tests/create-devflag/config.yaml
  • src/roles/kserve/tests/create-devflag/validation.sh
🪛 Shellcheck (0.10.0)
src/roles/kserve/tests/create-devflag/main.sh

[warning] 33-33: role_name appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 98-98: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

src/roles/kserve/tests/create-devflag/verify.sh

[warning] 48-48: repo_name appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 50-50: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

src/roles/kserve/tests/create-devflag/build.sh

[warning] 73-73: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 86-86: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 88-88: Quote the right-hand side of != in [[ ]] to prevent glob matching.

(SC2053)


[warning] 183-183: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

🪛 YAMLlint (1.37.1)
src/roles/kserve/tests/create-devflag/config.yaml

[error] 18-18: trailing spaces

(trailing-spaces)


[error] 20-20: trailing spaces

(trailing-spaces)


[error] 23-23: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: kind-cluster-lifecycle-test (3.13)
  • GitHub Check: cluster-test (3.12)
  • GitHub Check: non-cluster-test (3.12)
🔇 Additional comments (1)
.github/workflows/e2e-cluster-lifecycle.yml (1)

24-27: Confirm the exclude-list still matches desired paths

default_provided_services/ was removed from the regexp.
If any cluster-lifecycle relevant code now lives there, the tests will silently skip.

Request verification that this omission is intentional and documented.

Comment on lines +98 to +99
cd $GIT_PARENT_REPO_DIR/${COMPONENT_NAME}
# Check and update controller image in params.env
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling to cd

A failing cd will silently continue in the wrong directory.

-cd $GIT_PARENT_REPO_DIR/${COMPONENT_NAME}
+cd "$GIT_PARENT_REPO_DIR/${COMPONENT_NAME}" || { error "Unable to cd into repo dir"; exit 1; }
📝 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
cd $GIT_PARENT_REPO_DIR/${COMPONENT_NAME}
# Check and update controller image in params.env
cd "$GIT_PARENT_REPO_DIR/${COMPONENT_NAME}" || { error "Unable to cd into repo dir"; exit 1; }
# Check and update controller image in params.env
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 98-98: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

🤖 Prompt for AI Agents
In src/roles/kserve/tests/create-devflag/main.sh at lines 98-99, the script
changes directory using `cd` without checking if it succeeded. Add error
handling by testing the exit status of the `cd` command immediately after it
runs, and if it fails, print an error message and exit the script to prevent
continuing in the wrong directory.

Comment on lines +23 to +24
source $root_directory/src/commons/scripts/utils.sh
## INIT END ##
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Quote sourced path & check existence

Unquoted $root_directory can break when the path contains spaces; sourcing a non-existent file will abort.

-source $root_directory/src/commons/scripts/utils.sh
+UTILS_FILE="${root_directory}/src/commons/scripts/utils.sh"
+[[ -f "$UTILS_FILE" ]] || { echo "utils.sh not found at $UTILS_FILE" >&2; exit 1; }
+source "$UTILS_FILE"
📝 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
source $root_directory/src/commons/scripts/utils.sh
## INIT END ##
# before:
# source $root_directory/src/commons/scripts/utils.sh
# ## INIT END ##
# after:
UTILS_FILE="${root_directory}/src/commons/scripts/utils.sh"
[[ -f "$UTILS_FILE" ]] || {
echo "utils.sh not found at $UTILS_FILE" >&2
exit 1
}
source "$UTILS_FILE"
## INIT END ##
🤖 Prompt for AI Agents
In src/roles/kserve/tests/create-devflag/main.sh around lines 23 to 24, the
sourced path $root_directory/src/commons/scripts/utils.sh is unquoted, which can
cause issues if $root_directory contains spaces, and the script does not check
if the file exists before sourcing. Fix this by quoting the entire path to
handle spaces properly and add a check to verify the file exists before sourcing
it to prevent the script from aborting unexpectedly.

Comment on lines +3 to +5
if [[ $DEBUG == "0" ]]; then
set -x
fi
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

DEBUG guard inverted – set -x enabled when DEBUG==0

Usually tracing is enabled for non-zero / truthy DEBUG. Current logic does the opposite.

-if [[ $DEBUG == "0" ]]; then
-  set -x
-fi
+if [[ "${DEBUG:-0}" != "0" ]]; then
+  set -x
+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 [[ $DEBUG == "0" ]]; then
set -x
fi
if [[ "${DEBUG:-0}" != "0" ]]; then
set -x
fi
🤖 Prompt for AI Agents
In src/roles/kserve/tests/create-devflag/main.sh at lines 3 to 5, the condition
enabling set -x is inverted; it currently enables tracing when DEBUG equals "0".
Change the condition to enable set -x only when DEBUG is non-zero or truthy, for
example by checking if DEBUG is not equal to "0" or if DEBUG is set and
non-empty.

Comment on lines +28 to +33
# Get local image SHA
local_sha=$(${CONTAINER_CLI} inspect docker.io/library/${COMPONENT_NAME}-controller:latest | jq -r '.[0].Id' 2>/dev/null)
if [[ -z "$local_sha" || "$local_sha" == "null" ]]; then
error "Failed to get local image SHA"
return 1
fi
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Local SHA comparison uses hard-coded docker.io/library image

The built image is pushed to ${REGISTRY_URL}/${COMPONENT_NAME}-controller:${CTRL_IMG_TAG}; inspecting docker.io/library/...:latest will almost always mismatch.

-  local_sha=$(${CONTAINER_CLI} inspect docker.io/library/${COMPONENT_NAME}-controller:latest | jq -r '.[0].Id' 2>/dev/null)
+  local_sha=$(${CONTAINER_CLI} inspect "$image_url" | jq -r '.[0].Id' 2>/dev/null)

This aligns SHA comparison with the actual image pushed.

📝 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
# Get local image SHA
local_sha=$(${CONTAINER_CLI} inspect docker.io/library/${COMPONENT_NAME}-controller:latest | jq -r '.[0].Id' 2>/dev/null)
if [[ -z "$local_sha" || "$local_sha" == "null" ]]; then
error "Failed to get local image SHA"
return 1
fi
# Get local image SHA
local_sha=$(${CONTAINER_CLI} inspect "$image_url" | jq -r '.[0].Id' 2>/dev/null)
if [[ -z "$local_sha" || "$local_sha" == "null" ]]; then
error "Failed to get local image SHA"
return 1
fi
🤖 Prompt for AI Agents
In src/roles/kserve/tests/create-devflag/verify.sh around lines 28 to 33, the
local image SHA is being retrieved by inspecting a hard-coded image reference
using docker.io/library, which does not match the actual image pushed. Update
the image reference in the inspect command to use the variable
${REGISTRY_URL}/${COMPONENT_NAME}-controller:${CTRL_IMG_TAG} instead of
docker.io/library/${COMPONENT_NAME}-controller:latest to ensure the SHA
comparison aligns with the correct pushed image.

Comment on lines +50 to +53
cd $repo_dir

if git remote show ${user_name} >/dev/null 2>&1; then
info "Username remote found: ${user_name}"
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 cd with failure check

cd $repo_dir will exit the subshell on error but continue verification producing misleading results.

-cd $repo_dir
+cd "$repo_dir" || { error "Cannot cd into $repo_dir"; return 1; }
📝 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
cd $repo_dir
if git remote show ${user_name} >/dev/null 2>&1; then
info "Username remote found: ${user_name}"
cd "$repo_dir" || { error "Cannot cd into $repo_dir"; return 1; }
if git remote show ${user_name} >/dev/null 2>&1; then
info "Username remote found: ${user_name}"
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 50-50: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

🤖 Prompt for AI Agents
In src/roles/kserve/tests/create-devflag/verify.sh around lines 50 to 53, the
command `cd $repo_dir` is not checked for failure, which can cause the script to
continue running with misleading results if the directory change fails. Add a
check immediately after `cd $repo_dir` to verify it succeeded, and if not, exit
the script or handle the error appropriately to prevent further execution.

Comment on lines +72 to +76
if [[ "${use_case}" != "LOCAL_SOURCE" ]]; then
cd $target_parent_directory

# Clone repository
if [[ -d ${COMPONENT_NAME} ]]; then
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

cd commands are unchecked – script may operate in an unexpected directory
ShellCheck SC2164 flags these instances. Add || exit 1 (or || return 1 inside functions) to fail fast when the target directory is missing:

-cd "$target_parent_directory"
+cd "$target_parent_directory" || return 1
...
-cd ${COMPONENT_NAME}
+cd "${COMPONENT_NAME}" || return 1
...
-cd "$target_parent_directory/${COMPONENT_NAME}"
+cd "$target_parent_directory/${COMPONENT_NAME}" || return 1

Also applies to: 86-87, 183-184

🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 73-73: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

🤖 Prompt for AI Agents
In src/roles/kserve/tests/create-devflag/build.sh around lines 72 to 76, the cd
commands lack error checking, which can cause the script to continue running in
the wrong directory if the cd fails. To fix this, append || exit 1 to each cd
command outside functions to ensure the script exits immediately if changing
directories fails. Apply the same fix to the cd commands at lines 86-87 and
183-184.

Comment on lines +3 to +5
if [[ $DEBUG == "0" ]]; then
set -x
fi
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

DEBUG flag logic looks inverted and unquoted – trace will be enabled when DEBUG is “0”
set -x is usually activated when a truthy / non-zero DEBUG is supplied. As written, the script goes verbose for the “off” value and is silent otherwise. Additionally the variable is unquoted.

-if [[ $DEBUG == "0" ]]; then
-  set -x
-fi
+if [[ "${DEBUG}" == "1" ]]; then   # enable tracing only when explicitly requested
+  set -x
+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 [[ $DEBUG == "0" ]]; then
set -x
fi
if [[ "${DEBUG}" == "1" ]]; then # enable tracing only when explicitly requested
set -x
fi
🤖 Prompt for AI Agents
In src/roles/kserve/tests/create-devflag/build.sh around lines 3 to 5, the DEBUG
flag logic is inverted and the variable is unquoted. To fix this, change the
condition to enable set -x when DEBUG is not "0" (i.e., when DEBUG is truthy),
and quote the variable in the test to prevent word splitting or errors. This
means using a condition like if [[ "$DEBUG" != "0" ]]; then set -x; fi.

Comment on lines +17 to +23
if [ -d "$github_dir/.git" ]; then
root_directory="$github_dir"
else
echo "Error: Unable to find .github folder."
fi
source $root_directory/src/commons/scripts/utils.sh
## INIT END ##
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Script continues after root-repo discovery failure – will dereference an uninitialised variable
If the .git folder isn’t found, root_directory stays unset, yet the script still executes source $root_directory/..., leading to “No such file or directory”. Bail out early and quote the variable when sourcing:

-else
-  echo "Error: Unable to find .github folder."
-fi
-source $root_directory/src/commons/scripts/utils.sh
+else
+  echo "Error: Unable to find .git folder. Aborting."
+  exit 1
+fi
+source "${root_directory}/src/commons/scripts/utils.sh"
📝 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 [ -d "$github_dir/.git" ]; then
root_directory="$github_dir"
else
echo "Error: Unable to find .github folder."
fi
source $root_directory/src/commons/scripts/utils.sh
## INIT END ##
if [ -d "$github_dir/.git" ]; then
root_directory="$github_dir"
else
echo "Error: Unable to find .git folder. Aborting."
exit 1
fi
source "${root_directory}/src/commons/scripts/utils.sh"
## INIT END ##
🤖 Prompt for AI Agents
In src/roles/kserve/tests/create-devflag/build.sh around lines 17 to 23, the
script continues after failing to find the .git folder, causing root_directory
to be unset and leading to an error when sourcing utils.sh. Fix this by adding
an exit command immediately after the error message to stop the script, and
quote the root_directory variable in the source command to handle any spaces
safely.

@Jooho
Copy link
Owner Author

Jooho commented Jun 25, 2025

/lgtm
/approve

@github-actions github-actions bot added the lgtm label Jun 25, 2025
@Jooho Jooho merged commit 0d50f3e into main Jun 25, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant