question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

docker: poorly formatted environment:variable in travis (TRAVIS_COMMIT_MESSAGE)

See original GitHub issue
  • Version: 19.49.2
  • Target: Windows and Linux using Docker.

While building for windows and linux using docker on trusty environment in travis, i am getting this error:

docker: poorly formatted environment: variable 'Refactored Settings system by moving it from dexie to JSON. Results in less complexity and efficiency as listeners are removed.' has white spaces.

I have used the travis config as provided in the docs sample project. The builds were running fine with the same config before. Between the last successful build and the current build, the .travis.yml file has not been touched at all.

The mac builds are working perfectly, so I assume the error is due to some config issue.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
Clover-Lindocommented, Sep 16, 2018

@xsokaris I found another way here https://github.com/moby/moby/issues/12997#issuecomment-307665540

Here’s my full script:

  npm run build:prod
  ENVS=`env | grep -iE '^(DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_)([A-Z]|_)*=' | sed -n '/^[^\t]/s/=.*//p' | sed '/^$/d' | sed 's/^/-e /g' | tr '\n' ' '`
  if [ "$TRAVIS_OS_NAME" == "linux" ]; then
    docker run $ENVS --rm \
      -v ${PWD}:/project \
      -v ~/.cache/electron:/root/.cache/electron \
      -v ~/.cache/electron-builder:/root/.cache/electron-builder \
      electronuserland/builder:wine \
      /bin/bash -c "npm run release:linux && npm run release:win"
  else
    npm run release:mac
  fi

Istead of passing vars with --env-file, it creates a list of -e VAR1 -e VAR2, and docker will be able to find the value of each itself. I also fixed the regex so it only takes vars starting by, and not only containing “DEBUG”, “NODE_” etc.

Eventually you’ll have to add your environment variable pattern if it is not already matched by the regular expression.

6reactions
Clover-Lindocommented, Sep 19, 2018

(EDIT: See my cleaner suggestion two messages below, this one only removes all variable)

\r wasn’t enough on my side, I had to exclude \n too

grep -vE '\r|\n'

Here’s the full line:

--env-file <(env | grep -vE '\r|\n' | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_') \

I’m not sure if that’s a good workaround though, but that did the trick for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Environment Variables - Travis CI Docs
Public variables defined in .travis.yml are tied to a certain commit. Changing them requires a new commit, restarting an old build uses the...
Read more >
docker: poorly formatted environment:variable in travis ...
While building for windows and linux using docker on trusty environment in travis, i am getting this error: docker: poorly formatted environment ......
Read more >
Docker Engine release notes
Environment variables DOCKER_CONTENT_TRUST_OFFLINE_PASSPHRASE and ... Add Travis CI configuration to validate DCO and gofmt requirements ...
Read more >
Working with Environment Variables in Node.js[Draft] @ https ...
Tutorial for how to use environment variables in Node.js. ... give a quick insight about the project and what technologies/services/libraries are used. Bad...
Read more >
docker_container - manage docker containers
Parameter Choices/Defaults Comments blkio_weight Default: None Block IO (relative weight), between 10 and 1000. capabilities Default: None List of capabilities to add to the container. cpu_period...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found