-
Notifications
You must be signed in to change notification settings - Fork 23
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
fix: Add YAML document separator to each manifest #1928
Conversation
fe7bf39
to
13a9d61
Compare
When output to STDOUT is requested, each manifest in an app is rendered separately and dumped to standard output. In case an app contains more than one chart, a document separator will be missing between adjacent charts, since there is no YAML document separator either at the beginning or at the end of an individual output. The last resource of the preceding chart and the first resource of the following chart will be merged into a random mess. By adding a YAML document separator after each manifest unconditionally, this can be cleanly avoided. Fixes: #943 Signed-off-by: Nikolai Prokoschenko <[email protected]>
13a9d61
to
5536128
Compare
@@ -94,6 +94,7 @@ class Command implements yargs.CommandModule { | |||
const app = await synthApp(command, tempDir, stdout, recordConstructMetadata); | |||
for (const f of app.manifests) { | |||
fs.createReadStream(f).pipe(process.stdout); | |||
process.stdout.write('---\n'); |
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 won't work as expected because the line just above it as asynchronous. It will print this before the manifests are printed. To do this we first need to await on the created pipeline:
import { pipeline } from 'stream';
import { promisify } from 'util';
const asyncPipeline = promisify(pipeline);
await asyncPipeline(fs.createReadStream(f), process.stdout, { end: false });
process.stdout.write('---\n');
We should also have test to assert on the content of process.stdout
using jest spies or something.
This PR has not received a response in a while and will be closed soon. If you want to keep it open, please leave a comment below @mentioning a maintainer. |
When output to STDOUT is requested, each manifest in an app is rendered separately and dumped to standard output. In case an app contains more than one chart, a document separator will be missing between adjacent charts, since there is no YAML document separator either at the beginning or at the end of an individual output. The last resource of the preceding chart and the first resource of the following chart will be merged into a random mess. By adding a YAML document separator after each manifest unconditionally, this can be cleanly avoided.
Fixes: cdk8s-team/cdk8s#2155