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

[WIP] fix(core): self contained CDK_OUTDIR #1895

Closed
wants to merge 37 commits into from

Conversation

eladb
Copy link
Contributor

@eladb eladb commented Feb 26, 2019

This change copies all assets referenced in CDK code to the CDK_OUTDIR as artifacts (see #1893) so that the output directory is now self-contained. This is part of the design for generalizing artifacts #1893.

It also modifies the path metadata (both aws:asset:path and cdk:asset:path) to use relative paths instead of absolute paths, which is a breaking change in respect to the toolkit.

Fixes #1716

BREAKING CHANGE: Users will need to upgrade their toolkit to v0.25.0 or above if their CDK applications use assets. Otherwise the toolkit will likely not find asset files during deployment.


Remaining work:

  • Add relative path support in toolkit, so that if an asset path begins with "." it will be treated as relative to CDK_OUTDIR.
  • Make CDK_OUTDIR a persistent directory (emitted under the project directory or something). Otherwise, tools that wish to access assets won't be able to find them because the temporary directory will disappear.

Elad Ben-Israel and others added 30 commits February 20, 2019 13:21
This change enables each construct in the tree to participate in synthesis
by overriding the "synthesize" method and emitting files to the session directory.

It is a small step towards generalizing how synthesis artifacts are being
produced, built and deployed by the CDK.

This change moves the code that synthesizes a CloudFormation template from a 
CDK stack to the `Stack` class and emits a `.template.json` file for each
stack.

The CLI hasn't been changed to work with these new files yet, so the output
of this file is ALSO included in the main manifest (defined `cxapi.OUTFILE_NAME`),
which is the only file currently being read by the CLI.
This test is referred as example in the
[Cloudformation README](https://github.com/awslabs/aws-cdk/blob/master/packages/%40aws-cdk/aws-cloudformation/README.md).
But the example doesn't do what it intended.
Without specifying the runOrder the `pipelineExecuteChangeSetAction` will be triggered immediately without change set being populated,
which will lead to deployment failure.
After adding the `runOrder` the 3 actions will run in order and only be deployed after manual approval.
…n Project sources. (#1798)

Also fixed the weird casing of the 'GitHubEnterPrise' SourceType enum value while I was in the area.

Fixes #1789
When running in CI, try to pull the latest image first and use it as cache
for the build. CI is detected by the presence of the `CI` environment variable.

Closes #1748
Adds a handler to enable raw message delivery on SNS topic subscriptions.
Forgot to modify the signatures on the interface when I updated the base
class. This is now fixed.
Changed "documentation" to "reference documentation" in description.
If we report synthesis errors, they should only prevent the
affected stack from deploying; right now, since they are checked
during the synthesis step, they would abort the entire toolkit
run regardless of whether they would be selected or not.

Makes it possible to do region-dependent verification.

Fixes #1784.

ALSO IN THIS COMMIT

If the 'cdk synth' output goes to the screen, don't automatically
select upstream stacks for synthesis (as that would lead to an
immediate error).

Fixes #1783.
Fix usage of application and network target groups in languages
without structural typing, such as Java and C#.

Fixes #1799.
`SecretParameter` was being used incorrectly and it did not pass typechecking.

The type error was:

```
Type 'SecretParameter' is missing the following properties from type 'Secret': resolve, toJSON, toList
```
…tchLogs (#1851)

Sets `this.cloudWatchLogsGroupArn` before using it, such that a correct
resource ARN is used in the policy generated for CloudTrail to be able
to create and use the required log stream.

Fixes #1848
@eladb eladb requested a review from a team February 26, 2019 17:23
@eladb eladb marked this pull request as ready for review February 26, 2019 17:23
@eladb eladb changed the title fix(core): self contained CDK_OUTDIR [WIP] fix(core): self contained CDK_OUTDIR Feb 26, 2019
? this.artifactName
: path.join(this.artifactName, path.basename(props.path));

this.relativePath = `./${this.relativePath}`; // prefix with './'
Copy link
Contributor

Choose a reason for hiding this comment

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

Why prefix with ./? By traditional filesystem convention, any path that doesn't start with / is already relative.

If you're thinking about NodeJS, they reason they do it is because they also want to support a global registry of packages, and they want to disambiguate:

require('bla');   // Is this a global 'bla' or a local 'bla.js'?

I don't think we need that feature, and even if we did we could get it by prepending a special namespace like builtin:bla.

@eladb eladb closed this Mar 11, 2019
@eladb eladb deleted the benisrae/copy-assets branch June 23, 2019 20:44
@NGL321 NGL321 added the contribution/core This is a PR that came from AWS. label Sep 23, 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.