Skip to content

Commit

Permalink
Merge pull request #733 from rhatdan/image
Browse files Browse the repository at this point in the history
Honor RAMALAMA_IMAGE if set
  • Loading branch information
rhatdan authored Feb 4, 2025
2 parents 5b48748 + 11fe787 commit 5e32fe9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ramalama/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
MNT_FILE = f"{MNT_DIR}/model.file"
HTTP_RANGE_NOT_SATISFIABLE = 416

DEFAULT_IMAGE="quay.io/ramalama/ramalama"

def container_manager():
engine = os.getenv("RAMALAMA_CONTAINER_ENGINE")
Expand Down Expand Up @@ -156,7 +157,7 @@ def default_image():
if image:
return image

return "quay.io/ramalama/ramalama"
return DEFAULT_IMAGE


def genname():
Expand Down
4 changes: 2 additions & 2 deletions ramalama/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from ramalama.common import (
container_manager,
default_image,
DEFAULT_IMAGE,
exec_cmd,
genname,
run_cmd,
Expand Down Expand Up @@ -106,7 +106,7 @@ def attempt_to_use_versioned(self, conman, image, vers, args):
return False

def _image(self, args):
if args.image != default_image():
if args.image != DEFAULT_IMAGE:
return args.image

env_vars = get_env_vars()
Expand Down
4 changes: 2 additions & 2 deletions test/system/030-run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ load helpers
run_ramalama 1 --nocontainer run --name foobar tiny
is "${lines[0]}" "Error: --nocontainer and --name options conflict. --name requires a container." "conflict between nocontainer and --name line"

RAMALAMA_IMAGE=${image} run_ramalama --dryrun run ${model}
is "$output" ".*${image}:latest llama-run" "verify image name"
RAMALAMA_IMAGE=${image}:1234 run_ramalama --dryrun run ${model}
is "$output" ".*${image}:1234 llama-run" "verify image name"
else
run_ramalama --dryrun run -c 4096 ${model}
is "$output" 'llama-run -c 4096 --temp 0.8.*/path/to/model.*' "dryrun correct"
Expand Down

0 comments on commit 5e32fe9

Please sign in to comment.