-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use cdk-cli-lib to synthesize CDK application #170
Conversation
/** @internal */ | ||
registerOutput(outputId: string, output: any) { | ||
this.stack.outputs[outputId] = pulumi.output(output); | ||
async produce(context: Record<string, any>): Promise<string> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what will get executed multiple times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like piece-de-resistane in this PR. So it's calling app.synth() and returning dir.
So couple of low-level questions here perhaps.
- if this method fails, are we OK? do we expect it to fail or we don't expect it to regularly fail?
- if app.synth() creates temp dirs with assets, what cleans it up? is it something to worry about?
- the state of this is modified
this.assemblyDir = dir
andthis.stacks[child.artifactId] = child
- do we need to worry about something concurrently accessing the partial state before the framework is done calling us repeatedly or it all works out as needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this method fails, are we OK? do we expect it to fail or we don't expect it to regularly fail?
This is called when we call cli.synth()
as part of initialize
and we do catch errors there.
if app.synth() creates temp dirs with assets, what cleans it up? is it something to worry about?
Maybe? It will create it as a system tmp dir which gets cleaned up whenever the computer restarts.
the state of this is modified this.assemblyDir = dir and this.stacks[child.artifactId] = child - do we need to worry about something concurrently accessing the partial state before the framework is done calling us repeatedly or it all works out as needed?
We shouldn't need to worry about it. This is called in blocking code as part of initialize.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System temp dir should be fine, yes. All good then.
*/ | ||
outputs: { [outputId: string]: pulumi.Output<any> } = {}; | ||
public static isPulumiStack(x: any): x is Stack { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instanceOf
doesn't work for constructs...
examples/ecscluster/index.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test didn't really test anything. It appears to test lookups, but it doesn't actually.
189a0e0
to
f84d8be
Compare
38076ae
to
7289835
Compare
@@ -44,8 +44,8 @@ jobs: | |||
test: | |||
name: acceptance-test | |||
concurrency: | |||
group: acceptance-test-${{ matrix.index }} # TODO: concurrent tests across PRs can cause problems | |||
cancel-in-progress: false | |||
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.index }} # TODO: concurrent tests across PRs can cause problems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we've fixed the concurrency issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied most of the doc here so it can live in the repo.
bfa47d5
to
42df90a
Compare
Quick question on the API. new pulumicdk.App('app', (scope: pulumicdk.App) => {
const stack = new pulumicdk.Stack(scope, 'stack');
const bucket = new s3.Bucket(this, 'Bucket');
}); What is Will users always create exactly one stack as the first thing in the callback? Or it is possible to have more than one or not have one? Ah "Will enable multiple stacks" - got this. This is by design. |
@@ -1,12 +1,22 @@ | |||
# Pulumi CDK Adapter (preview) | |||
|
|||
The Pulumi CDK Adapter is a library that enables [Pulumi](https://github.com/pulumi/pulumi) programs to use [AWS CDK](https://github.com/aws/aws-cdk) constructs. | |||
The Pulumi CDK Adapter is a library that enables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change necessary? Looks like Emacs fil-paragraph got applied. I think we prefer to have the previous form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, I kind of prefer the 80 line length limit. It makes looking/editing so much easier. It's also the default in most markdown linters, (e.g. markdownlint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AH nice, one of those things that'd just nice to have a standard. We can adopt it in the project. I'll setup column width 80 in Emacs.
@@ -81,99 +94,111 @@ Try the workshop at https://apprunnerworkshop.com | |||
Read the docs at https://docs.aws.amazon.com/apprunner | |||
``` | |||
|
|||
## Getting Started | |||
|
|||
### Bootstrapping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now auto-bootstrap? Perhaps still worth a mention that it does this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some docs around bootstrapping and what resources we create for you.
This is actually a mistake on my part so good catch! This should say |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good at a glance. Sorry for a rather shallow review, I need to get better at this codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This PR has been shipped in release v1.0.0. |
This PR introduces a breaking change to the API changes the entrypoint of the application from the
Stack
construct to theApp
component.Previous API
New API
This will allow for a couple of benefits
pulumicdk.Stack
and call the protectedsynth
method.For a more detailed breakdown on why we are making this change, i've included and ADR based on the internal doc.
closes #153