Skip to content

Add module/stack targeting and changeset support for CI/CD workflows#2930

Open
neelaruban wants to merge 7 commits intorackspace:masterfrom
neelaruban:feature/module-stack-targeting
Open

Add module/stack targeting and changeset support for CI/CD workflows#2930
neelaruban wants to merge 7 commits intorackspace:masterfrom
neelaruban:feature/module-stack-targeting

Conversation

@neelaruban
Copy link
Copy Markdown

@neelaruban neelaruban commented Mar 10, 2026

New CLI options for granular targeting:

  • --module: Select modules by name or glob pattern (e.g., 'network-*')
  • --stack: Select specific CFNgin stacks within targeted modules

CloudFormation changeset support for CI/CD pipelines:

  • runway plan --create-changeset: Retain changesets for later execution
  • runway plan --output json: Machine-readable changeset output
  • runway deploy --execute-changesets : Execute pre-created changesets

New 'runway variables' command:

  • Show resolved variables for deployments and modules
  • Supports YAML, JSON, and table output formats
  • Resolves all lookups (${var}, ${env}, ${ssm}, etc.)

Context updates:

  • Added stack_names, create_changeset, changeset_results to contexts
  • Propagate targeting options from CLI through to CFNgin

Includes integration tests for all new options.

Summary

This PR adds granular targeting capabilities for Runway CLI commands and introduces CloudFormation changeset support for CI/CD workflows. Users can now target specific modules by name/pattern and
specific CFNgin stacks, enabling more precise deployments. Additionally, a new runway variables command helps debug variable resolution issues.

Why This Is Needed

  1. Granular Deployments: In large mono-repos with many modules, users often need to deploy only specific modules or stacks without modifying config files or using tags. The --module and --stack
    options provide this flexibility.
  2. CI/CD Pipeline Support: CloudFormation changesets created during runway plan were being deleted immediately. For CI/CD pipelines that require a "plan → approve → apply" workflow, changesets need
    to be retained and executed in separate stages.
  3. Debugging Variable Resolution: When lookups (${var}, ${ssm}, ${env}) fail or resolve unexpectedly, there was no easy way to see the final resolved values. The variables command addresses this.

What Changed

  • --module option for deploy, destroy, init, and plan commands
    • Select modules by exact name or glob pattern (e.g., --module "network-*")
    • Supports multiple values (e.g., --module vpc --module rds)
    • --stack option for targeting specific CFNgin stacks within modules
    • --create-changeset flag for runway plan to retain changesets
    • --output json|text option for machine-readable changeset output
    • --execute-changesets option for runway deploy to execute pre-created changesets
    • New runway variables command with YAML, JSON, and table output formats
    • New modules:
      • runway/_cli/changeset_executor.py - Executes retained changesets
      • runway/_cli/changeset_output.py - Formats changeset output for CI/CD
      • runway/_cli/commands/_variables.py - Variables inspection command
    • Integration tests for all new CLI options

Added

Changed

  • RunwayContext and CfnginContext now track:
    • stack_names - List of targeted stack names
    • create_changeset - Whether to retain changesets
    • changeset_results - Mapping of stack FQN to changeset ID
    • select_deployments() now accepts module_names parameter for filtering
    • Provider.get_stack_changes() accepts retain_changeset parameter
    • CFNgin.plan() returns changeset mapping and propagates to RunwayContext
    • Updated CLI help text to document new --module and --tag options

Fixed

Removed

Screenshots

Checklist

  • Have you followed the guidelines in our Contribution Requirements?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Does your submission pass tests?
  • Have you linted your code locally prior to submission?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?
  • Have you updated documentation, as applicable?

New CLI options for granular targeting:
- --module: Select modules by name or glob pattern (e.g., 'network-*')
- --stack: Select specific CFNgin stacks within targeted modules

CloudFormation changeset support for CI/CD pipelines:
- runway plan --create-changeset: Retain changesets for later execution
- runway plan --output json: Machine-readable changeset output
- runway deploy --execute-changesets <file>: Execute pre-created changesets

New 'runway variables' command:
- Show resolved variables for deployments and modules
- Supports YAML, JSON, and table output formats
- Resolves all lookups (${var}, ${env}, ${ssm}, etc.)

Context updates:
- Added stack_names, create_changeset, changeset_results to contexts
- Propagate targeting options from CLI through to CFNgin

Includes integration tests for all new options.
@github-actions github-actions Bot added the feature Request or pull request for a new feature label Mar 10, 2026
@neelaruban neelaruban force-pushed the feature/module-stack-targeting branch from 34aa081 to f728030 Compare March 10, 2026 02:50
@neelaruban
Copy link
Copy Markdown
Author

@mbordash2 @jon-the-dev Could someone look into this please :)

@mbordash2
Copy link
Copy Markdown
Contributor

@ITProKyle

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 6, 2026

Codecov Report

❌ Patch coverage is 64.46991% with 124 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.84%. Comparing base (9642067) to head (3bc13a7).

Files with missing lines Patch % Lines
runway/_cli/changeset_executor.py 19.14% 76 Missing ⚠️
runway/_cli/commands/_variables.py 79.66% 24 Missing ⚠️
runway/_cli/changeset_output.py 25.00% 18 Missing ⚠️
runway/cfngin/actions/diff.py 0.00% 2 Missing ⚠️
runway/cfngin/providers/aws/default.py 80.00% 2 Missing ⚠️
runway/_cli/commands/_deploy.py 93.75% 1 Missing ⚠️
runway/cfngin/utils.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2930      +/-   ##
==========================================
- Coverage   90.42%   89.84%   -0.59%     
==========================================
  Files         231      234       +3     
  Lines       14939    15267     +328     
==========================================
+ Hits        13509    13716     +207     
- Misses       1430     1551     +121     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mbordash2
Copy link
Copy Markdown
Contributor

@neelaruban can you please take a look at the linting and test coverage notices? Thanks!

@neelaruban
Copy link
Copy Markdown
Author

@neelaruban can you please take a look at the linting and test coverage notices? Thanks!

@mbordash2 i have done those changes now it looks good :)

@neelaruban
Copy link
Copy Markdown
Author

@mbordash2 I have fixed the Linting issues , now it looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Request or pull request for a new feature

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants