Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

multienv Fails if Env Vars Contain , (comma) Character #2765

Open
acostaedg opened this issue Dec 9, 2022 · 6 comments
Open

multienv Fails if Env Vars Contain , (comma) Character #2765

acostaedg opened this issue Dec 9, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@acostaedg
Copy link

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

@austinsherron

Hello, I'm facing similar issue with Env vars added through multienv containing the comma (,) character, the error is the following:

{"level":"error","ts":"2022-12-09T14:15:30.592Z","caller":"events/instrumented_project_command_runner.go:42","msg":"Error running plan operation: Invalid environment variable definition:

My variables is something like this:

VARIABLE_NAME=hello, world, this, is, not, working

As the variable "VARIABLE_NAME" value contains comma (,) characters, looks like multienv cannot do the job and create the environment variables correctly.

Reproduction Steps

Logs

Environment details

If not already included, please provide the following:

  • Atlantis version: v0.21

Additional Context

This issue is similar to #2351 , in that case the issue was with equal (=) character, in this new issue reported the problem is with comma (,) character and multienv in the atlantis.yaml file.

@acostaedg acostaedg added the bug Something isn't working label Dec 9, 2022
@acostaedg acostaedg changed the title __*multienv*__ Fails if Env Vars Contain , (comma) Character multienv Fails if Env Vars Contain , (comma) Character Dec 9, 2022
@acostaedg acostaedg changed the title multienv Fails if Env Vars Contain , (comma) Character 麓multienv麓 Fails if Env Vars Contain , (comma) Character Dec 9, 2022
@acostaedg acostaedg changed the title 麓multienv麓 Fails if Env Vars Contain , (comma) Character multienv Fails if Env Vars Contain , (comma) Character Dec 9, 2022
@nitrocode
Copy link
Member

Please share your yaml configurations and any related configs/flags. We may not be able to work on this but this will help contributors in the future be able to propose a PR to fix the issue.

@yiranyao
Copy link

Hello, I'm also seeing similar issue when the environment variable contains single (') or double-quote (").
For example

cat .multienv
OWNER=Harry's
PASSWORD=abcd"efg

@inkel
Copy link
Contributor

inkel commented Jun 21, 2023

I can confirm this fails. In fact, I've a test case that proves it. I'm actually working on implementing multienv steps in our workflows and found this issue, so if that's ok with you I'll be working on a fix for all these issues (commas and quotes).

@jamengual
Copy link
Contributor

jamengual commented Jun 21, 2023

of course is ok, we will be happy to review @inkel

@inkel
Copy link
Contributor

inkel commented Jun 21, 2023

@jamengual thanks, great to hear. Just out of curiosity: any particular reason why multienv expects a single line of output in the var1=value1,var2=value2 format and not multi-line?

@jamengual
Copy link
Contributor

you must ask @tapaszto , I can't recall the use case.
I remember was initially implemented with a JSON output and then we asked to change it, but that is all I remember.

inkel added a commit to inkel/atlantis that referenced this issue Jun 21, 2023
See runatlantis#2765 for an issue report.

Signed-off-by: Leandro L贸pez (inkel) <leandro.lopez@grafana.com>
inkel added a commit to inkel/atlantis that referenced this issue Jun 26, 2023
See runatlantis#2765 for an issue report.

Signed-off-by: Leandro L贸pez (inkel) <leandro.lopez@grafana.com>
inkel added a commit to inkel/atlantis that referenced this issue Sep 8, 2023
See runatlantis#2765 for an issue report.

Signed-off-by: Leandro L贸pez (inkel) <leandro.lopez@grafana.com>
GenPage pushed a commit that referenced this issue Oct 6, 2023
* 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 #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 issue 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 issue 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants