Skip to content

Commit 59151ce

Browse files
committed
fix: --update --tag dev pulls silently with alias, saves version
- No verbose "not found locally" messages when using :dev-cli alias - After pulling alias, saves the real version for next run - On subsequent --tag dev runs, uses versioned image directly Workflow: First run: lpb --tag dev --update → pulls :dev-cli silently After: last-version has real tag → uses 0.0.x-lpb-dev-cli directly
1 parent 55c8e2e commit 59151ce

1 file changed

Lines changed: 36 additions & 37 deletions

File tree

scripts/lpb.py

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -887,54 +887,53 @@ def cmd_update():
887887
# Self-update
888888
self_update()
889889

890-
# Resolve current tag
891-
tag = cfg.image_tag
892-
cli_img = resolve_cli_image(tag)
893-
web_img = resolve_web_image(tag)
894-
895-
# Determine which image(s) to update based on what's locally available
896-
last_ver = load_last_version()
890+
# Determine which image(s) to pull
897891
images_to_update = []
898-
if c.images_exists(cli_img):
899-
images_to_update.append(cli_img)
900-
if c.images_exists(web_img):
901-
images_to_update.append(web_img)
902-
if not images_to_update:
903-
# If a specific tag was requested, pull it even if not local
904-
if cfg.image_tag and cfg.image_tag in ("dev", "main"):
905-
# Use the branch alias tag (:dev-cli/:main-cli) which always exists
906-
if cfg.image_tag == "dev":
907-
alias_cli = f"{CLI_IMAGE.rsplit(':', 1)[0]}:dev-cli"
908-
alias_web = f"{WEB_IMAGE.rsplit(':', 1)[0]}:dev-web"
909-
else:
910-
alias_cli = f"{CLI_IMAGE.rsplit(':', 1)[0]}:main-cli"
911-
alias_web = f"{WEB_IMAGE.rsplit(':', 1)[0]}:main-web"
912-
info(f"{cli_img} not found locally, pulling alias {alias_cli}...")
913-
images_to_update.append(alias_cli)
914-
images_to_update.append(alias_web)
915-
elif not images_to_update:
916-
# Fall back to default images (no tag)
892+
893+
if cfg.image_tag in ("dev", "main"):
894+
# Use the branch alias which always exists
895+
if cfg.image_tag == "dev":
896+
alias_cli = f"{CLI_IMAGE.rsplit(':', 1)[0]}:dev-cli"
897+
alias_web = f"{WEB_IMAGE.rsplit(':', 1)[0]}:dev-web"
898+
else:
899+
alias_cli = f"{CLI_IMAGE.rsplit(':', 1)[0]}:main-cli"
900+
alias_web = f"{WEB_IMAGE.rsplit(':', 1)[0]}:main-web"
901+
images_to_update = [alias_cli, alias_web]
902+
else:
903+
# Resolve current tag (dev/main/latest or custom version)
904+
tag = cfg.image_tag
905+
cli_img = resolve_cli_image(tag)
906+
web_img = resolve_web_image(tag)
907+
if c.images_exists(cli_img):
908+
images_to_update.append(cli_img)
909+
if c.images_exists(web_img):
910+
images_to_update.append(web_img)
911+
if not images_to_update:
912+
# Fall back to default images
917913
for img in [CLI_IMAGE, WEB_IMAGE]:
918914
if c.images_exists(img):
919915
images_to_update.append(img)
916+
920917
if not images_to_update:
921-
# Fall back to the last used version
922-
if last_ver:
923-
fallback_cli = _resolve_version_image(last_ver, "cli")
924-
if c.images_exists(fallback_cli):
925-
images_to_update.append(fallback_cli)
926-
fallback_web = _resolve_version_image(last_ver, "web")
927-
if c.images_exists(fallback_web):
928-
images_to_update.append(fallback_web)
929-
if not images_to_update:
930-
err("No devstack images found locally", "Run 'lpb' or 'lpb --web' first to pull an image.")
931-
raise DevstackError
918+
err("No devstack images found locally",
919+
"Run 'lpb' or 'lpb --web' first to pull an image.")
920+
raise DevstackError
932921

933922
for img in images_to_update:
934923
info(f"Pulling {img}...")
935924
rc = c.images_pull(img)
936925
if rc != 0:
937926
err(f"Failed to pull {img}")
927+
928+
# Save last version from alias images
929+
if cfg.image_tag in ("dev", "main") and images_to_update:
930+
for img in images_to_update:
931+
last = img.rsplit(":", 1)[-1]
932+
if last not in ("dev-cli", "dev-web", "main-cli", "main-web"):
933+
# Already a versioned tag
934+
_save_version(last.replace("-cli", "").replace("-web", ""))
935+
break
936+
938937
done("Images up to date.")
939938

940939

0 commit comments

Comments
 (0)