Jeff Lowery
Jeff Lowery

Reputation: 2599

Travis CI encrypted secret environment variables

Having a problem with Travis on Github. I encrypted two environment variables using:

travis encrypt MY_SECRET_ENV=super_secret --add env.matrix

I see two encrypted values under env:matrix:-secure:

env:
  matrix:
  - secure:
  kQeMLwvGVBl...
  - secure:
  h7SXfIif5Y...

If I look at the commit info, I can see the first ENV variable on the first commit, and the second ENV variable on the next commit. The tests indicate the the second ENV variable clobbered the first, and so I only have one ENV variable set: only one of two test passes, depending on which ENV variable "wins".

Is there a way to set two encrypted ENV vars in .travis.yml?

Env variables in Travis CI on Github

Upvotes: 0

Views: 1210

Answers (1)

Jeff Lowery
Jeff Lowery

Reputation: 2599

Answer is here.

The Travis CI docs use env:matrix in their example, but that sets up TWO test runs, one for each ENV variable.

Instead of env:matrix, use env:global, which will cause one test to run with multiple ENV variables.

Upvotes: 1

Related Questions