Skip to content

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 30 commits into from
May 21, 2025

Conversation

BenCodeOcean
Copy link
Contributor

No description provided.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new CLI command to check deployment prerequisites for Code Ocean. It introduces a new package structure with multiple modules for prerequisite checks, integrates a CLI entry point via setup.py, and updates documentation with installation and usage examples.

  • Added a new command 'check-prerequisites' under co_support/prerequisites/.
  • Implemented various prerequisite check functions (access, network, quota, domain) and rendering logic.
  • Updated setup configuration and README with CLI usage instructions.

Reviewed Changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
setup.py Configures the package and registers the CLI entry point
co_support/prerequisites/main.py Registers and implements the 'check-prerequisites' command
co_support/prerequisites/core/* Implements question, render, prerequisite, and constants APIs
co_support/prerequisites/checks/* Implements AWS checks for quotas, network, domain, and access
co_support/main.py & co_support/cmd.py Integrates the CLI command into the overall command handler
README.md Provides updated installation and usage instructions
Files not reviewed (1)
  • co_support/requirements.txt: Language not supported

@BenCodeOcean BenCodeOcean requested a review from Copilot April 3, 2025 09:00
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new CLI command "check-prerequisites" to verify various deployment requirements for Code Ocean. Key changes include:

  • Introduction of a CLI command registered under co_support/prerequisites/main.py.
  • Implementation of multiple prerequisite checks (access, network, quota, domain) in dedicated modules.
  • Updates to setup.py, README.md, and command infrastructure to support the new CLI functionality.

Reviewed Changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
setup.py Defines package metadata and CLI entry point for co-support.
co_support/prerequisites/main.py Registers the new "check-prerequisites" CLI command.
co_support/prerequisites/core/render.py Adds functions to render output in YAML or table format.
co_support/prerequisites/core/questions.py Implements interactive and silent modes for collecting inputs.
co_support/prerequisites/core/prerequisite.py Defines the prerequisite check abstraction.
co_support/prerequisites/core/constants.py Provides shared constants and AWS session helpers.
co_support/prerequisites/core/checks.py Aggregates and executes all defined prerequisite checks.
co_support/prerequisites/checks/quota.py Checks vCPU and Elastic IP quotas.
co_support/prerequisites/checks/network.py Validates VPC configurations, subnets, and internet routing.
co_support/prerequisites/checks/domain.py Checks hosted zone configurations and certificate validity.
co_support/prerequisites/checks/access.py Checks service-linked roles and admin access policies.
co_support/main.py Bootstraps the CLI by wiring up the subcommand handlers.
co_support/cmd.py Provides a BaseCommand class for implementing CLI commands.
README.md Documents installation and usage of the new CLI command.
Files not reviewed (1)
  • co_support/requirements.txt: Language not supported

@BenCodeOcean BenCodeOcean requested a review from Copilot May 8, 2025 10:18
@BenCodeOcean BenCodeOcean requested a review from zvikagart May 8, 2025 10:19
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new CLI command for checking deployment prerequisites for Code Ocean, along with supporting checks and question prompts.

  • Introduces prerequisite checks (access, network, quota, domain) for deployment.
  • Implements interactive and silent modes with detailed command-line arguments.
  • Adds new modules and updates README, pyproject.toml, and main command entry points.

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pyproject.toml New project configuration and dependency declarations.
co_support/prerequisites/core/render.py New helper functions for output formatting (YAML, table).
co_support/prerequisites/core/questions.py Adds classes for interactive prompts with hierarchical questions.
co_support/prerequisites/core/prerequisite.py Defines the abstract base class for prerequisite checks.
co_support/prerequisites/core/environment.py Provides AWS environment details.
co_support/prerequisites/core/checks.py Orchestrates the execution of various prerequisite checks.
co_support/prerequisites/core/answers.py Collects and processes user responses from questions.
co_support/prerequisites/cmd.py Registers the new “check-prerequisites” CLI command.
co_support/prerequisites/checks/quota.py Implements vCPU and EIP quota checks with AWS service limits.
co_support/prerequisites/checks/network.py Validates VPC configuration including subnets and route tables.
co_support/prerequisites/checks/domain.py Validates hosted zones and SSL/TLS certificate configurations.
co_support/prerequisites/checks/access.py Implements checks for AWS service-linked roles and admin access.
co_support/main.py Entry point for the command-line tool.
co_support/cmd.py Defines the base command class used by the CLI.
README.md Documentation on installation and usage of the new CLI command.
Comments suppressed due to low confidence (2)

co_support/prerequisites/core/questions.py:5

  • [nitpick] The parameter name 'property' shadows the built-in 'property'. Consider renaming it (for example, to 'prop_name').
def __init__(self, text, property, args, type="str", comment=None):

co_support/prerequisites/core/questions.py:89

  • [nitpick] Using 'list' as a parameter name shadows the built-in 'list'. Consider renaming it to something like 'questions_list'.
def __init__(self, list: List[Question], args):

Comment on lines 38 to 40
quota.OnDemandGandVTInstancesQuotaCheck(
region=args.env.region,
),
Copy link
Preview

Copilot AI May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appear to be duplicate invocations of OnDemandGandVTInstancesQuotaCheck. Verify if both are needed or consider removing one to avoid redundant checks.

Suggested change
quota.OnDemandGandVTInstancesQuotaCheck(
region=args.env.region,
),

Copilot uses AI. Check for mistakes.

@BenCodeOcean BenCodeOcean requested a review from Copilot May 8, 2025 10:19
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new CLI command to check deployment prerequisites for Code Ocean, along with various prerequisite checks and rendering utilities.

  • Adds a new command and supporting functions to validate environment prerequisites.
  • Implements YAML and table output formats for prerequisite reports.
  • Introduces multiple prerequisite checks (access, network, quota, domain) and their corresponding unit setups.

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pyproject.toml Configured project build and dependency management settings.
co_support/prerequisites/core/render.py Added functions to render output as YAML or a formatted table.
co_support/prerequisites/core/questions.py Implemented interactive question logic for collecting user input.
co_support/prerequisites/core/prerequisite.py Defined base class for prerequisites with a common interface.
co_support/prerequisites/core/environment.py Created an environment helper to capture AWS session details.
co_support/prerequisites/core/checks.py Aggregated multiple prerequisite checks and output formatting.
co_support/prerequisites/core/answers.py Provided methods to collect and retrieve user answers.
co_support/prerequisites/cmd.py Registered the new 'check-prerequisites' CLI command.
co_support/prerequisites/checks/quota.py Added quota checks including vCPU and EIP validations.
co_support/prerequisites/checks/network.py Added network checks including VPC and DHCP options validations.
co_support/prerequisites/checks/domain.py Added checks for hosted zones and SSL/TLS certificate configuration.
co_support/prerequisites/checks/access.py Included access checks for IAM roles and shared AMIs.
co_support/main.py Set up CLI argument parsing and command execution entry point.
co_support/cmd.py Defined the base command class for CLI commands.
README.md Updated documentation for installation and usage of the new CLI command.
Comments suppressed due to low confidence (3)

co_support/prerequisites/core/questions.py:89

  • [nitpick] Avoid using 'list' as a parameter name to prevent shadowing the built-in type. Consider renaming it to 'question_list' or a similar descriptive name.
def __init__(self, list: List[Question], args):

co_support/prerequisites/checks/access.py:133

  • [nitpick] The class name 'SharedAimiCheck' appears to have a typo. Consider renaming it to 'SharedAmiCheck' to accurately reflect its intended purpose.
class SharedAimiCheck(Prerequisite):

co_support/prerequisites/core/checks.py:38

  • Duplicate check detected: OnDemandGandVTInstancesQuotaCheck is added twice. Consider removing one instance to avoid redundant checks.
quota.OnDemandGandVTInstancesQuotaCheck(

@BenCodeOcean BenCodeOcean merged commit 5f8c365 into main May 21, 2025
@BenCodeOcean BenCodeOcean deleted the prerequisites-script-sc-97879 branch May 21, 2025 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants