Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Fix]: agenta CLI does not work anymore post-release (project structure) #2117

Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions agenta-backend/agenta_backend/routers/app_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ async def create_app(
request.state.user_id,
Permission.CREATE_APPLICATION,
)

workspace_id_from_apikey = await db_manager_ee.get_workspace_id_from_apikey(
api_key_from_headers, request.state.user_id
)
if payload.workspace_id is None:
payload.workspace_id = workspace_id_from_apikey

try:
user_org_workspace_data = await get_user_org_and_workspace_id(
request.state.user_id
Expand Down
6 changes: 4 additions & 2 deletions agenta-backend/agenta_backend/routers/variants_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,16 @@ async def start_variant(

if action.action == VariantActionEnum.START:
url: URI = await app_manager.start_variant(
app_variant_db, str(app_variant_db.project_id), envvars
app_variant_db,
str(app_variant_db.project_id),
envvars,
request.state.user_id,
)

# Deploy to production
await db_manager.deploy_to_environment(
environment_name="production",
variant_id=str(app_variant_db.id),
project_id=str(app_variant_db.project_id),
user_uid=request.state.user_id,
)
return url
Expand Down
8 changes: 5 additions & 3 deletions agenta-backend/agenta_backend/services/app_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ async def update_variant_image(
)

# Start variant
await start_variant(app_variant_db, project_id)
await start_variant(app_variant_db, project_id, user_uid=user_uid)


async def update_last_modified_by(
Expand Down Expand Up @@ -313,9 +313,11 @@ async def terminate_and_remove_app_variant(
logger.error(f"Failed to stop and delete service {deployment} {e}")

# If image deletable is True, remove docker image and image db
if image.deletable:
if image is not None and image.deletable:
try:
if isCloudEE():
if isCloudDev() or isOss():
await deployment_manager.remove_image(image)
elif isCloudEE():
await deployment_manager.remove_repository(image.tags) # type: ignore
else:
await deployment_manager.remove_image(image)
Expand Down
Loading