Conversation
open-workflow-specification/specification#1191 Signed-off-by: Cristiano Gavião <cvgaviao@gmail.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The schema, runtime implementation, and integration test consistently support the new working-directory property.
Review effort: Lite
Findings: None
What changed in this PR
Adds support for configuring a shell command’s working directory through the workflow schema and ProcessBuilder.
Changes:
- Adds the
shell.directoryschema property. - Resolves and applies the directory when executing shell commands.
- Adds a Linux integration test using
pwd.
| File | Description |
|---|---|
types/src/main/resources/schema/workflow.yaml |
Defines the shell working-directory property. |
impl/core/src/main/java/io/serverlessworkflow/impl/executors/RunShellExecutorBuilder.java |
Builds a resolver for the directory. |
impl/core/src/main/java/io/serverlessworkflow/impl/executors/RunShellExecutor.java |
Applies the directory to ProcessBuilder. |
impl/test/src/test/java/io/serverlessworkflow/impl/test/RunShellExecutorTest.java |
Tests directory execution behavior. |
impl/test/src/test/resources/workflows-samples/run-shell/pwd-directory.yaml |
Provides the directory test workflow. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Looks good, but I think we should wait to the result of the discussion on the spec forum.
In case it is rejected for some reason, since this functionality I agree is needed, this can become a runtime property ( a global one, so all scripts run on the same working directory)
|
The pull request is related to #1695; the issue should be linked to the pull request. |
open-workflow-specification/specification#1191
Many thanks for submitting your Pull Request ❤️!
What this PR does / why we need it:
Some shell scripts use the directory where they started (the working directory) to calculate other paths relative to it.
So, we can't always use the directory where the workflow application was started as the script's working directory. If we do, the script will fail.
Java's java.lang.ProcessBuilder has an explicit method to set the working directory: directory(File directory).
Special notes for reviewers:
Additional information (if needed):