Skip to content
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

Allow encryption of multiple variables #5

Merged
merged 7 commits into from
Jan 19, 2013
Merged

Allow encryption of multiple variables #5

merged 7 commits into from
Jan 19, 2013

Conversation

sarahhodne
Copy link
Contributor

This allows you to do something like the following:

$ travis encrypt <<EOF
username=random
password=random2
EOF
Please add the following to your .travis.yml file:

  secure: "gfs4uN5PQcp..."
  secure: "asdfsdfDF..."

Pro Tip™: You can add it automatically by running with --add.

Requested in #4

File.write(travis_yaml, travis_config.to_yaml)
else
say encrypted.inspect, template(__FILE__)
if interactive?

This comment was marked as spam.

This comment was marked as spam.

@rkh
Copy link
Contributor

rkh commented Jan 17, 2013

This will break encrypting SSH keys...

@sarahhodne
Copy link
Contributor Author

You're right. Is there a different way we could do this, or should we reject the feature request?

@rkh
Copy link
Contributor

rkh commented Jan 17, 2013

No, I think in general this is something we want. We could add a flag for splitting it (or for not splitting it).

@rkh
Copy link
Contributor

rkh commented Jan 17, 2013

Maybe we should also not do the data = args.join(" ") then...

@sarahhodne
Copy link
Contributor Author

No, I think that is wanted. If you do travis encrypt FOO=bar BAR=foobar, you probably want that encrypted as

env:
  - FOO=bar BAR=foobar

is different from

env:
  - FOO=bar
  - BAR=foobar

@drogus
Copy link
Contributor

drogus commented Jan 17, 2013

Also, you can't encrypt too much env vars due to the length limit, so most of the time you will need to keep them split anyway.

@joshk
Copy link
Contributor

joshk commented Jan 17, 2013

env vars which should not create a matrix should go in the global section anyhow

On 18/01/2013, at 12:50 AM, Piotr Sarnacki notifications@github.com wrote:

Also, you can't encrypt too much env vars due to the length limit, so most of the time you will need to keep them split anyway.


Reply to this email directly or view it on GitHub.

@rkh
Copy link
Contributor

rkh commented Jan 17, 2013

Yes, --add will add them to env.global, by default, too.

This allows you to do something like the following:

$ travis encrypt <<EOF
username=random
password=random2
EOF
Please add the following to your .travis.yml file:

  secure: "gfs4uN5PQcp..."
  secure: "asdfsdfDF..."

Pro Tip™: You can add it automatically by running with --add.
@rkh
Copy link
Contributor

rkh commented Jan 17, 2013

Also, you can't encrypt too much env vars due to the length limit, so most of the time you will need to keep them split anyway.

What's the length limit? Maybe we should check that...

^...$ just matches any line in the string, \A...\Z makes sure that this
is matching the entire string.
@drogus
Copy link
Contributor

drogus commented Jan 17, 2013

What's the length limit? Maybe we should check that...

I'm not sure, but it's related to restrictions for encrypting using public key. The error is: data too large for key size (OpenSSL::PKey::RSAError)

@rkh
Copy link
Contributor

rkh commented Jan 18, 2013

@henrikhodne what do you think about the commits I added?

@sarahhodne
Copy link
Contributor Author

@rkh Looks good to me.

Conflicts:
	lib/travis/cli/encrypt.rb
rkh added a commit that referenced this pull request Jan 19, 2013
Allow encryption of multiple variables
@rkh rkh merged commit 0119268 into master Jan 19, 2013
@rkh rkh deleted the hh-multiline-encrypt branch January 19, 2013 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants