-
-
Couldn't load subscription status.
- Fork 206
feat: support shell-like parameter expansion #1354
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
Conversation
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.
Pull Request Overview
This PR adds support for shell-like parameter expansion, enabling substring slicing (${VAR:offset:length}) and default value fallbacks (${VAR:-default}) in DAG environment variables and parameters. The implementation leverages the mvdan.cc/sh/v3 library for proper shell-style expansion, replacing the previous os.Expand approach with more sophisticated parsing that handles complex parameter transformations.
Key changes include:
- Integration of
mvdan.cc/sh/v3library for shell-compatible parameter expansion - Support for substring operations and default values in parameters, environment variables, and step outputs
- Refactored parameter evaluation logic to centralize expansion through
evalParamValuefunction
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
internal/integration/env_test.go |
Adds integration tests for substring expansion, default values, and step output slicing |
internal/core/spec/params.go |
Refactors parameter parsing to use new evalParamValue function; removes dag parameter from parseParams |
internal/core/spec/builder_test.go |
Adds unit tests for substring, default fallback, and NoEval mode |
internal/common/cmdutil/eval_test.go |
Adds test cases for substring expansion in variables and step references |
internal/common/cmdutil/eval.go |
Implements shell expansion via expandWithShell, adds step reference slicing, and parsing logic |
go.mod |
Adds dependency on mvdan.cc/sh/v3 v3.12.0 |
docs/writing-workflows/parameters.md |
Documents substring slicing and parameter chaining examples |
docs/reference/changelog.md |
Documents new feature in v1.24.0 unreleased version |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Deploying dagu-doc with
|
| Latest commit: |
4ba8341
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b80dec09.dagu-doc.pages.dev |
| Branch Preview URL: | https://env-parse-issue.dagu-doc.pages.dev |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1354 +/- ##
==========================================
- Coverage 60.62% 60.54% -0.08%
==========================================
Files 165 165
Lines 23772 23832 +60
==========================================
+ Hits 14411 14429 +18
- Misses 8227 8261 +34
- Partials 1134 1142 +8
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Resolves #1352