app-delivery expects yaml output, but cdk synth only outputs json
See original GitHub issueI’d like to report a simple bug in the app-delivery module. I’m trying to use the app-deploy module to build and self-deploy a CDK app, just like in the documentation. The problem is that the app-deploy model expects the built CFN to be in yaml format (see https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/app-delivery/lib/pipeline-deploy-stack-action.ts#L123), but running node_modules/.bin/cdk synth -o dist
will only produce json output, no matter what options you supply.
The only way I’ve been able work around the problem is to do a dodgey content redirect in the buildspec.yml
file
# When redirecting, the directory must exist before the command is run.
# TODO remove when cdk bug is resolved.
- mkdir -p dist
# There is a bug in CDK whereby the cdk command generates json when using the
# -o option, but the app-deploy target expects yaml. To work around this, we
# do silly buggers with redirection of the stdout, which is yaml.
- node_modules/.bin/cdk synth -o dist > dist/CodepipelineMetaStack.template.yaml
Whilst this makes it work, it isn’t very elegant and its prone to output changes in the cdk executable. Its trivial to fix, so I thought I’d raise this issue.
This is related to https://github.com/aws/aws-cdk/issues/2965 in that fixing that one would allow me to create a yaml file as part of a call to cdk synth
. You could either fix that bug, or change the linked file to expect json instead…
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
As a short term fix, I added this to my buildspec:
- find dist/ -name '*.template.json' -exec rename 's/\.json$/.yaml/' \{} \;
Got it. Confirming this is a bug in the app-delivery library.