Make sure encrypted file env variable names are unique per filename#678
Conversation
|
The tests fail because the Ruby versions 1.9.2 and 1.9.3 cannot be installed. Apparently they have been removed? In any case that's unrelated :) |
|
|
||
| def env_name(name) | ||
| @env_prefix ||= "encrypted_#{Digest.hexencode(Digest::SHA1.digest(Dir.pwd)[0..5])}" | ||
| def env_name(input_path, name) |
There was a problem hiding this comment.
Tiny caveat here is that, as it was before, this command is context dependent. If we execute travis encrypt-file from a different directory, even if the command is invoked on the same file, we will compute a different hash. This is not documented anywhere, but it is worth pointing it out.
There was a problem hiding this comment.
@BanzaiMan without having verified it, i believe that input_path is whatever path is passed to travis encrypt path/to/file (i.e. it would be path/to/file). so yes, i guess that counts as context dependent, but it kinda makes sense to me, as such paths would be considered unique per repo, too (and so would the resulting env vars)?
BanzaiMan
left a comment
There was a problem hiding this comment.
Other than that small caveat, this looks good to me.
Ruby 1.9.2 EOL was on July 31, 2014 https://www.ruby-lang.org/en/news/2014/07/01/eol-for-1-8-7-and-1-9-2/ and RVM is unable to compile 1.9.2 https://travis-ci.org/travis-ci/travis-rubies/jobs/568016914#L325. Instead, let's add a couple somewhat more recent versions.
|
Any chance of this being released soon? |
Unfortunatley, Travis does not support encrypting multiple files (see: travis-ci/travis.rb#239) and although it's been solved in travis-ci/travis.rb#678 there's still no release including it. I followed the documentation at https://docs.travis-ci.com/user/encrypting-files/?source=post_page---------------------------#encrypting-multiple-files and encrypted a tar file that contains all files: the deployment private key and the vault password file. Yet another reason to switch to an alternative like Circe CI or GitLab...
|
How to fetch key and iv values to put as env variable in repo? |
As per this comment #239 (comment) encrypted file env variable names should be unique per filename:
But they are not, because all we hash is the current working directory
Dir.pwd. This PR addresses that.