-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fix override of existing values in prepend & append #581
Fix override of existing values in prepend & append #581
Conversation
57b2c7f
to
10918e6
Compare
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.
Some suggestions. Mostly a matter of taste, but existingValue.(string)
might cause a panic.
Hello and welcome, @nicolasbender ! This broadly looks good - thanks for adding test coverage - and I'd like to see this PR incorporate the changes suggested by @c0d1ngm0nk3y . I don't want to just merge them in myself in case you have opinions on them. |
@nicolasbender To be clear. This will only affect the way these environment variables are ultimately logged no functionality will change as the setting of environment variables from the files generated is done by the lifecycle. I think that this is still a great fix I just wanted to lay that out cause it is unclear to me in the write up that is the intended outcome. |
Yes, we are aware of that. The issue we had with this was only in some integration tests from the npm-install buildpack which tested the outcome of the logged result and not the result itself (paketo-buildpacks/npm-install#688 (comment)). And since the logging did not work properly, the integration tests failed. |
Perfect! |
Hi @ForestEckhardt @robdimsdale, thanks for merging! Is it possible to release this change in a patch version? Although this is a very small change, this PR is blocked until the next release of packit including this change. |
@paketo-buildpacks/tooling-maintainers Are there any plans on releasing |
@sophiewigmore not sure if you are involved in this repo, but getting a release would be great to unlock the Node.js pr. |
Summary
Currently, when using
NewFormattedMapFromEnvironment(environment)
, entries like "$KEY:value" are overwritten by the last loop execution when using both append and prepend on the same $KEY. This fix appends and prepends values to entries which are already existing.Use Cases
We stumbled upon this in the following PR: paketo-buildpacks/npm-install#688 (comment). Integration tests in this project are not working because they check for specific log entries written with
NewFormattedMapFromEnvironment(environment)
, which yield the wrong result, because they overwrite "$KEY:value" when append and prepend are used on the same $KEY.Checklist