Skip to content

Conversation

@alessandrobologna
Copy link
Member

This pull request introduces significant enhancements to the samstacks project, focusing on multi-environment support, external configuration generation, and comprehensive documentation updates. It also includes improvements to the project's CSS styling and documentation structure for better usability. Below is a summary of the most important changes grouped by theme.

Multi-Environment and External Configuration Support

  • External Configuration Generation: Added support for generating standalone SAM configuration files, enabling GitOps workflows and direct SAM CLI usage. This includes template substitution, directory validation, and dual-mode deployment for local and external configurations. (CHANGELOG.md, README.md) [1] [2]
  • Multi-Environment Deployment and Deletion: Enhanced deploy and delete commands with --input parameters for environment-specific operations, ensuring feature parity between the two commands. (CHANGELOG.md, README.md) [1] [2]

Documentation Enhancements

  • Comprehensive Documentation Updates: Added new pages for external configuration, CLI reference, and examples. Improved navigation, formatting, and integration between code examples and documentation. (docs/content/docs/_index.md, docs/content/docs/cli/_index.md, docs/content/docs/examples.md) [1] [2] [3]
  • Updated Examples: Expanded example projects to include multi-environment pipelines and external configuration usage patterns. (README.md, docs/content/docs/examples.md) [1] [2]

CSS and Styling Improvements

  • Improved Table Styling: Added new CSS classes for better table readability and presentation in the documentation. (docs/assets/css/custom.css)
  • Enhanced Hero Section Styling: Updated font weights and other visual elements for the hero section in the documentation site. (docs/assets/css/custom.css)

Development and Testing

  • Expanded Test Coverage: Comprehensive test suite updates to cover external configuration generation, validation, and multi-environment workflows. (CHANGELOG.md)

Migration and Compatibility

  • Migration Guide: Added a detailed guide for adopting the new external configuration feature, ensuring backward compatibility with existing manifests. (CHANGELOG.md)

…ion Enhancement

Major Features Added:
- External configuration field (config:) in stack definitions with template support
- Foundation for multi-environment deployments without pipeline duplication
- Comprehensive documentation website enhancements with external config guide

Documentation Improvements:
- New external-configs.md with examples and best practices
- Enhanced manifest reference with improved formatting
- Updated examples with multi-environment patterns
- Fixed admonition syntax and improved table styling

Infrastructure Updates:
- Pydantic model updates with config path validation
- Stack runtime instantiation with config path resolution
- Expanded test suite (295 tests passing)
- Path validation with system directory protection

New Examples:
- Multi-pipeline example demonstrating external config usage
- Environment-specific configuration structure in examples/configs/
- Dev/prod configuration examples

Backward Compatibility:
- All existing manifests continue to work unchanged
- New config field is optional
- No breaking changes to existing functionality

Development Notes:
- Phase 1 of external config feature complete
- Template processing foundation laid
- Integration tests for config path resolution
- Ready for Phase 2 implementation
- Add --input parameter support to delete command for consistency with deploy
- Implement external config path resolution for deletion operations
- Update delete logic to use appropriate config files (external vs local)
- Add comprehensive documentation for multi-environment deletion
- Enhance CLI reference and README with delete examples
- Fix linting and type annotation issues
- All CI/CD quality checks passing

This completes the external config feature parity between deploy and delete commands,
enabling full multi-environment lifecycle management.
- Document completion of external configuration feature implementation
- Add multi-environment delete command support details
- Update migration guide with delete examples and CLI usage
- Reflect full feature parity between deploy and delete commands
- Update development notes to show feature completion status
@alessandrobologna alessandrobologna requested a review from Copilot July 2, 2025 04:17

This comment was marked as outdated.

- Fix example filenames from .yaml to /samconfig.yaml for consistency
- Extract helper method _resolve_external_config_path to reduce code duplication
- Add comprehensive tests for external config deletion functionality
- Fix test assertions to handle absolute vs relative path resolution
- Improve error handling and code organization
- All 301 tests passing with 56% coverage

Addresses feedback from GitHub Copilot review on PR #17:
- Filename consistency in multi-pipeline.yml examples
- Code duplication in delete stack logic
- Missing test coverage for delete command external config support
- Improved code maintainability and test reliability
@alessandrobologna alessandrobologna requested a review from Copilot July 2, 2025 04:53
Copy link
Contributor

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 full multi-environment support via external SAM config file generation, enhances the delete CLI for environment inputs, and updates documentation, examples, and CSS styling for the new feature.

  • Introduced a config field in StackModel with validation and normalization for external SAM config paths
  • Implemented external config generation and resolution in SamConfigManager and the deploy/delete workflows
  • Extended tests to cover external config behaviors and updated CLI delete command to accept --input parameters

Reviewed Changes

Copilot reviewed 32 out of 33 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_pipeline_models.py Added tests for new config field and path validation rules
tests/test_core.py Added tests for external config resolution and deletion workflows
samstacks/pipeline_models.py Added config field and pre-validator for external config paths
samstacks/samconfig_manager.py Implemented generate_external_config_file and template references
samstacks/core.py Integrated external config path resolution in deploy/delete flows
samstacks/cli.py Enhanced delete command with --input parsing for multi-env use
docs/ & examples/ Expanded documentation and examples to illustrate external configs
pyproject.toml, README.md Bumped version to 0.8.0 and updated feature overview
Comments suppressed due to low confidence (2)

