Skip to content

feat(component): Add deploy command for Greengrass components - #302

Open
bishwabikash wants to merge 4 commits into
aws-greengrass:mainfrom
bishwabikash:main
Open

feat(component): Add deploy command for Greengrass components#302
bishwabikash wants to merge 4 commits into
aws-greengrass:mainfrom
bishwabikash:main

Conversation

@bishwabikash

Copy link
Copy Markdown

Issue #, if available:
N/A - New feature implementation

Description of changes:
Implements the gdk component deploy command to deploy published Greengrass components to target IoT things or thing groups using the AWS Greengrass V2 CreateDeployment API.

Changes include:

  • DeployCommand class with deployment workflow (validate component exists, create deployment, handle errors)
  • ComponentDeployConfiguration for CLI argument and config file handling with target ARN validation
  • Extended Greengrassv2Client with create_deployment() and component_version_exists() methods
  • Updated cli_model.json with deploy subcommand (-t/--target-arn, -n/--deployment-name, -cv/--component-version)
  • Updated config_schema.json with deploy configuration section
  • Updated README with deploy command in quick start guide

Why is this change necessary:
Currently, after publishing a component with gdk component publish, users must manually use the AWS CLI or Console to create deployments. This change completes the development workflow by allowing users to deploy directly from GDK CLI.

How was this change tested:

  • Unit tests for DeployCommand, ComponentDeployConfiguration, and Greengrassv2Client (7 tests)
  • Property-based tests using Hypothesis framework (4 tests)
  • Integration tests for CLI argument parsing and dispatch (5 tests)
  • E2E tests with 5 scenarios in component_deploy.feature
  • All tests pass locally
  • Pre-commit hooks pass (flake8, trailing whitespace)

Any additional information or context required to review the change:

  • Used -cv for component-version short flag instead of -v to avoid conflict with global --version flag
  • Target ARN validation supports both thing and thinggroup resource types across all AWS partitions (aws, aws-cn, aws-us-gov)
  • Deployment policies are optional and passed through to the CreateDeployment API
  • Added deployment cleanup helper in t_utils.py for e2e test teardown

Checklist:

  • Updated the README if applicable
  • Updated or added new unit tests
  • Updated or added new integration tests
  • Updated or added new end-to-end tests
  • If your code makes a remote network call, it was tested with a proxy
  • You confirm that the change is backwards compatible

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Implement gdk component deploy command to deploy published Greengrass
components to target IoT things or thing groups using the AWS Greengrass
V2 CreateDeployment API.

- Add DeployCommand class with deployment workflow
- Add ComponentDeployConfiguration for CLI/config handling
- Extend Greengrassv2Client with create_deployment and component_version_exists
- Update cli_model.json with deploy subcommand and arguments
- Update config_schema.json with deploy configuration section
- Wire up command dispatch in component.py and methods.py
- Add unit tests, property-based tests, and integration tests
- Remove unused variable 'e' in DeployCommand exception handler
- Remove unused imports (pytest, Mock, patch, Greengrassv2Client)
- Fix trailing whitespace in property test files
- Add component_deploy.feature with 5 scenarios
- Add deploy config step in component.py
- Add DEFAULT_DEPLOY_TARGET_ARN constant
- Add deployment cleanup in t_utils.py
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