Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add secret environment variable to Travis CI

Tags:

travis-ci

I'm currently trying to add a secret environment variable to Travis-CI. In the docs ("Secure environment variables") I found the following line to do this:

gem install travis
travis encrypt -r travis-ci/travis-core MY_SECRET_ENV=super_secret

If I understood this correctly I must replace travis-ci/travis-core with the name of my own repository, because the encryption should only be valid for my repository. Therefore, there must be a public key in the repository. Is there a special travis command to add this key? How does this exactly work? Or is this just my ssh public key?

When I run the following command:

travis encrypt -r my_username/my_repo MY_SECRET_ENV=super_secret

I get the following error:

There was an error while fetching public key, please check if you entered correct slug
like image 248
Odi Avatar asked Oct 04 '12 09:10

Odi


People also ask

Which of the following is added to support trusty environment in Travis CI?

Oracle JDK 11 ( oraclejdk11 )

How do I encrypt Travis?

The travis encrypt-file command will encrypt a file for you using a symmetric encryption (AES-256), and it will store the secret in a secure variable. It will output the command you can use in your build script to decrypt the file. Make sure to add super_secret. txt.

Which of the following encryption scheme is used by Travis CI?

Encryption scheme # Travis CI uses asymmetric cryptography. For each registered repository, Travis CI generates an RSA keypair. Travis CI keeps the private key private, but makes the repository's public key available to those who have access to the repository.


1 Answers

This is a known issue. It already has a pull request on GitHub to fix it. The problem is the request to get the public key of a repository does not work, because they changed the API to SSL. If you don't want to wait for the pull request to be merged, you can simply change the source to use https instead of http.

like image 140
Odi Avatar answered Dec 14 '22 20:12

Odi