|
3 | 3 | import json |
4 | 4 | from typing import Dict, Tuple |
5 | 5 | from fastapi import status |
| 6 | +import time |
6 | 7 |
|
7 | 8 | from application.config.config import Config |
8 | 9 | from application.exception.application_error import ApplicationError |
@@ -325,12 +326,14 @@ async def upgrade_provider(self, ssh_client, task_id: str) -> Dict: |
325 | 326 |
|
326 | 327 | # Upgrade hostname operator |
327 | 328 | log.info("Upgrading hostname operator...") |
328 | | - akash_hostname_operator_cmd = "helm -n akash-services upgrade akash-hostname-operator akash/akash-hostname-operator" if Config.CHAIN_ID == "akashnet-2" else "helm -n akash-services upgrade akash-hostname-operator akash-dev/akash-hostname-operator --devel" |
| 329 | + hostname_operator_version = Config.PROVIDER_HOSTNAME_OPERATOR_VERSION.lstrip("v") |
| 330 | + akash_hostname_operator_cmd = f"helm -n akash-services upgrade akash-hostname-operator akash/akash-hostname-operator --set image.tag={hostname_operator_version}" if Config.CHAIN_ID == "akashnet-2" else f"helm -n akash-services upgrade akash-hostname-operator akash-dev/akash-hostname-operator --set image.tag={hostname_operator_version} --devel" |
329 | 331 | run_ssh_command(ssh_client, akash_hostname_operator_cmd, True, task_id=task_id) |
330 | 332 |
|
331 | 333 | # Upgrade inventory operator |
332 | 334 | log.info("Upgrading inventory operator...") |
333 | | - akash_inventory_operator_cmd = "helm -n akash-services upgrade inventory-operator akash/akash-inventory-operator" if Config.CHAIN_ID == "akashnet-2" else "helm -n akash-services upgrade inventory-operator akash-dev/akash-inventory-operator --devel" |
| 335 | + inventory_operator_version = Config.PROVIDER_INVENTORY_OPERATOR_VERSION.lstrip("v") |
| 336 | + akash_inventory_operator_cmd = f"helm -n akash-services upgrade inventory-operator akash/akash-inventory-operator --set image.tag={inventory_operator_version}" if Config.CHAIN_ID == "akashnet-2" else f"helm -n akash-services upgrade inventory-operator akash-dev/akash-inventory-operator --set image.tag={inventory_operator_version} --devel" |
334 | 337 | run_ssh_command(ssh_client, akash_inventory_operator_cmd, True, task_id=task_id) |
335 | 338 |
|
336 | 339 | # Update price script |
@@ -358,8 +361,11 @@ async def upgrade_provider(self, ssh_client, task_id: str) -> Dict: |
358 | 361 | # Verify pod versions |
359 | 362 | log.info("Verifying pod versions...") |
360 | 363 | verify_cmd = "kubectl -n akash-services get pods -o custom-columns='NAME:.metadata.name,IMAGE:.spec.containers[*].image' | grep -v akash-node" |
| 364 | + log.info("Waiting for 20 seconds to allow pods to be upgraded...") |
| 365 | + time.sleep(20) # Wait for the pods to be upgraded |
361 | 366 | stdout, _ = run_ssh_command(ssh_client, verify_cmd, True, task_id=task_id) |
362 | 367 |
|
| 368 | + |
363 | 369 | if app_version not in stdout: |
364 | 370 | raise ApplicationError( |
365 | 371 | status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, |
|
0 commit comments