-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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(multienv): allow commas and quoted values #3542
Merged
GenPage
merged 6 commits into
runatlantis:main
from
inkel:inkel/multienv/proper-parsing-value-commas-quotes
Oct 6, 2023
Merged
fix(multienv): allow commas and quoted values #3542
GenPage
merged 6 commits into
runatlantis:main
from
inkel:inkel/multienv/proper-parsing-value-commas-quotes
Oct 6, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inkel
force-pushed
the
inkel/multienv/proper-parsing-value-commas-quotes
branch
from
June 26, 2023 13:17
8a86a78
to
afdadb7
Compare
@inkel could you fix the conflict? Thanks. |
While at it makes it more readable. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
This new function properly deals with quotes and commas in values. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
See runatlantis#2765 for an issue report. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
This new function properly deals with quotes and commas in values. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
inkel
force-pushed
the
inkel/multienv/proper-parsing-value-commas-quotes
branch
from
September 8, 2023 19:41
afdadb7
to
c6c31ca
Compare
Done! |
GenPage
approved these changes
Oct 6, 2023
ijames-gc
pushed a commit
to gocardless/atlantis
that referenced
this pull request
Feb 13, 2024
* Make code more Go-idiomatic While at it makes it more readable. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add internal function to parse multienv step input This new function properly deals with quotes and commas in values. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add regression test for multienv output with comma in values See runatlantis#2765 for an issue report. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Use parseMultienvLine for parsing multienv steps output Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add internal function to parse multienv step input This new function properly deals with quotes and commas in values. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> --------- Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
ijames-gc
pushed a commit
to gocardless/atlantis
that referenced
this pull request
Feb 13, 2024
* Make code more Go-idiomatic While at it makes it more readable. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add internal function to parse multienv step input This new function properly deals with quotes and commas in values. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add regression test for multienv output with comma in values See runatlantis#2765 for an issue report. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Use parseMultienvLine for parsing multienv steps output Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add internal function to parse multienv step input This new function properly deals with quotes and commas in values. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> --------- Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
terakoya76
pushed a commit
to terakoya76/atlantis
that referenced
this pull request
Dec 31, 2024
* Make code more Go-idiomatic While at it makes it more readable. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add internal function to parse multienv step input This new function properly deals with quotes and commas in values. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add regression test for multienv output with comma in values See runatlantis#2765 for an issue report. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Use parseMultienvLine for parsing multienv steps output Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add internal function to parse multienv step input This new function properly deals with quotes and commas in values. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> --------- Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
what
As first stated by @acostaedg in #2765, the
multienv
step was failing if a value contained a comma (,
). This PR adds the capability to quote values and thus having commas as part of the value.why
Upon inspecting the previous
multienv
code I've found it was using a naive algorithm that was prone to errors. At Grafana Labs we are about to usemultienv
steps with lots of custom environment variables, many of which can contain characters like commas, equals (=
), newlines (\n
), or being a full JSON object.By using a custom algorithm to parse the output of the
multienv
program we can now have a more thorough test suite and also provide advanced value for this feature.tests
I've added a full test suite for the internal algorithm. See
server/core/runtime/multienv_step_runner_internal_test.go
for additional information.I've also added a regression test for the original issue reported.
references