diff --git a/autonomy/cli/helpers/deployment.py b/autonomy/cli/helpers/deployment.py
index c013c46c96..896abe5efd 100644
--- a/autonomy/cli/helpers/deployment.py
+++ b/autonomy/cli/helpers/deployment.py
@@ -65,7 +65,7 @@
from autonomy.deploy.image import build_image
-def _build_dirs(build_dir: Path, mkdir: list[str] = []) -> None:
+def _build_dirs(build_dir: Path, mkdir: List[str]) -> None:
"""Build necessary directories."""
mkdirs = [(new_dir_name,) for new_dir_name in mkdir]
@@ -257,7 +257,7 @@ def build_deployment( # pylint: disable=too-many-arguments, too-many-locals
resources: Optional[Resources] = None,
service_hash_id: Optional[str] = None,
service_offset: int = 0,
- mkdir: Optional[str] = None,
+ mkdir: Optional[List[str]] = None,
) -> None:
"""Build deployment."""
@@ -271,7 +271,8 @@ def build_deployment( # pylint: disable=too-many-arguments, too-many-locals
click.echo(f"Building deployment @ {build_dir}")
build_dir.mkdir()
- _build_dirs(build_dir, mkdir)
+ if mkdir is not None:
+ _build_dirs(build_dir, mkdir)
if service_hash_id is None:
service_hash_id = build_hash_id()
diff --git a/autonomy/deploy/generators/localhost/base.py b/autonomy/deploy/generators/localhost/base.py
index 1a1f7e88a8..e269572c57 100644
--- a/autonomy/deploy/generators/localhost/base.py
+++ b/autonomy/deploy/generators/localhost/base.py
@@ -48,6 +48,7 @@
)
from autonomy.deploy.generators.localhost.utils import (
check_tendermint_version,
+ run_aea_cmd,
setup_agent,
)
@@ -114,6 +115,7 @@ def _populate_keys(self) -> None:
ledger = kp.get(LEDGER, DEFAULT_LEDGER)
keys_file = self.build_dir / PRIVATE_KEY_PATH_SCHEMA.format(ledger)
keys_file.write_text(key, encoding=DEFAULT_ENCODING)
+ run_aea_cmd(["issue-certificates"], cwd=self.build_dir)
def _populate_keys_multiledger(self) -> None:
"""Populate the keys directory with multiple set of keys"""
diff --git a/autonomy/deploy/generators/localhost/utils.py b/autonomy/deploy/generators/localhost/utils.py
index a0bddc56cc..30383388c8 100644
--- a/autonomy/deploy/generators/localhost/utils.py
+++ b/autonomy/deploy/generators/localhost/utils.py
@@ -25,7 +25,7 @@
import subprocess # nosec
import sys
from pathlib import Path
-from typing import Any, List, Optional
+from typing import Any, Dict, List, Optional
from aea.configurations.constants import DEFAULT_AEA_CONFIG_FILE, VENDOR
@@ -69,12 +69,12 @@ def check_tendermint_version() -> Path:
return tendermint_executable
-def _run_aea_cmd(
+def run_aea_cmd(
args: List[str],
cwd: Optional[Path] = None,
stdout: int = subprocess.PIPE,
stderr: int = subprocess.PIPE,
- ignore_error: str | None = None,
+ ignore_error: Optional[str] = None,
**kwargs: Any,
) -> None:
"""Run an aea command in a subprocess."""
@@ -121,7 +121,7 @@ def _prepare_agent_env(working_dir: Path) -> None:
)
-def setup_agent(working_dir: Path, agent_config: dict[str, Any]) -> None:
+def setup_agent(working_dir: Path, agent_config: Dict[str, Any]) -> None:
"""Setup locally deployed agent."""
_prepare_agent_env(working_dir)
shutil.copy(DEFAULT_AEA_CONFIG_FILE, working_dir)
@@ -134,10 +134,8 @@ def setup_agent(working_dir: Path, agent_config: dict[str, Any]) -> None:
for ledger_name, path in agent_config.get("private_key_paths", {}).items():
if Path(path).exists():
shutil.copy(path, working_dir)
- _run_aea_cmd(
+ run_aea_cmd(
["add-key", ledger_name],
cwd=working_dir,
ignore_error="already present",
)
-
- _run_aea_cmd(["issue-certificates"], cwd=working_dir)
diff --git a/docs/api/cli/deploy.md b/docs/api/cli/deploy.md
index cc7c3a5838..23d609341b 100644
--- a/docs/api/cli/deploy.md
+++ b/docs/api/cli/deploy.md
@@ -149,9 +149,9 @@ Deploy an agent service.
@click.option(
"--mkdir",
type=str,
- help=
- "Comma-separated list of directory names to create in the build directory.",
- default=None,
+ help="Directory names to create in the build directory.",
+ default=[],
+ multiple=True,
)
@registry_flag()
@password_option(confirmation_prompt=True)
@@ -164,6 +164,7 @@ def build_deployment_command(
output_dir: Optional[Path],
dev_mode: bool,
registry: str,
+ mkdir: list[str],
number_of_agents: Optional[int] = None,
number_of_services: int = 1,
password: Optional[str] = None,
@@ -179,8 +180,7 @@ def build_deployment_command(
agent_cpu_limit: Optional[float] = None,
agent_memory_limit: Optional[int] = None,
agent_cpu_request: Optional[float] = None,
- agent_memory_request: Optional[int] = None,
- mkdir: Optional[str] = None) -> None
+ agent_memory_request: Optional[int] = None) -> None
```
Build deployment setup for n agents.
@@ -227,11 +227,8 @@ Build deployment setup for n agents.
help="Use docker as a backend. (default)",
default=True,
)
-def run(build_dir: Path,
- no_recreate: bool,
- remove_orphans: bool,
- detach: bool = False,
- deployment_type: str = "localhost") -> None
+def run(build_dir: Path, no_recreate: bool, remove_orphans: bool, detach: bool,
+ deployment_type: str) -> None
```
Run deployment.
diff --git a/docs/api/cli/helpers/deployment.md b/docs/api/cli/helpers/deployment.md
index 4360fa11ef..466c8e0a71 100644
--- a/docs/api/cli/helpers/deployment.md
+++ b/docs/api/cli/helpers/deployment.md
@@ -62,7 +62,7 @@ def build_deployment(keys_file: Path,
resources: Optional[Resources] = None,
service_hash_id: Optional[str] = None,
service_offset: int = 0,
- mkdir: Optional[str] = None) -> None
+ mkdir: Optional[List[str]] = None) -> None
```
Build deployment.
diff --git a/docs/api/deploy/generators/localhost/utils.md b/docs/api/deploy/generators/localhost/utils.md
index b45558406a..a583317b02 100644
--- a/docs/api/deploy/generators/localhost/utils.md
+++ b/docs/api/deploy/generators/localhost/utils.md
@@ -14,12 +14,27 @@ def check_tendermint_version() -> Path
Check tendermint version.
+
+
+#### run`_`aea`_`cmd
+
+```python
+def run_aea_cmd(args: List[str],
+ cwd: Optional[Path] = None,
+ stdout: int = subprocess.PIPE,
+ stderr: int = subprocess.PIPE,
+ ignore_error: Optional[str] = None,
+ **kwargs: Any) -> None
+```
+
+Run an aea command in a subprocess.
+
#### setup`_`agent
```python
-def setup_agent(working_dir: Path, agent_config: dict[str, Any]) -> None
+def setup_agent(working_dir: Path, agent_config: Dict[str, Any]) -> None
```
Setup locally deployed agent.
diff --git a/tests/test_autonomy/test_chain/test_addresses.py b/tests/test_autonomy/test_chain/test_addresses.py
index 2a9e168df9..9e939ebdbe 100644
--- a/tests/test_autonomy/test_chain/test_addresses.py
+++ b/tests/test_autonomy/test_chain/test_addresses.py
@@ -29,7 +29,9 @@
from autonomy.chain.constants import CHAIN_PROFILES
-ADDRESS_FILE_URL = "https://raw.githubusercontent.com/valory-xyz/autonolas-registries/main/docs/configuration.json"
+# this file is fetched from an old commit, because the latest file version has removed some chains
+# TODO: use the latest file
+ADDRESS_FILE_URL = "https://github.com/valory-xyz/autonolas-registries/raw/a6a35cf7bbdbac64eeab9375c0b32848b266a166/docs/configuration.json"
class TestAddresses:
diff --git a/tests/test_autonomy/test_cli/test_deploy/test_build/test_deployment.py b/tests/test_autonomy/test_cli/test_deploy/test_build/test_deployment.py
index 5a2c71c0fa..c329b78059 100644
--- a/tests/test_autonomy/test_cli/test_deploy/test_build/test_deployment.py
+++ b/tests/test_autonomy/test_cli/test_deploy/test_build/test_deployment.py
@@ -78,7 +78,7 @@
TM_STATE_DIR,
)
from autonomy.deploy.generators.docker_compose.base import DockerComposeGenerator
-from autonomy.deploy.generators.localhost.utils import _run_aea_cmd
+from autonomy.deploy.generators.localhost.utils import run_aea_cmd
from autonomy.replay.agent import ETHEREUM_PRIVATE_KEY_FILE
from tests.conftest import ROOT_DIR, skip_docker_tests
@@ -269,7 +269,7 @@ def setup(self) -> None:
# add all the components
for component_type in (CONNECTION, CONTRACT, SKILL, PROTOCOL):
for component_name in agent_config[component_type + "s"]:
- _run_aea_cmd(
+ run_aea_cmd(
[
"--skip-consistency-check",
"add",