-
Notifications
You must be signed in to change notification settings - Fork 29
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
Use environment variable for passing the private key password #2094
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c7cf4cc
feat: use docker-compose' environement variable parser for private ke…
angrybayblade 48fda08
feat: add deprecation warning for `--password` flag
angrybayblade 7fc391a
test: update service builder tests
angrybayblade 65d7139
docs: update API docs
angrybayblade 6bbc0ba
docs: update deploy command docs
angrybayblade df97616
fix: build tests
angrybayblade 997ed8b
fix: test coverage
angrybayblade d0daab8
fix: service spec test
angrybayblade File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,7 +110,6 @@ def __init__( # pylint: disable=too-many-arguments | |
self, | ||
service: Service, | ||
keys: Optional[List[Dict[str, str]]] = None, | ||
private_keys_password: Optional[str] = None, | ||
agent_instances: Optional[List[str]] = None, | ||
apply_environment_variables: bool = False, | ||
) -> None: | ||
|
@@ -128,7 +127,6 @@ def __init__( # pylint: disable=too-many-arguments | |
self._service_name_clean = self.service.name.replace("_", "") | ||
self._keys = keys or [] | ||
self._agent_instances = agent_instances | ||
self._private_keys_password = private_keys_password | ||
self._all_participants = self.try_get_all_participants() | ||
|
||
def get_abci_container_name(self, index: int) -> str: | ||
|
@@ -169,18 +167,6 @@ def try_get_all_participants(self) -> Optional[List[str]]: | |
|
||
return None | ||
|
||
@property | ||
def private_keys_password( | ||
self, | ||
) -> Optional[str]: | ||
"""Service password for agent keys.""" | ||
|
||
password = self._private_keys_password | ||
if password is None: | ||
password = os.environ.get("AUTONOLAS_SERVICE_PASSWORD") | ||
|
||
return password | ||
|
||
@property | ||
def agent_instances( | ||
self, | ||
|
@@ -214,7 +200,6 @@ def from_dir( # pylint: disable=too-many-arguments | |
path: Path, | ||
keys_file: Optional[Path] = None, | ||
number_of_agents: Optional[int] = None, | ||
private_keys_password: Optional[str] = None, | ||
agent_instances: Optional[List[str]] = None, | ||
apply_environment_variables: bool = False, | ||
) -> "ServiceBuilder": | ||
|
@@ -228,7 +213,6 @@ def from_dir( # pylint: disable=too-many-arguments | |
service_builder = cls( | ||
service=service, | ||
apply_environment_variables=apply_environment_variables, | ||
private_keys_password=private_keys_password, | ||
) | ||
|
||
if keys_file is not None: | ||
|
@@ -626,10 +610,12 @@ def generate_common_vars(self, agent_n: int) -> Dict: | |
ENV_VAR_AEA_AGENT: self.service.agent, | ||
ENV_VAR_LOG_LEVEL: self.log_level, | ||
} | ||
|
||
if self.private_keys_password is not None: | ||
agent_vars[ENV_VAR_AEA_PASSWORD] = self.private_keys_password | ||
|
||
if self.deplopyment_type == DOCKER_COMPOSE_DEPLOYMENT: | ||
agent_vars[ENV_VAR_AEA_PASSWORD] = "$OPEN_AUTONOMY_PRIVATE_KEY_PASSWORD" | ||
else: | ||
agent_vars[ENV_VAR_AEA_PASSWORD] = os.environ.get( | ||
"OPEN_AUTONOMY_PRIVATE_KEY_PASSWORD", "" | ||
) | ||
Comment on lines
+616
to
+618
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately the kubernetes does not provide such functionalities so we'll have to store them the old way |
||
return agent_vars | ||
|
||
def generate_agent( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will store the value of
AEA_PASSWORD
as$OPEN_AUTONOMY_PRIVATE_KEY_PASSWORD
in thedocker-compose.yaml
so the user can pass the password asOPEN_AUTONOMY_PRIVATE_KEY_PASSWORD
when running the deployment