samstacks/cli.py:1

  • The deploy command does not accept the new --input (-i) option for multi-environment support; add a matching click.option and parsing logic as in delete so samstacks deploy ... --input env=prod works.
"""

samstacks/core.py:1230

  • [nitpick] The _run_sam_build_with_external_config method returns a tuple that isn’t used by callers. Consider removing the return statement to make its signature consistent with other _run_sam_* methods and avoid confusion.
            return_code, stderr_output = _run_command_with_stderr_capture(

@alessandrobologna alessandrobologna merged commit ef2b0c6 into main Jul 2, 2025
2 checks passed
alessandrobologna added a commit that referenced this pull request Jul 2, 2025
alessandrobologna added a commit that referenced this pull request Jul 2, 2025
alessandrobologna added a commit that referenced this pull request Jul 2, 2025
* Release v0.8.0: External Config Feature Infrastructure and Documentation Enhancement

Major Features Added:
- External configuration field (config:) in stack definitions with template support
- Foundation for multi-environment deployments without pipeline duplication
- Comprehensive documentation website enhancements with external config guide

Documentation Improvements:
- New external-configs.md with examples and best practices
- Enhanced manifest reference with improved formatting
- Updated examples with multi-environment patterns
- Fixed admonition syntax and improved table styling

Infrastructure Updates:
- Pydantic model updates with config path validation
- Stack runtime instantiation with config path resolution
- Expanded test suite (295 tests passing)
- Path validation with system directory protection

New Examples:
- Multi-pipeline example demonstrating external config usage
- Environment-specific configuration structure in examples/configs/
- Dev/prod configuration examples

Backward Compatibility:
- All existing manifests continue to work unchanged
- New config field is optional
- No breaking changes to existing functionality

Development Notes:
- Phase 1 of external config feature complete
- Template processing foundation laid
- Integration tests for config path resolution
- Ready for Phase 2 implementation

* feat: Add multi-environment delete command support

- Add --input parameter support to delete command for consistency with deploy
- Implement external config path resolution for deletion operations
- Update delete logic to use appropriate config files (external vs local)
- Add comprehensive documentation for multi-environment deletion
- Enhance CLI reference and README with delete examples
- Fix linting and type annotation issues
- All CI/CD quality checks passing

This completes the external config feature parity between deploy and delete commands,
enabling full multi-environment lifecycle management.

* docs: Update CHANGELOG.md for complete external config feature

- Document completion of external configuration feature implementation
- Add multi-environment delete command support details
- Update migration guide with delete examples and CLI usage
- Reflect full feature parity between deploy and delete commands
- Update development notes to show feature completion status

* fix: Address Copilot PR feedback and improve code quality

- Fix example filenames from .yaml to /samconfig.yaml for consistency
- Extract helper method _resolve_external_config_path to reduce code duplication
- Add comprehensive tests for external config deletion functionality
- Fix test assertions to handle absolute vs relative path resolution
- Improve error handling and code organization
- All 301 tests passing with 56% coverage

Addresses feedback from GitHub Copilot review on PR #17:
- Filename consistency in multi-pipeline.yml examples
- Code duplication in delete stack logic
- Missing test coverage for delete command external config support
- Improved code maintainability and test reliability

* fix(ci): run tests automatically on all PRs

- Remove requirement for 'approved' label to trigger tests
- Tests now run on all PR events (open, sync, reopen)
- Maintains security by keeping publish job restricted to main branch
- Enables immediate feedback on code quality and test results

* fix(build): ensure Hatchling generates properly formatted version.py

- Add custom template to Hatchling version hook configuration
- Use double quotes instead of single quotes for string literals
- Prevents CI formatting failures when version.py is auto-generated
- Resolves the root cause of previous CI failures in publish workflow

The issue was that Hatchling's default template generates:
__version__ = VERSION = '0.8.0'  # single quotes

But ruff formatter expects:
__version__ = VERSION = "0.8.0"  # double quotes

This fix ensures CI quality checks pass consistently.

* improve(ci): add build step to generate version.py before quality checks

- Add 'Build package to generate version.py' step before quality checks
- Ensures CI tests against the exact same code that will be published
- Catches build-time code generation issues in PRs, not just during publishing
- Provides visibility into generated version.py content for debugging
- Follows principle: 'test what you ship, ship what you test'

This prevents scenarios where:
- Local development has stale/missing version.py (git-ignored)
- CI quality checks pass but publishing fails due to generated code issues
- Build system changes affect code formatting without being caught early

The build step generates the production version.py file, then quality
checks run against the complete, production-ready codebase.

* fix: address Copilot PR feedback on error handling and safety

- Add consistent error handling for fallback deletion command execution
- Make CLI ctx.obj access safer with null checks across all commands
- Wrap _run_command_with_stderr_capture in try/except for fallback deletion
- Ensures consistent error handling between external config and local config deletion paths

Addresses feedback from GitHub Copilot review on PR #19:
- samstacks/core.py: Inconsistent error handling in fallback deletion branch
- samstacks/cli.py: Potential ctx.obj access failure without null check
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