Skip to content

feat(lib): Initial Asset Pipeline implementation#339

Open
eduardomourar wants to merge 4 commits into
open-constructs:mainfrom
eduardomourar:feat/basic-asset-pipeline
Open

feat(lib): Initial Asset Pipeline implementation#339
eduardomourar wants to merge 4 commits into
open-constructs:mainfrom
eduardomourar:feat/basic-asset-pipeline

Conversation

@eduardomourar

@eduardomourar eduardomourar commented Jul 19, 2026

Copy link
Copy Markdown

Related issue

Fully Resolves:

Partially Addresses:

Description

Implements a simplified asset staging and bundling pipeline for CDKTN, following patterns from AWS CDK and TerraConstructs while avoiding unnecessary dependencies.

✅ Implemented Features

Core Asset Staging
  • AssetStaging construct for staging files and directories
  • Hash calculation with multiple strategies:
    • SOURCE - based on source content (default)
    • OUTPUT - based on bundled output
    • CUSTOM - user-provided hash
  • Archive detection for .zip, .tar, .tar.gz, .tgz files
  • Asset caching - reuse staged assets with identical content
  • Exclusion patterns - filter files during staging
  • Extra hash - cache busting mechanism
Docker Bundling
  • Local bundling with Docker fallback via ILocalBundling interface
  • Docker command construction with support for:
    • Custom images, commands, and entrypoints
    • Environment variables, user, network, platform
    • Security options and working directory
  • Bundling output types:
    • ARCHIVED - single archive file
    • NOT_ARCHIVED - directory of files
    • SINGLE_FILE - single non-archive file
    • AUTO_DISCOVER - automatic detection
Test Coverage
  • 87 asset-related tests (+50% coverage increase)
  • Comprehensive patterns from AWS CDK tests
  • Unit tests for Docker command construction
  • Integration tests for end-to-end workflows
  • Edge cases: empty dirs, special chars, symlinks, binary files

⏸️ Intentionally Deferred

To maintain simplicity and avoid new dependencies.

Not Implemented from AWS CDK/TerraConstructs:
  • esbuild bundling - would require esbuild dependency
  • Advanced Docker features - volume copy variant, advanced mount modes
  • Asset synthesis integration - cloud assembly manifest, stack metadata
  • Asset publishing - S3 upload, publishing manifest
  • Advanced caching - disk-based cache, complex invalidation

Rationale: These features add significant complexity and external dependencies that aren't needed for the initial use case. The current implementation provides all core functionality (staging, hashing, bundling) with extensible interfaces for future enhancements.

Checklist

  • I have updated the PR title to match CDKTN's style guide
  • I have run the linter on my code locally
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if applicable
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works if applicable
  • New and existing unit tests pass locally with my changes

@eduardomourar
eduardomourar requested a review from a team as a code owner July 19, 2026 03:15
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.

TerraformAsset: add bundling feature Allow to ignore files from TerraformAsset Helper for using local files

1 participant