-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 :) |
end | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.