-
Notifications
You must be signed in to change notification settings - Fork 0
Add CLI Command to Check Deployment Prerequisites #1
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
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
74168e3
First commit
BenCodeOcean bf89674
Refactor project structure: rename to co-support, update requirements…
BenCodeOcean 46aa399
Add __init__.py to prerequisites module
BenCodeOcean 4952630
Add __init__.py files to checks and core modules
BenCodeOcean 1968a92
Update README.md: enhance installation instructions and usage examples
BenCodeOcean 09292fd
Rename run_checks to check_prerequisites for clarity and update refer…
BenCodeOcean 5da5458
short url
BenCodeOcean a33dd9d
syle fixes
BenCodeOcean 95a6c78
style fixes
BenCodeOcean c5e4e3f
role arn
BenCodeOcean 9d3def6
Improve clarity in vCPU and EIP quota checks by enhancing return mess…
BenCodeOcean 745021d
Update README and code to include role option and improve messaging f…
BenCodeOcean b262eab
Refactor argument parsing and enhance YAML handling; improve help mes…
BenCodeOcean b86ef3d
Enhance .gitignore for macOS, Linux, and Windows system files; improv…
BenCodeOcean 9330bdc
Update README and code to rename 'hosted-zone' to 'zone'; enhance rol…
BenCodeOcean 8cbf069
Copilot review
BenCodeOcean 9ebcb71
Zvika review part 1
BenCodeOcean edc7fda
Zvika review part 2
BenCodeOcean e2ba338
Compute Environments quota and more
BenCodeOcean c7606d0
comment added
BenCodeOcean 6284d51
Refactor environment handling and access checks for improved clarity …
BenCodeOcean 1ff663c
Zvika review part 3
BenCodeOcean 6f2bf1d
Refactor answer handling and question prompting for improved readabil…
BenCodeOcean 8e3430a
Fix typos in class names and instance descriptions for improved clarity
BenCodeOcean 589c789
Zvika review
BenCodeOcean 6f7051e
src folder
BenCodeOcean 2e71afe
Add project scripts section and correct ExistingVpcCheck name
BenCodeOcean 46c5b94
Refactor ask methods in Question and YesNoQuestion classes for improv…
BenCodeOcean cea73f8
support older python version
BenCodeOcean c2fb026
Update installation command to force reinstall package
BenCodeOcean 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,148 @@ | ||
# macOS system files | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear on external disks | ||
.Spotlight-V100 | ||
.Trashes | ||
|
||
# Linux system files | ||
*~ | ||
.nfs* | ||
|
||
# Windows system files | ||
Thumbs.db | ||
ehthumbs.db | ||
Desktop.ini | ||
$RECYCLE.BIN/ | ||
|
||
# Python bytecode | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyderworkspace | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# Hatchling build artifacts | ||
*.dist-info/ | ||
*.egg-info/ |
This file contains hidden or 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 |
---|---|---|
@@ -1,2 +1,63 @@ | ||
# co-assistant | ||
Code Ocean Command-Line Assistant | ||
# Code Ocean Support Command-Line | ||
|
||
## Installation | ||
|
||
### pip | ||
To install or upgrade the co-support, run the following command: | ||
```bash | ||
pip install --force-reinstall git+https://github.com/codeocean/co-support.git | ||
``` | ||
|
||
### virtualenv | ||
To install for development purposes using a virtual environment: | ||
```bash | ||
python3 -m venv .venv | ||
source .venv/bin/activate | ||
pip install -e . | ||
``` | ||
|
||
## Usage | ||
```bash | ||
usage: co-support check-prerequisites [-h] [-s | --silent | --no-silent] [-f {table,yaml}] [-o OUTPUT] [--version VERSION] [--role ROLE] [--domain DOMAIN] [--zone HOSTED_ZONE] [--cert CERT] | ||
[--private-ca | --no-private-ca] [--vpc VPC] [--internet-facing | --no-internet-facing] | ||
|
||
options: | ||
-h, --help show this help message and exit | ||
-s, --silent, --no-silent | ||
Run the script in silent mode (default: False) | ||
-f, --format {table,yaml} | ||
Output format: table or yaml (default: table) | ||
-o, --output OUTPUT Path to the directory where the output file will be saved (default: None) | ||
--version VERSION Version of Code Ocean to deploy (e.g., v3.4.1) (default: None) | ||
--role ROLE ARN of the IAM role to deploy the Code Ocean template (e.g., arn:aws:iam::account-id:role/role-name) (default: None) | ||
--domain DOMAIN Domain for the deployment (e.g., codeocean.company.com) (default: None) | ||
--zone HOSTED_ZONE | ||
Hosted zone ID for the deployment (e.g., Z3P5QSUBK4POTI) (default: None) | ||
--cert CERT ARN of the SSL/TLS certificate (e.g., arn:aws:acm:region:account:certificate/certificate-id) (default: None) | ||
--private-ca, --no-private-ca | ||
Indicate if the certificate is signed by a private CA (default: False) | ||
--vpc VPC ID of the existing VPC (e.g., vpc-0bb1c79de3fd22e7d) (default: None) | ||
--internet-facing, --no-internet-facing | ||
Indicate if the deployment is internet-facing (default: True) | ||
``` | ||
|
||
### Interactive Example | ||
```bash | ||
co-support check-prerequisites | ||
``` | ||
|
||
### Silent Example | ||
```bash | ||
co-support check-prerequisites -s \ | ||
--version v3.4.1 \ | ||
--internet-facing \ | ||
--domain codeocean.acmecorp.com \ | ||
--zone A0B1C2D3E4F5G6H7I8J9 \ | ||
--cert arn:aws:acm:us-east-1:000000000000:certificate/01234567-890a-bcde-f012-3456789000 \ | ||
--vpc vpc-0123456789abcdeff \ | ||
--role arn:aws:iam::000000000000:role/Administrator | ||
--private-ca \ | ||
``` | ||
|
||
## Notes | ||
Currently, this tool only checks prerequisites for Code Ocean deployment. |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "co-support" | ||
version = "0.1.0" | ||
authors = [ | ||
{ name="Code Ocean", email="dev@codeocean.com" }, | ||
] | ||
description = "A tool for managing prerequisites for Code Ocean deployment." | ||
readme = "README.md" | ||
requires-python = ">=3.8" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
] | ||
dependencies = [ | ||
"argparse", | ||
"boto3", | ||
"requests", | ||
"PyYAML", | ||
"prettytable", | ||
"colorama", | ||
"dnspython", | ||
] | ||
|
||
[project.scripts] | ||
co-support = "co_support.main:main" | ||
|
||
[project.optional-dependencies] | ||
dev = ["pytest", "flake8", "hatch"] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/codeocean/co-support" | ||
Issues = "https://github.com/codeocean/co-support/issues" | ||
Changelog = "https://github.com/codeocean/co-support/blob/main/CHANGELOG.md" | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["src/co_support"] | ||
|
||
[tool.hatch.envs.default.scripts] | ||
lint = "flake8 src tests" | ||
test = "pytest" | ||
|
||
[[tool.hatch.envs.test.matrix]] | ||
python = ["3.8", "3.9", "3.10", "3.11"] |
Empty file.
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from abc import ABC, abstractmethod | ||
from argparse import ArgumentDefaultsHelpFormatter | ||
|
||
|
||
class BaseCommand(ABC): | ||
""" | ||
Base class for commands. | ||
""" | ||
|
||
def __init__(self, subparsers, name, format_map=None): | ||
self.parser = subparsers.add_parser( | ||
name=name.format_map(format_map), | ||
help=self.__doc__.strip().format_map(format_map), | ||
formatter_class=ArgumentDefaultsHelpFormatter, | ||
) | ||
self.parser.set_defaults(cmd=self.cmd) | ||
|
||
@abstractmethod | ||
def cmd(self, args): | ||
pass |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
|
||
from co_support.prerequisites.cmd import commands as prerequisites_commands | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser() | ||
subparsers = parser.add_subparsers() | ||
prerequisites_commands(subparsers) | ||
|
||
return parser.parse_args(), parser | ||
|
||
|
||
def main(): | ||
args, parser = parse_args() | ||
if hasattr(args, 'cmd'): | ||
response = args.cmd(args) | ||
if response: | ||
print(response) | ||
else: | ||
parser.print_help() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Empty file.
Empty file.
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.
Uh oh!
There was an error while loading. Please reload this page.