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

support pulumi cancel command #768

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
name: Dotnet ${{ matrix.command }} on ${{ matrix.os }}
strategy:
matrix:
command: [up, refresh, destroy, preview]
command: [up, refresh, destroy, preview, cancel]
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
steps:
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
name: Golang ${{ matrix.command }} on ${{ matrix.os }}
strategy:
matrix:
command: [up, refresh, destroy, preview]
command: [up, refresh, destroy, preview, cancel]
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This will check out the existing directory and run `pulumi preview`.
The action can be configured with the following arguments:

- `command` (required) - The command to run as part of the action. Accepted
values are `up` (update), `refresh`, `destroy` and `preview`.
values are `up` (update), `refresh`, `destroy` `preview` and `cancel`.

- `stack-name` (required) - The name of the stack that Pulumi will be operating
on
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const command = rt.Union(
rt.Literal('refresh'),
rt.Literal('destroy'),
rt.Literal('preview'),
rt.Literal('cancel'),
);

export type Commands = rt.Static<typeof command>;
Expand Down
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ const main = async () => {
stack.refresh({ onOutput, ...config.options }).then((r) => r.stdout),
destroy: () =>
stack.destroy({ onOutput, ...config.options }).then((r) => r.stdout),
preview: async () => {
cancel: async () => { await stack.cancel(); return "" },
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this line needs to be aligned with the others.

preview: async () => {
const { stdout, stderr } = await stack.preview(config.options);
onOutput(stdout);
onOutput(stderr);
Expand Down