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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Stack - ENV params parsing error #5661

Closed
zafrirron opened this issue Sep 18, 2021 · 6 comments
Closed

Create Stack - ENV params parsing error #5661

zafrirron opened this issue Sep 18, 2021 · 6 comments
Labels
Milestone

Comments

@zafrirron
Copy link

Bug description
Fail to deploy a stack - environemnt variable parsing error

Expected behavior
simple key value parser for the following variable (replace USER/PASS/DB with yours):
MONGO_URI='mongodb+srv://USER:PASS@cluster0.1x6jg.mongodb.net/DB?retryWrites=true&w=majority'

Portainer Logs
Provide the logs of your Portainer container or Service.
You can see how here
No need a parser werror on web interface

Steps to reproduce the issue:

  1. Go to: create stack
  2. Click on: advacnced mode; paste your variables (including the MONGO_URI var from above)
  3. Scroll down to: change back to simple mode
  4. See error: variable key/value fails

Technical details:

  • Portainer version: 2.6.3
  • Docker version (managed by Portainer): v20.10.8
  • Kubernetes version (managed by Portainer): N/A
  • Platform (windows/linux): windows
  • Command used to start Portainer (docker run -p 9443:9443 portainer/portainer):
  • Browser: chrome
  • Use Case (delete as appropriate): Using Portainer at Home
  • Have you reviewed our technical documentation and knowledge base? Yes

Additional context
using the same compose file from linux command prompt - work like a charm...

@Rockz1152
Copy link

I've noticed this too, if an environment variable line contains more than one "=" signs, Portainer seems to parse the value from the last "=" sign instead of the first. Compared to docker-compose which seems to parse the value after the first "=" sign.

@zafrirron
Copy link
Author

I've noticed this too, if an environment variable line contains more than one "=" signs, Portainer seems to parse the value from the last "=" sign instead of the first. Compared to docker-compose which seems to parse the value after the first "=" sign.

Correct, try a='b=c=d=e'

@zafrirron zafrirron changed the title Create Stack - issue Create Stack - ENV params parsing error Sep 19, 2021
@Rockz1152
Copy link

Quotation marks didn't work for me. I believe that is per the syntax rules for env files. https://docs.docker.com/compose/env-file/

There is no special handling of quotation marks. This means that they are part of the VAL.

@huib-portainer
Copy link
Contributor

if an environment variable line contains more than one "=" signs, Portainer seems to parse the value from the last "=" sign instead of the first

That UI issue has been solved by #5395

You can give it a try by using the image portainerci/portainer:develop.
Please let us know how that's working for you.
Note that this is a development build and should not be used in a production environment.

As for the original report, try it without quotes.

e.g. this test stack:

version: '3'
services:
  nginx-env-service:
    image: nginx:alpine
    environment:
      MONGO_URI: "${MONGO_URI}"

With the env var:
image

Results in
image

@SvenDowideit SvenDowideit added this to the CE-2.9.0 milestone Sep 20, 2021
@Rockz1152
Copy link

Just tested with portainerci/portainer:develop and everything is working great for me.

@zafrirron
Copy link
Author

Checked the portainerci/portainer:develop image, looks like the bug was fixed....thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants