Script can't find secure environment variable

I’m trying to add a mutation badge to my GitHub repository. I’ve followed the various instructions I’ve found online, and Travis CI builds successfully, including running the Infection mutation tests, which all pass. The output of the most recent run (as of writing) is found at:

https://travis-ci.com/CJDennis/hidden-value/jobs/240107767

At the bottom it says:

Dashboard report has not been sent: neither INFECTION_BADGE_API_KEY nor STRYKER_DASHBOARD_API_KEY were found in the environment

This is why the badge is failing, but I don’t know why environment variable I encrypted in the .travis.yml file can’t be found.

I’ve tried a lot of different options and I no longer want to pollute my Git repository with failed experiments.

env:
  global:
    secure: "CPPE...3nk="

I tried both with and without a dash before secure, double quotes, single quotes, and no quotes. nothing has changed the output yet.

According to https://travis-ci.com/CJDennis/hidden-value/jobs/240107767#L168, the value encrypted in the env: global: secure: in your .travis.yml is:

qQVHLRNWJ1ir2GoJdetL6dg1caIIykzaFo3nk=<some value>

which is probably not what you want.

Make sure you follow Environment Variables - Travis CI. In particular, since you have two secret variables, there’s going to be two encrypted values.

Thanks! That’s exactly what I followed, except the variable shouldn’t be in env.matrix, so I left that as the default. I only need one of the two keys. The value is identical.

Any idea why the instructions have given weird results?

I’ve just tested it, and it gave the expected results.

Since your build is at https://travis-ci.com, I guess you didn’t specify the --com switch to travis encrypt.

I’ve relogged in with --com, regenerated a key with travis encrypt STRYKER_DASHBOARD_API_KEY=<my-secret-uuid> --add and pushed it, but I’m getting the same error:

$ export vpMINtGAqmBNx75KfK5waY1Je0=[secure]

You need to encrypt with --com, too. See Encryption keys - Travis CI.
(that article uses --pro, it’s the same as --com. See travis encrypt --help for all the options available).

You are correct. travis encrypt --pro STRYKER_DASHBOARD_API_KEY=<my-secret-uuid> --add did the trick!