Every time I deploy to Github, Travis CI says at the end of its report:
Dashboard report has not been sent: neither INFECTION_BADGE_API_KEY nor STRYKER_DASHBOARD_API_KEY were found in the environment
I've tried setting the environment variable at least four times:
At first my .travis.yml file looked like this:
language: php
php:
- '7.3'
install: composer update
script:
- vendor/bin/infection --min-covered-msi=90 --min-msi=90
dd:
secure: "A/s0...bS8="
This was because I had missed one of the dashes in the --add in travis encrypt STRYKER_DASHBOARD_API_KEY=<my-secret-uuid-key> --add (from step 4 in the link).
When I fixed that it gave the same error message:
-dd:
- secure: A/s0...bS8=
+env:
+ global:
+ secure: A/s0...bS8=
Each subsequent attempt gave the same error. Trying to generate a new key:
- secure: A/s0...bS8=
+ - secure: iQra...Ol0=
Quoting the encrypted value:
- - secure: iQra...Ol0=
+ - secure: 'iQra...Ol0='
Not using the --add option but manually copying from the console and pasting into the config file:
- - secure: 'iQra...Ol0='
+ secure: "CPPE...3nk="
What's the right way to get this working?
TL;DR: new free Travis CI accounts are now created on the professional server.
Hard to diagnose, easy to fix! The instructions for creating a secure environment variable on Travis CI fail to mention that all new accounts are now created on the professional server (travis-ci.com), and no longer on the old free server (travis-ci.org), even the free accounts! What's even more confusing is that you can see the same account at both addresses!
So, to encrypt an environment variable, you must pass the server flag (
--proor--com) totravis encrypt:or
where you replace
MY_SECRET_ENVwith the name of your variable andsuper_secretwith the actual value.If you have an old free account that is still on travis-ci.org you can continue to use:
or
For
travis encryptto output values that can be successfully decrypted, you must know which server your account is on, which is currently very confusing for new users.