Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(toolkit): introduce the concept of auto-deployed Stacks #2046

Merged
merged 1 commit into from
Mar 20, 2019

Conversation

skinny85
Copy link
Contributor

@skinny85 skinny85 commented Mar 18, 2019

A Stack that is not auto-deployed is meant to be deployed outside the context of the cdk deploy command -
for example, in a CodePipeline.
These Stacks do not appear when running cdk synth or cdk deploy,
unless you explicitly filter for them.
This is useful when modeling things like Lambda in CodePipeline,
where the main deployment needs to happen in the Pipeline,
but you might want to test things locally before pushing it to the Pipeline.


Pull Request Checklist

  • Testing
    • Unit test added (prefer not to modify an existing test, otherwise, it's probably a breaking change)
    • CLI change?: coordinate update of integration tests with team
    • cdk-init template change?: coordinated update of integration tests with team
  • Docs
    • jsdocs: All public APIs documented
    • README: README and/or documentation topic updated
  • Title and Description
    • Change type: title prefixed with fix, feat will appear in changelog
    • Title: use lower-case and doesn't end with a period
    • Breaking?: last paragraph: "BREAKING CHANGE: <describe what changed + link for details>"
    • Issues: Indicate issues fixed via: "Fixes #xxx" or "Closes #xxx"
  • Sensitive Modules (requires 2 PR approvers)
    • IAM Policy Document (in @aws-cdk/aws-iam)
    • EC2 Security Groups and ACLs (in @aws-cdk/aws-ec2)
    • Grant APIs (only if not based on official documentation with a reference)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.

@skinny85 skinny85 requested review from rix0rrr and eladb March 18, 2019 23:12
@skinny85 skinny85 requested a review from a team as a code owner March 18, 2019 23:12
Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "ephemeral" does feel like the right terminology.
  • I don't see how we can remove them from cdk synth (you'll need the template even in the pipeline case).

Eventually, I'd say this is basically a flag that allows you to decide if this stack is directly deployed by the cdk deploy, so I'd just call this property deploy and have it default to true. Then print a little indication next to it in cdk ls and automatically filter it from cdk deploy (but allow to deploy it if it's explicitly specified).

@rix0rrr
Copy link
Contributor

rix0rrr commented Mar 19, 2019

How about calling it { autoDeploy: true|false } (@default true)?

The behaviour should be only to exclude from cdk deploy (no arguments); it can be directly selected or selected as a dependency from a stack that is directly selected.

Should we add an --autodeploy-only flag to cdk ls as well? Might be useful for some scripting...

@eladb
Copy link
Contributor

eladb commented Mar 19, 2019

I like “autoDeploy”

@skinny85
Copy link
Contributor Author

I don't see how we can remove them from cdk synth (you'll need the template even in the pipeline case).

Like I said in the description: these Stacks do not appear when you do cdk synth unless you explicitly filter for them. So, cdk synth will only show your main Stack (which is what you want, based on my experience working on Lambda), while in the Pipeline, you will say cdk synth MyLambdaStack -o ., and it generates the file you need for the CloudFormation Action.

Does this make sense?

@skinny85
Copy link
Contributor Author

Also, the name 'ephemeral' is sooo much cooler than 'autoDeploy' in my opinion... but I won't insist.

@rix0rrr
Copy link
Contributor

rix0rrr commented Mar 19, 2019

the name 'ephemeral' is sooo much cooler than 'autoDeploy'

Agreed :) but ephemeral also implies that it will go away after a while, and that is not true.

@rix0rrr
Copy link
Contributor

rix0rrr commented Mar 19, 2019

By the way I just piled on without reading the code, sorry!!

This completely does what I expected it to do, except for the name.

And the build error.

Copy link
Contributor

@rix0rrr rix0rrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provisory approval modulo rename :)

@skinny85
Copy link
Contributor Author

Changed the name from ephemeral to autoDeploy, and reversed the meaning (true -> false).

@skinny85 skinny85 changed the title feat(toolkit): introduce the concept of virtual/ephemeral Stacks feat(toolkit): introduce the concept of auto-deployed Stacks Mar 19, 2019
@@ -354,6 +354,7 @@ function renderLegacyStacks(artifacts: { [id: string]: cxapi.Artifact }, store:
environment: { name: artifact.environment.substr('aws://'.length), account: match[1], region: match[2] },
template,
metadata: artifact.metadata || {},
autoDeploy: artifact.autoDeploy,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should also rendered in the non-legacy artifact or we will lose this feature once we deprecate this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does the code for that live? That's the only place I could find this logic...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered by Elad offline... https://github.com/awslabs/aws-cdk/blob/master/packages/%40aws-cdk/cdk/lib/stack.ts#L472 .

The PR already includes a change in that method.

A Stack that is not auto-deployed is meant to be deployed outside the context of the `cdk deploy` command -
for example, in a CodePipeline.
These Stacks do not appear when running `cdk synth` or `cdk deploy`,
unless you explicitly filter for them.
This is useful when modeling things like Lambda in CodePipeline,
where the main deployment needs to happen in the Pipeline,
but you might want to test things locally before pushing it to the Pipeline.
@skinny85
Copy link
Contributor Author

Rebased to resolve some conflicts.

@skinny85 skinny85 merged commit abacc66 into aws:master Mar 20, 2019
@skinny85 skinny85 deleted the feature/virtual-stacks branch March 20, 2019 22:29
jogold pushed a commit to jogold/aws-cdk that referenced this pull request Mar 21, 2019
A Stack that is not auto-deployed is meant to be deployed outside the context of the `cdk deploy` command -
for example, in a CodePipeline.
These Stacks do not appear when running `cdk synth` or `cdk deploy`,
unless you explicitly filter for them.
This is useful when modeling things like Lambda in CodePipeline,
where the main deployment needs to happen in the Pipeline,
but you might want to test things locally before pushing it to the Pipeline.
@NGL321 NGL321 added the contribution/core This is a PR that came from AWS. label Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants