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 improved documentation. Key changes include updates to the CI workflow, new features for deployment and deletion commands, expanded documentation, and styling improvements for the documentation website.

Multi-Environment and External Configuration Features:

  • CI Workflow Update: Modified .github/workflows/ci.yml to run tests on all pull requests, ensuring broader coverage.
  • External Configuration Support: Added the ability to generate standalone SAM configuration files for multi-environment workflows, including template path resolution and validation. [1] [2]
  • Multi-Environment Deployment and Deletion: Enhanced CLI commands (deploy and delete) to support environment-specific operations using --input parameters. [1] [2] [3]

Documentation Enhancements:

  • Comprehensive External Config Documentation: Added detailed guides and examples for external configuration usage, including benefits and GitOps workflows. [1] [2]
  • CLI Reference Updates: Improved organization and added new sections for multi-environment support in docs/content/docs/cli/. [1] [2] [3]
  • Documentation Restructure: Adjusted navigation weights and cross-references for better discoverability. [1] [2] [3]

Styling Improvements:

  • CSS Updates: Enhanced table styling for better readability and presentation in the documentation website.
  • Hero Section Enhancements: Improved font weight and layout for key sections.

These changes collectively improve the usability, functionality, and accessibility of the samstacks project, making it better suited for modern multi-environment workflows and GitOps practices.

…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
- 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
- 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
- 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.
@alessandrobologna alessandrobologna requested a review from Copilot July 2, 2025 05:25

This comment was marked as outdated.

- 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.
- 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
@alessandrobologna alessandrobologna requested a review from Copilot July 2, 2025 05:33
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 multi-environment support and external SAM configuration generation, updates CLI commands, and overhauls documentation and examples to showcase the new features.

  • Introduce a config field in StackModel with validation and support for external SAM config files.
  • Extend deployment and deletion logic in core.py to generate/use external configs via --config-file.
  • Revamp documentation (Hugo site, examples, README) with detailed guides, CSS styling, and navigation updates.

Reviewed Changes

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

Show a summary per file
File Description
samstacks/pipeline_models.py Add config field with validator to Pydantic model
samstacks/core.py Handle config_path, validate and process external configs
samstacks/samconfig_manager.py Implement generate_external_config_file and template refs
samstacks/cli.py Add --input support to delete command and context guard
tests/test_pipeline_models.py Add tests for config path handling and validation
tests/test_core.py Add tests for external config resolution in deletion logic
docs/hugo.yaml Update menu order and parser settings
docs/content/docs/** Add external-configs page, update weights and references
examples/multi-pipeline.yml New multi-environment example using external configs
README.md, CHANGELOG.md Document external config feature and bump version
.github/workflows/ci.yml Run tests on all PRs and build to generate version.py
Comments suppressed due to low confidence (2)

docs/hugo.yaml:7

  • [nitpick] You removed the hugo-admonitions import but the docs still use admonition syntax (> [!NOTE]). Either re-add the hugo-admonitions module import or remove/replace those blocks to avoid rendering errors.
    - path: github.com/imfing/hextra

docs/content/docs/manifest-reference.md:67

  • [nitpick] The table styling class {.pretty-table-3} is on its own line rather than applied to the table element. Move this attribute to the table's opening tag or use a Hugo shortcode so the custom CSS is actually applied.
{.pretty-table-3}

@alessandrobologna alessandrobologna merged commit c9e5fdb into main Jul 2, 2025
2 checks passed
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