Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/e2e/test-openshell-gateway-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ if [ "$rewrote_openclaw" = "0" ]; then
printf 'add build-arg OPENCLAW_VERSION=%s\n' "$old_openclaw" >>"$log_file"
fi
if [ "$rewrote_base" = "0" ]; then
printf 'no BASE_IMAGE override seen; old Dockerfile default remains unchanged\n' >>"$log_file"
args+=("--build-arg" "BASE_IMAGE=${base_ref}")
printf 'add build-arg BASE_IMAGE=%s\n' "$base_ref" >>"$log_file"
Comment on lines +176 to +177

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fallback currently overrides explicit non-latest BASE_IMAGE args.

This add-path is correct only if rewrote_base truly means “a BASE_IMAGE override already exists.” Right now it is set only for the :latest pattern, so an explicit custom BASE_IMAGE=... still gets a second arg appended and overridden by this fallback.

Suggested fix
 while [ "$#" -gt 0 ]; do
   case "$1" in
     --build-arg)
+      if [ "$#" -ge 2 ] && [ "${2#BASE_IMAGE=}" != "$2" ]; then
+        rewrote_base=1
+      fi
       if [ "$#" -ge 2 ] && [ "${2#OPENCLAW_VERSION=}" != "$2" ]; then
         args+=("--build-arg" "OPENCLAW_VERSION=${old_openclaw}")
         rewrote_openclaw=1
         printf 'rewrite build-arg %s -> OPENCLAW_VERSION=%s\n' "$2" "$old_openclaw" >>"$log_file"
         shift 2
         continue
       fi
       if [ "$#" -ge 2 ] && [ "$2" = "BASE_IMAGE=ghcr.io/nvidia/nemoclaw/sandbox-base:latest" ]; then
         args+=("--build-arg" "BASE_IMAGE=${base_ref}")
         rewrote_base=1
         printf 'rewrite build-arg %s -> BASE_IMAGE=%s\n' "$2" "$base_ref" >>"$log_file"
         shift 2
         continue
       fi
       ;;
+    --build-arg=BASE_IMAGE=*)
+      rewrote_base=1
+      ;;
     --build-arg=OPENCLAW_VERSION=*)
       args+=("--build-arg=OPENCLAW_VERSION=${old_openclaw}")
       rewrote_openclaw=1
       printf 'rewrite build-arg %s -> OPENCLAW_VERSION=%s\n' "$1" "$old_openclaw" >>"$log_file"
       shift
       continue
       ;;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/test-openshell-gateway-upgrade.sh` around lines 176 - 177, The
fallback BASE_IMAGE arg is being appended even when an explicit non-`latest`
BASE_IMAGE was provided because `rewrote_base` is only set when matching the
`:latest` pattern; update the logic that decides to append (the code around
`args+=("--build-arg" "BASE_IMAGE=${base_ref}")` and the `rewrote_base` flag) to
detect any explicit override: either set `rewrote_base=true` when an explicit
BASE_IMAGE build-arg was passed in (or when `base_ref` was set from user input),
or instead check `args` for an existing `--build-arg` "BASE_IMAGE=" entry before
adding the fallback; ensure the log write to `"$log_file"` remains unchanged.

fi
exec "$real_docker" "${args[@]}"
EOF
Expand Down
Loading