Config-translation does not handle ENV variables with spaces in them

Hi

I’ve been working to move to Circle 2. Just pulled the config-translation file which looked great. On the first run though I found that the environment variables are not quoted when they are re-written.

Thought it might be worth a report.

My old circle.yml had:

machine:
  environment:
    API_CONSUMER_KEY: Testing Testing 1 2

and when it got converted to Circle 2, I got

- run:
        working_directory: ~/my_project/dir
        command: echo -e "export API_CONSUMER_KEY=Testing Testing 1 2\nexport ..."

Which fails in the shell with an error:

/tmp/.bash_env-5a9cb170c9e77c00017a6dac-0-build: line 1: export: `1': not a valid identifier

It feels like the converter could be a tiny bit smarter and wrap those with quotes as needed.

I manually updated the line to read

 command: echo -e "export API_CONSUMER_KEY='Testing Testing 1 2'\nexport..."

and this got me rolling. But it might be nice if that was a bit smoother for folks.

Cheers
Jon

1 Like

Thanks - I’ve filed a bug internally, and we’ll take a look soon.