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

Fix #9065 for previews #9272

Merged
merged 2 commits into from Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG_PENDING.md
Expand Up @@ -18,14 +18,17 @@
- [cli/plugins] - Improved error message for missing plugins.
[#5208](https://github.com/pulumi/pulumi/pull/5208)

- [sdk/nodejs] - Take engines property into account when engine-strict appear in npmrc file
- [sdk/nodejs] - Take engines property into account when engine-strict appear in npmrc file
[#9249](https://github.com/pulumi/pulumi/pull/9249)

### Bug Fixes

- [sdk/nodejs] - Fix uncaught error "ENOENT: no such file or directory" when an error occurs during the stack up.
[#9065](https://github.com/pulumi/pulumi/issues/9065)

- [sdk/nodejs] - Fix uncaught error "ENOENT: no such file or directory" when an error occurs during the stack preview.
[#9272](https://github.com/pulumi/pulumi/issues/9272)

- [sdk/go] - Fix a panic in `pulumi.All` when using pointer inputs.
[#9197](https://github.com/pulumi/pulumi/issues/9197)

Expand Down
17 changes: 7 additions & 10 deletions sdk/nodejs/automation/stack.ts
Expand Up @@ -231,10 +231,9 @@ Event: ${line}\n${e.toString()}`);
});
}

const upPromise = this.runPulumiCmd(args, opts?.onOutput);
let upResult: CommandResult;
try {
upResult = await upPromise;
upResult = await this.runPulumiCmd(args, opts?.onOutput);
} catch (e) {
didError = true;
throw e;
Expand Down Expand Up @@ -335,7 +334,7 @@ Event: ${line}\n${e.toString()}`);
const logFile = createLogFile("preview");
args.push("--event-log", logFile);
let summaryEvent: SummaryEvent | undefined;
const rlPromise = this.readLines(logFile, (event) => {
const logPromise = this.readLines(logFile, (event) => {
if (event.summaryEvent) {
summaryEvent = event.summaryEvent;
}
Expand All @@ -344,27 +343,25 @@ Event: ${line}\n${e.toString()}`);
onEvent(event);
}
});
const prePromise = this.runPulumiCmd(args, opts?.onOutput);

let preResult: CommandResult;
let rlResult: ReadlineResult | undefined;
let previewResult: CommandResult;
try {
[preResult, rlResult] = await Promise.all([prePromise, rlPromise]);
previewResult = await this.runPulumiCmd(args, opts?.onOutput);
} catch (e) {
didError = true;
throw e;
} finally {
onExit(didError);
await cleanUp(logFile, rlResult);
await cleanUp(logFile, await logPromise);
}

if (!summaryEvent) {
log.warn("Failed to parse summary event, but preview succeeded. PreviewResult `changeSummary` will be empty.");
}

return {
stdout: preResult.stdout,
stderr: preResult.stderr,
stdout: previewResult.stdout,
stderr: previewResult.stderr,
changeSummary: summaryEvent?.resourceChanges || {},
};
}
Expand Down