Support Cancellation of Stack Operations in Pulumi Java Automation API
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 85
- Forks
- 26
- Avg merge
- 11h 49m
- Merged PRs (30d)
- 22
Description
- Vote on this issue by adding a 👍 reaction
- If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)
Issue details
Add a high-level cancellation/shutdown method to the Pulumi Java Automation API (e.g., Stack.cancel() or Workspace.cancelCurrentOperation()) that reliably stops any ongoing stack operation (up, preview, destroy, etc.), shutting down Pulumi CLI invocations and any child language host processes launched by the API.
Background:
Currently, the Automation API (pulumi/pulumi-java) does not provide a method to cancel or shutdown running stack actions.
Users running stack.up(), stack.preview(), etc. cannot interrupt or stop those operations gracefully from their Java code. This is especially problematic when long-running deployments or misconfigurations occur.
Pulumi operations can spawn the CLI and language hosts, which may continue running even if the calling thread or Future is interrupted.
Workarounds:
The only available workaround is to launch the Automation API code in a separate process (e.g., via ProcessBuilder) and kill the process externally. This is non-idiomatic, cumbersome, and hard to manage within larger applications.
Requested Solution:
- Provide a method (such as
cancel()or similar) on theStackorWorkspaceobjects. - This method should:
- Signal all ongoing Pulumi stack operations to stop immediately.
- Cleanly terminate Pulumi CLI and any child language host processes started by the API.
- Release all related resources.
- Optionally, provide callback, error reporting, and confirmation that shutdown has occurred.
Benefits:
- Enables robust operation cancellation for long-running or stuck deployments.
- Simplifies integration in applications that require responsiveness and cancellation (e.g., web services, CI/CD controllers).
- Aligns Java Automation API with user expectations for control over async and parallel tasks.
Motivation:
Pulumi Automation API is often used in orchestration, server, and desktop apps where clean cancellation is essential.
Adding native cancellation avoids hacky process management patterns and improves reliability and developer experience.
Affected area/feature
Automation API
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named. Start by tracing the Automation API's Stack and Workspace operation lifecycle, including Pulumi CLI and child language-host processes. Define the cancellation API and its behavior for up, preview, and destroy, then verify that operations stop and related resources are released.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100