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

Passing profiles to Docker via Environment Vars fails if the profile uses local variables #556

Open
ghost opened this issue Mar 26, 2021 · 1 comment · Fixed by #583
Open

Comments

@ghost
Copy link

ghost commented Mar 26, 2021

Description of Problem, Request, or Question

Defining and using local variables inside profiles is supported according to this link:
https://docs.conan.io/en/latest/reference/profiles.html#variable-declaration

The content of a profile will be encoded in environment variables that are then passed to the Docker command.
If the profile contains a $, it will not be escaped. The shell inside the Docker container then sets these variables and tries to evaluate everything following the $ as an environment variable as well.

Example:

The profile

compiler_version=7
[env]
CC=gcc-$compiler_version

will be encoded into

compiler_version=7@@[env]@@CC=gcc-$compiler_version@@

Inside the container the shell will treat the $compiler_version part as an undefined variable and will replace it with an empty string. That results in a profile like this:

compiler_version=7
[env]
CC=gcc-

where the version number is missing in the definition of `CC``.

Environment Details

  • Conan Package Tools Version: 0.35.0
  • Operating System: Linux
  • Operation System Version: Ubuntu 20.04
  • Compiler+version: any
  • Docker image: based on ubuntu:18.04
  • Conan version: conan 1.33.1
  • Python version: python 3.8.5

Steps to reproduce (Include if Applicable)

Build logs (Include if Available)

@ghost
Copy link
Author

ghost commented Mar 29, 2021

I am not sure if other character in profiles can also cause problems when stored in environment variables.
Maybe this issue can be solved by switching to a different encoding. Something like BASE64 encoding should work with environment variables although it will be incompatible with the current implementation.

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

Successfully merging a pull request may close this issue.

1 participant