Skip to content

Commit

Permalink
Weathertop: Add --language flag to deploy.py runner. (#6967)
Browse files Browse the repository at this point in the history
* Add --language flag to deploy.py runner.
  • Loading branch information
DavidSouther authored Oct 9, 2024
1 parent 9715d48 commit cf73ec2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .tools/test/DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ python -m venv .venv && source .venv/bin/activate && pip install -r requirements
#### Command Syntax

```bash
python stacks/deploy.py --type <deployment_type>
cd stacks ; python deploy.py <stack>
```

Replace `<deployment_type>` with one of the supported types:
Replace `<stack>` with one of the supported stacks:

- `admin`: Deploys admin-specific resources.
- `images`: Deploys image-related resources.
- `plugin`: Deploys plugin-specific resources.
- To deploy only a specific language's plugin, pass `--language <language>` where language is an account in [targets.yaml](stacks/config/targets.yaml).

#### Additional Notes

Expand Down
13 changes: 10 additions & 3 deletions .tools/test/stacks/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ def deploy_resources(account_id, account_name, dir, lang="typescript"):


def main():
parser = argparse.ArgumentParser(description="admin, images, or plugin flag.")
parser = argparse.ArgumentParser(description="admin, images, or plugin stack.")
parser.add_argument("type", choices=["admin", "images", "plugin"])
parser.add_argument("--language")
args = parser.parse_args()

accounts = None
Expand All @@ -122,11 +123,17 @@ def main():
accounts = yaml.safe_load(file)
except Exception as e:
print(f"Failed to read config data: \n{e}")

if accounts is None:
raise ValueError(f"Could not load accounts for stack {args.type}")

for account_name, account_info in accounts.items():
if args.language:
items = [(args.language, accounts[args.language])]
else:
items = accounts.items()

for account_name, account_info in items:

print(
f"Reading from account {account_name} with ID {account_info['account_id']}"
)
Expand Down

0 comments on commit cf73ec2

Please sign in to comment.