Fix/pass secret when execution#4011
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes issue #3994 where Survey variables of type Secret were not being passed into task execution for Shell/Bash (and other non-Ansible) runs by merging LocalExecutor.Secret into the same extra-vars map used to build runtime arguments.
Changes:
- Merge Survey Secret variables (from
LocalExecutor.Secret) into the computed extra vars map ingetEnvironmentExtraVars. - Refactor
getEnvironmentExtraVarsJSONto reusegetEnvironmentExtraVarsto avoid duplicated parsing/merge logic. - Add unit tests covering secret var propagation into Shell args and extra vars merging.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| services/tasks/local_executor.go | Merges survey secret vars into extra vars so Shell/Terraform paths receive them; deduplicates extra-vars JSON generation. |
| services/tasks/local_executor_test.go | Adds regression tests ensuring survey secret vars are included for Shell args and extra vars. |
5a36eb1 to
1a42710
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughLocalExecutor's getEnvironmentExtraVars now parses and merges Secret JSON into the extra vars map, and getEnvironmentExtraVarsJSON delegates to it instead of duplicating parsing logic, removing the prior side-effect of clearing t.Secret. New unit tests validate secret merging in shell args and extra vars. ChangesSecret merging in LocalExecutor
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant getEnvironmentExtraVarsJSON
participant getEnvironmentExtraVars
Caller->>getEnvironmentExtraVarsJSON: request extra vars JSON
getEnvironmentExtraVarsJSON->>getEnvironmentExtraVars: delegate call
getEnvironmentExtraVars->>getEnvironmentExtraVars: parse Environment.JSON
getEnvironmentExtraVars->>getEnvironmentExtraVars: parse t.Secret JSON
getEnvironmentExtraVars->>getEnvironmentExtraVars: maps.Copy Secret into extraVars
getEnvironmentExtraVars-->>getEnvironmentExtraVarsJSON: return merged extraVars
getEnvironmentExtraVarsJSON-->>Caller: return marshaled JSON
Related Issues: None specified. Related PRs: None specified. Suggested labels: go, tests, bug-fix Suggested reviewers: semaphoreui maintainers familiar with task execution services 🐇 A secret hopped in, quiet and small, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
fix issue #3994
Summary by CodeRabbit
Bug Fixes
Tests