Fix duplicate environment variables in MergeEnvVars - #2338
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@Shubbu03 please sign your commits also please check the release note against the template |
Signed-off-by: Shubbu03 <thatcoderguyshubham@gmail.com>
fe5df65 to
d6ee5b1
Compare
|
Thanks @kaizakin — both items should be addressed now:
|
|
/ok-to-test |
kaizakin
left a comment
There was a problem hiding this comment.
we have to do some dedup check for into as well
because as of now suppose from is empty, function returns in the first if check without considering whether into has duplicates
even if the control moves down, constructing a map with into alone overwrites the env variable considering it has duplicates (which we shouldn't do if the overwritevalues is set to false)
Signed-off-by: Shubbu03 <thatcoderguyshubham@gmail.com>
2b79aa2 to
12f6938
Compare
Changes
Fix
env.MergeEnvVarsso duplicate environment variable names within the incoming slice are detected correctly.When overwriting is disabled, duplicates now return an error. When enabled, the latest value replaces the earlier one while preserving order. Validation also runs when the destination slice is empty.
Added regression tests for duplicate values,
ValueFrom, empty destinations, ordering, and forbidden variables.Related Issue
Fixes #2330
Type of PR
/kind bug
Submitter Checklist
Release Notes