travis 1.7.1.travis.613.5 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZmZmNjIyNDM1ZGVjNzM1NGVjZjA5NTAyMDc3NjFkYThkNzNjOGYxYw==
5
- data.tar.gz: !binary |-
6
- NTNjZjBiMGJjOGQ2OTIxYTk2MWY5Y2FkNzIyYjhkY2NlODdlNGE1Yg==
2
+ SHA1:
3
+ metadata.gz: 2bbe32794af4faecd1efdc98fc741b211b423125
4
+ data.tar.gz: af3729cc6a768fe277c05e0928d7e98862f110d8
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MjVkMmQ4NDYxNDFiYzcwYWU3ZTc0NWYyYWQwOTQyZjRiZjI4MTEyNWYxMjFh
10
- YTE0ZGJkMTQ2NjNjOTA5NTE3MWE4ODQ0M2VmYmQxNDQ1MjI5N2JjMzExNzVl
11
- N2IyMmEwMzIyMzJkMGY2ZTlmNDM0YTY4ZjA3ZmFjZmE5OTZhNDU=
12
- data.tar.gz: !binary |-
13
- NmYzZTc2NzY3NzQxMTJkMzAxOTg2ODU0M2I1ZWNkNjNmNzUwMGQwN2I0YmQ3
14
- MDk1MGIzZTA4Y2YyYzdmZjUwNmYxNGVmY2UwZWY4MDg5NGE1ZTIxNDJjOTJj
15
- NzY0ODI3ZWVkYjQ1NDQ4ZWI5ZjkzMjQzNTBkM2MxYzU0YzYwMGY=
6
+ metadata.gz: 97a56cd715c0ee8c6fe5630df0c2821cf109b3f7501f7fae8feb57ada9b2a8562d1c9d663c8d22d589b74bad85d2e96bed33a924432a7cda5acb3bdf7bf3748e
7
+ data.tar.gz: fa580f8c64a0b78923ee35114c8154f92f4195305c35bcfb8ebd7a43895aa318ddf7a3c5d714f0bff3580314a843afb3ab9214c3b686385f4ad7dc79c1d76432
data/README.md CHANGED
@@ -1964,12 +1964,12 @@ You can check your Ruby version by running `ruby -v`:
1964
1964
 
1965
1965
  Then run:
1966
1966
 
1967
- $ gem install travis -v 1.7.0 --no-rdoc --no-ri
1967
+ $ gem install travis -v 1.7.1 --no-rdoc --no-ri
1968
1968
 
1969
1969
  Now make sure everything is working:
1970
1970
 
1971
1971
  $ travis version
1972
- 1.7.0
1972
+ 1.7.1
1973
1973
 
1974
1974
  See also [Note on Ubuntu](#note-on-ubuntu) below.
1975
1975
 
@@ -2054,6 +2054,11 @@ If you have the old `travis-cli` gem installed, you should `gem uninstall travis
2054
2054
 
2055
2055
  ## Version History
2056
2056
 
2057
+ **1.7.1** (August 9, 2014)
2058
+
2059
+ * Better error message when trying to encrypt a string that is too long.
2060
+ * Fix Validation failed error using `travis sshkey --upload`.
2061
+
2057
2062
  **1.7.0** (August 5, 2014)
2058
2063
 
2059
2064
  * Add `travis encrypt-file`.
@@ -45,6 +45,11 @@ module Travis
45
45
  list = encrypted.map { |data| format(data.inspect, " secure: %s") }
46
46
  say(list.join("\n"), template(__FILE__), :none)
47
47
  end
48
+ rescue OpenSSL::PKey::RSAError => error
49
+ error "#{error.message.sub(" for key size", "")} - consider using " <<
50
+ color("travis encrypt-file", [:red, :bold]) <<
51
+ color(" or ", :red) <<
52
+ color("travis env set", [:red, :bold])
48
53
  end
49
54
 
50
55
  private
@@ -52,12 +52,13 @@ module Travis
52
52
 
53
53
  def generate_key
54
54
  github.with_basic_auth do |gh|
55
+ login = gh['user']['login']
55
56
  check_access(gh)
56
57
  empty_line
57
58
 
58
59
  say "Generating RSA key."
59
60
  private_key = Tools::SSLKey.generate_rsa
60
- self.description ||= "key for fetching dependencies for #{slug}"
61
+ self.description ||= "key for fetching dependencies for #{slug} via #{login}"
61
62
 
62
63
  say "Uploading public key to GitHub."
63
64
  gh.post("/user/keys", :title => "#{description} (Travis CI)", :key => Tools::SSLKey.rsa_ssh(private_key.public_key))
@@ -75,7 +76,7 @@ module Travis
75
76
  end
76
77
 
77
78
  def remove_passphrase(value)
78
- return unless Tools::SSLKey.has_passphrase? value
79
+ return value unless Tools::SSLKey.has_passphrase? value
79
80
  return Tools::SSLKey.remove_passphrase(value, passphrase) || error("wrong pass phrase") if passphrase
80
81
  error "Key is encrypted, but missing --passphrase option" unless interactive?
81
82
  say "The private key is protected by a pass phrase."
@@ -1,3 +1,3 @@
1
1
  module Travis
2
- VERSION = '1.7.0'
2
+ VERSION = '1.7.1'
3
3
  end
data/travis.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  # general infos
4
4
  s.name = "travis"
5
- s.version = "1.7.0"
5
+ s.version = "1.7.1"
6
6
  s.description = "CLI and Ruby client library for Travis CI"
7
7
  s.homepage = "https://github.com/travis-ci/travis.rb"
8
8
  s.summary = "Travis CI client"
@@ -19,8 +19,8 @@ Gem::Specification.new do |s|
19
19
  "Peter Souter",
20
20
  "Peter van Dijk",
21
21
  "Max Barnash",
22
- "Mathias Meyer",
23
22
  "Carlos Palhares",
23
+ "Mathias Meyer",
24
24
  "Thais Camilo and Konstantin Haase",
25
25
  "Justin Lambert",
26
26
  "Adrien Brault",
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
29
29
  "Mario Visic",
30
30
  "Miro Hron\xC4\x8Dok",
31
31
  "Neamar",
32
+ "Nicolas Bessi (nbessi)",
32
33
  "Piotr Sarnacki",
33
34
  "Rapha\xC3\xABl Pinson",
34
35
  "Tobias Wilken",
@@ -55,8 +56,8 @@ Gem::Specification.new do |s|
55
56
  "p.morsou@gmail.com",
56
57
  "peter.van.dijk@netherlabs.nl",
57
58
  "i.am@anhero.ru",
58
- "meyer@paperplanes.de",
59
59
  "me@xjunior.me",
60
+ "meyer@paperplanes.de",
60
61
  "dev+narwen+rkh@rkh.im",
61
62
  "jlambert@eml.cc",
62
63
  "adrien.brault@gmail.com",
@@ -65,6 +66,7 @@ Gem::Specification.new do |s|
65
66
  "mario@mariovisic.com",
66
67
  "miro@hroncok.cz",
67
68
  "neamar@neamar.fr",
69
+ "nbessi@users.noreply.github.com",
68
70
  "drogus@gmail.com",
69
71
  "raphael.pinson@camptocamp.com",
70
72
  "tw@cloudcontrol.de",
@@ -115,8 +117,6 @@ Gem::Specification.new do |s|
115
117
  "assets/travis.sh",
116
118
  "assets/travis.sh.erb",
117
119
  "bin/travis",
118
- "examples/cli/encrypt_file.md",
119
- "examples/cli/private_dependencies.md",
120
120
  "examples/org_overview.rb",
121
121
  "examples/pro_auth.rb",
122
122
  "examples/stream.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1.travis.613.5
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
@@ -12,8 +12,8 @@ authors:
12
12
  - Peter Souter
13
13
  - Peter van Dijk
14
14
  - Max Barnash
15
- - Mathias Meyer
16
15
  - Carlos Palhares
16
+ - Mathias Meyer
17
17
  - Thais Camilo and Konstantin Haase
18
18
  - Justin Lambert
19
19
  - Adrien Brault
@@ -22,6 +22,7 @@ authors:
22
22
  - Mario Visic
23
23
  - Miro Hrončok
24
24
  - Neamar
25
+ - Nicolas Bessi (nbessi)
25
26
  - Piotr Sarnacki
26
27
  - Raphaël Pinson
27
28
  - Tobias Wilken
@@ -39,206 +40,206 @@ authors:
39
40
  autorequire:
40
41
  bindir: bin
41
42
  cert_chain: []
42
- date: 2014-08-05 00:00:00.000000000 Z
43
+ date: 2014-08-09 00:00:00.000000000 Z
43
44
  dependencies:
44
45
  - !ruby/object:Gem::Dependency
45
46
  name: faraday
46
47
  requirement: !ruby/object:Gem::Requirement
47
48
  requirements:
48
- - - ~>
49
+ - - "~>"
49
50
  - !ruby/object:Gem::Version
50
51
  version: '0.9'
51
52
  type: :runtime
52
53
  prerelease: false
53
54
  version_requirements: !ruby/object:Gem::Requirement
54
55
  requirements:
55
- - - ~>
56
+ - - "~>"
56
57
  - !ruby/object:Gem::Version
57
58
  version: '0.9'
58
59
  - !ruby/object:Gem::Dependency
59
60
  name: faraday_middleware
60
61
  requirement: !ruby/object:Gem::Requirement
61
62
  requirements:
62
- - - ~>
63
+ - - "~>"
63
64
  - !ruby/object:Gem::Version
64
65
  version: '0.9'
65
- - - ! '>='
66
+ - - ">="
66
67
  - !ruby/object:Gem::Version
67
68
  version: 0.9.1
68
69
  type: :runtime
69
70
  prerelease: false
70
71
  version_requirements: !ruby/object:Gem::Requirement
71
72
  requirements:
72
- - - ~>
73
+ - - "~>"
73
74
  - !ruby/object:Gem::Version
74
75
  version: '0.9'
75
- - - ! '>='
76
+ - - ">="
76
77
  - !ruby/object:Gem::Version
77
78
  version: 0.9.1
78
79
  - !ruby/object:Gem::Dependency
79
80
  name: highline
80
81
  requirement: !ruby/object:Gem::Requirement
81
82
  requirements:
82
- - - ~>
83
+ - - "~>"
83
84
  - !ruby/object:Gem::Version
84
85
  version: '1.6'
85
86
  type: :runtime
86
87
  prerelease: false
87
88
  version_requirements: !ruby/object:Gem::Requirement
88
89
  requirements:
89
- - - ~>
90
+ - - "~>"
90
91
  - !ruby/object:Gem::Version
91
92
  version: '1.6'
92
93
  - !ruby/object:Gem::Dependency
93
94
  name: backports
94
95
  requirement: !ruby/object:Gem::Requirement
95
96
  requirements:
96
- - - ! '>='
97
+ - - ">="
97
98
  - !ruby/object:Gem::Version
98
99
  version: '0'
99
100
  type: :runtime
100
101
  prerelease: false
101
102
  version_requirements: !ruby/object:Gem::Requirement
102
103
  requirements:
103
- - - ! '>='
104
+ - - ">="
104
105
  - !ruby/object:Gem::Version
105
106
  version: '0'
106
107
  - !ruby/object:Gem::Dependency
107
108
  name: gh
108
109
  requirement: !ruby/object:Gem::Requirement
109
110
  requirements:
110
- - - ~>
111
+ - - "~>"
111
112
  - !ruby/object:Gem::Version
112
113
  version: '0.13'
113
114
  type: :runtime
114
115
  prerelease: false
115
116
  version_requirements: !ruby/object:Gem::Requirement
116
117
  requirements:
117
- - - ~>
118
+ - - "~>"
118
119
  - !ruby/object:Gem::Version
119
120
  version: '0.13'
120
121
  - !ruby/object:Gem::Dependency
121
122
  name: launchy
122
123
  requirement: !ruby/object:Gem::Requirement
123
124
  requirements:
124
- - - ~>
125
+ - - "~>"
125
126
  - !ruby/object:Gem::Version
126
127
  version: '2.1'
127
128
  type: :runtime
128
129
  prerelease: false
129
130
  version_requirements: !ruby/object:Gem::Requirement
130
131
  requirements:
131
- - - ~>
132
+ - - "~>"
132
133
  - !ruby/object:Gem::Version
133
134
  version: '2.1'
134
135
  - !ruby/object:Gem::Dependency
135
136
  name: pry
136
137
  requirement: !ruby/object:Gem::Requirement
137
138
  requirements:
138
- - - <
139
+ - - "<"
139
140
  - !ruby/object:Gem::Version
140
141
  version: '0.10'
141
- - - ~>
142
+ - - "~>"
142
143
  - !ruby/object:Gem::Version
143
144
  version: '0.9'
144
145
  type: :runtime
145
146
  prerelease: false
146
147
  version_requirements: !ruby/object:Gem::Requirement
147
148
  requirements:
148
- - - <
149
+ - - "<"
149
150
  - !ruby/object:Gem::Version
150
151
  version: '0.10'
151
- - - ~>
152
+ - - "~>"
152
153
  - !ruby/object:Gem::Version
153
154
  version: '0.9'
154
155
  - !ruby/object:Gem::Dependency
155
156
  name: typhoeus
156
157
  requirement: !ruby/object:Gem::Requirement
157
158
  requirements:
158
- - - ~>
159
+ - - "~>"
159
160
  - !ruby/object:Gem::Version
160
161
  version: '0.6'
161
- - - ! '>='
162
+ - - ">="
162
163
  - !ruby/object:Gem::Version
163
164
  version: 0.6.8
164
165
  type: :runtime
165
166
  prerelease: false
166
167
  version_requirements: !ruby/object:Gem::Requirement
167
168
  requirements:
168
- - - ~>
169
+ - - "~>"
169
170
  - !ruby/object:Gem::Version
170
171
  version: '0.6'
171
- - - ! '>='
172
+ - - ">="
172
173
  - !ruby/object:Gem::Version
173
174
  version: 0.6.8
174
175
  - !ruby/object:Gem::Dependency
175
176
  name: pusher-client
176
177
  requirement: !ruby/object:Gem::Requirement
177
178
  requirements:
178
- - - ~>
179
+ - - "~>"
179
180
  - !ruby/object:Gem::Version
180
181
  version: '0.4'
181
182
  type: :runtime
182
183
  prerelease: false
183
184
  version_requirements: !ruby/object:Gem::Requirement
184
185
  requirements:
185
- - - ~>
186
+ - - "~>"
186
187
  - !ruby/object:Gem::Version
187
188
  version: '0.4'
188
189
  - !ruby/object:Gem::Dependency
189
190
  name: addressable
190
191
  requirement: !ruby/object:Gem::Requirement
191
192
  requirements:
192
- - - ~>
193
+ - - "~>"
193
194
  - !ruby/object:Gem::Version
194
195
  version: '2.3'
195
196
  type: :runtime
196
197
  prerelease: false
197
198
  version_requirements: !ruby/object:Gem::Requirement
198
199
  requirements:
199
- - - ~>
200
+ - - "~>"
200
201
  - !ruby/object:Gem::Version
201
202
  version: '2.3'
202
203
  - !ruby/object:Gem::Dependency
203
204
  name: rspec
204
205
  requirement: !ruby/object:Gem::Requirement
205
206
  requirements:
206
- - - ~>
207
+ - - "~>"
207
208
  - !ruby/object:Gem::Version
208
209
  version: '2.12'
209
210
  type: :development
210
211
  prerelease: false
211
212
  version_requirements: !ruby/object:Gem::Requirement
212
213
  requirements:
213
- - - ~>
214
+ - - "~>"
214
215
  - !ruby/object:Gem::Version
215
216
  version: '2.12'
216
217
  - !ruby/object:Gem::Dependency
217
218
  name: sinatra
218
219
  requirement: !ruby/object:Gem::Requirement
219
220
  requirements:
220
- - - ~>
221
+ - - "~>"
221
222
  - !ruby/object:Gem::Version
222
223
  version: '1.3'
223
224
  type: :development
224
225
  prerelease: false
225
226
  version_requirements: !ruby/object:Gem::Requirement
226
227
  requirements:
227
- - - ~>
228
+ - - "~>"
228
229
  - !ruby/object:Gem::Version
229
230
  version: '1.3'
230
231
  - !ruby/object:Gem::Dependency
231
232
  name: rack-test
232
233
  requirement: !ruby/object:Gem::Requirement
233
234
  requirements:
234
- - - ~>
235
+ - - "~>"
235
236
  - !ruby/object:Gem::Version
236
237
  version: '0.6'
237
238
  type: :development
238
239
  prerelease: false
239
240
  version_requirements: !ruby/object:Gem::Requirement
240
241
  requirements:
241
- - - ~>
242
+ - - "~>"
242
243
  - !ruby/object:Gem::Version
243
244
  version: '0.6'
244
245
  description: CLI and Ruby client library for Travis CI
@@ -251,8 +252,8 @@ email:
251
252
  - p.morsou@gmail.com
252
253
  - peter.van.dijk@netherlabs.nl
253
254
  - i.am@anhero.ru
254
- - meyer@paperplanes.de
255
255
  - me@xjunior.me
256
+ - meyer@paperplanes.de
256
257
  - dev+narwen+rkh@rkh.im
257
258
  - jlambert@eml.cc
258
259
  - adrien.brault@gmail.com
@@ -261,6 +262,7 @@ email:
261
262
  - mario@mariovisic.com
262
263
  - miro@hroncok.cz
263
264
  - neamar@neamar.fr
265
+ - nbessi@users.noreply.github.com
264
266
  - drogus@gmail.com
265
267
  - raphael.pinson@camptocamp.com
266
268
  - tw@cloudcontrol.de
@@ -312,8 +314,6 @@ files:
312
314
  - assets/travis.sh
313
315
  - assets/travis.sh.erb
314
316
  - bin/travis
315
- - examples/cli/encrypt_file.md
316
- - examples/cli/private_dependencies.md
317
317
  - examples/org_overview.rb
318
318
  - examples/pro_auth.rb
319
319
  - examples/stream.rb
@@ -469,18 +469,19 @@ require_paths:
469
469
  - lib
470
470
  required_ruby_version: !ruby/object:Gem::Requirement
471
471
  requirements:
472
- - - ! '>='
472
+ - - ">="
473
473
  - !ruby/object:Gem::Version
474
474
  version: '0'
475
475
  required_rubygems_version: !ruby/object:Gem::Requirement
476
476
  requirements:
477
- - - ! '>'
477
+ - - ">="
478
478
  - !ruby/object:Gem::Version
479
- version: 1.3.1
479
+ version: '0'
480
480
  requirements: []
481
481
  rubyforge_project:
482
- rubygems_version: 2.3.0
482
+ rubygems_version: 2.2.2
483
483
  signing_key:
484
484
  specification_version: 4
485
485
  summary: Travis CI client
486
486
  test_files: []
487
+ has_rdoc:
@@ -1,88 +0,0 @@
1
- ## Encrypt a file
2
-
3
- ### Automated
4
-
5
- Assumptions:
6
-
7
- * The repository is set up on Travis CI
8
- * You have version **1.7.0** or later of the Travis CI Command Line Client installed and setup up (you are logged in)
9
- * You have a local copy of the repository and a terminal open where your current working directory is said copy
10
- * In the repository is a file, called super_secret.txt, that you need on Travis CI but you don't want to publish its content on GitHub.
11
-
12
- You can encrypt the file with the following command:
13
-
14
- ``` console
15
- $ travis encrypt-file super_secret.txt --add
16
- encrypting bacon.txt for rkh/travis-encrypt-file-example
17
- storing result as super_secret.txt.enc
18
- storing secure env variables for decryption
19
-
20
- Make sure to add super_secret.txt.enc to the git repository.
21
- Make sure not to add super_secret.txt to the git repository.
22
- Commit all changes to your .travis.yml.
23
- ```
24
-
25
- ### Manually
26
-
27
- Assumptions:
28
-
29
- * The repository is set up on Travis CI
30
- * You have the recent version of the Travis CI Command Line Client installed and setup up (you are logged in)
31
- * You have a local copy of the repository and a terminal open where your current working directory is said copy
32
- * In the repository is a file, called super_secret.txt, that you need on Travis CI but you don't want to publish its content on GitHub.
33
-
34
- The file might be too large to encrypt it directly via the `travis encrypt` command. However, you can encrypt the file using a passphrase and then encrypt the passphrase. On Travis CI, you can use the passphrase to decrypt the file again.
35
-
36
- The set up process looks like this:
37
-
38
- 1. **Come up with a password.** First, you need a password. We recommend generating a random password using a tool like pwgen or 1password. In our example we will use `ahduQu9ushou0Roh`.
39
- 2. **Encrypt the password and add it to your .travis.yml.** Here we can use the `encrypt` command: `travis encrypt super_secret_password=ahduQu9ushou0Roh --add` - note that if you set this up multiple times for multiple files, you will have to use different variable names so the passwords don't override each other.
40
- 3. **Encrypt the file locally.** Using a tool that you have installed locally and that is also installed on Travis CI (see below).
41
- 4. **Set up decryption command.** You should add the command for decrypting the file to the `before_install` section of your `.travis.yml` (see below).
42
-
43
- Be sure to add `super_secret.txt` to your `.gitignore` list, and to commit both the encrypted file and your `.travis.yml` changes.
44
-
45
- #### Using GPG
46
-
47
- Set up:
48
-
49
- ``` console
50
- $ travis encrypt super_secret_password=ahduQu9ushou0Roh --add
51
- $ gpg -c super_secret.txt
52
- (will prompt you for the password twice, use the same value as for super_secret_password above)
53
- ```
54
-
55
- Contents of the `.travis.yml` (besides whatever else you might have in there):
56
-
57
- ``` yaml
58
- env:
59
- global:
60
- secure: ... encoded secret ...
61
- before_install:
62
- - echo $super_secret_password | gpg super_secret.txt.gpg
63
- ````
64
-
65
- The encrypted file is called `super_secret.txt.gpg` and has to be committed to the repository.
66
-
67
- #### Using OpenSSL
68
-
69
-
70
- Set up:
71
-
72
- ``` console
73
- $ travis encrypt super_secret_password=ahduQu9ushou0Roh --add
74
- $ openssl aes-256-cbc -k "ahduQu9ushou0Roh" -in super_secret.txt -out super_secret.txt.enc
75
- (keep in mind to replace the password with the proper value)
76
- ```
77
-
78
- Contents of the `.travis.yml` (besides whatever else you might have in there):
79
-
80
- ``` yaml
81
- env:
82
- global:
83
- secure: ... encoded secret ...
84
- before_install:
85
- - openssl aes-256-cbc -k "$super_secret_password" -in super_secret.txt.enc -out super_secret.txt -d
86
- ````
87
-
88
- The encrypted file is called `super_secret.txt.enc` and has to be committed to the repository.
@@ -1,253 +0,0 @@
1
- ## Private Dependencies
2
-
3
- When testing a private repository, you might need to pull in other private repositories as dependencies. Whether it's via [git submodules](http://git-scm.com/book/en/Git-Tools-Submodules), a custom script, or a dependency management tool, like [Bundler](http://bundler.io/) or [Composer](https://getcomposer.org/).
4
-
5
- If the dependency is also on GitHub, there are four different ways of being able to fetch the repository from within a Travis CI VM:
6
-
7
- Authentication | Protocol | Gives access to | Notes
8
- -------------------------------|----------|------------------------------|--------------------------------------
9
- **[Deploy Key](#deploy-key)** | SSH | single repository | used by default for main repository
10
- **[User Key](#user-key)** | SSH | all repos user has access to | **recommended** for dependencies
11
- **[Password](#password)** | HTTPS | all repos user has access to | password can be encrypted
12
- **[API token](#api-token)** | HTTPS | all repos user has access to | token can be encrypted
13
-
14
- For the SSH protocol, dependency URLs need to have the format of `git@github.com/…` whereas for the HTTPS protocol, they need to start with `https://…`.
15
-
16
- You can use a [dedicated CI user account](#dedicated-user-account) for all but the deploy key approach. This will allow you to limit the access to a well defined list of repositories and read access only.
17
-
18
- ### Deploy Key
19
-
20
- GitHub allows to set up read-only SSH keys for a repository. These deploy keys have some great advantages:
21
-
22
- * They are not bound to a user account, so they will not get invalidated by removing users from a repository.
23
- * They do not give access to other, unrelated repositories.
24
- * Deploy keys only have read access.
25
- * The same key can be used for dependencies not stored on GitHub.
26
-
27
- However, using deploy keys is complicated by the fact that GitHub does not allow you to reuse keys. So a single private key cannot access multiple GitHub repositories.
28
-
29
- You could include a different private key for every dependency in the repository, possibly [encrypting them](encrypt_file.md). Maintaining complex dependency graphs this way can be complex and hard to maintain. For that reason, we recommend using a [user key](#user-key) instead.
30
-
31
- ### User Key
32
-
33
- You can add SSH keys to user accounts on GitHub. Most users have probably already done this to be able to clone the repositories locally.
34
-
35
- This way, a single key can access multiple repositories. To limit the list of repositories and type of access, it is recommended to create a [dedicated CI user account](#dedicated-user-account).
36
-
37
- #### Using an existing key
38
-
39
- Assumptions:
40
-
41
- * The repository you are running the builds for is called "myorg/main" and depends on "myorg/lib1" and "myorg/lib2".
42
- * You have a key already set up on your machine, for instance under `~/.ssh/id_rsa` (default on Unix systems).
43
-
44
- You can use the following command to add the key to Travis CI:
45
-
46
- ``` console
47
- $ travis sshkey --upload ~/.ssh/id_rsa -r myorg/main
48
- Key description: Key to clone myorg/lib1 and myorg/lib2
49
- updating ssh key for myorg/main with key from ~/.ssh/id_rsa
50
- Current SSH key: Key to clone myorg/lib1 and myorg/lib2
51
- ```
52
-
53
- You can omit the `-r myorg/main` if your current working directory is a clone of the "myorg/main" repository.
54
-
55
- #### Generating a new key
56
-
57
- Assumptions:
58
-
59
- * The repository you are running the builds for is called "myorg/main" and depends on "myorg/lib1" and "myorg/lib2".
60
- * You know the credentials for a user account that has at least read access to all three repositories.
61
-
62
- The `travis` command line tool can generate a new key for you and set it up on both Travis CI and GitHub. In order to do so, it will ask you for a GitHub user name and password This is very handy if you have just created a [dedicated user](#dedicated-user-account) or if you don't have a key set up on your machine that you want to use.
63
-
64
- The credentials will only be used to access GitHub and will not be stored or shared with any other service.
65
-
66
- ``` console
67
- $ travis sshkey --generate -r myorg/main
68
- We need the GitHub login for the account you want to add the key to.
69
- This information will not be sent to Travis CI, only to api.github.com.
70
- The password will not be displayed.
71
-
72
- Username: ci-user
73
- Password for ci-user: **************
74
-
75
- Generating RSA key.
76
- Uploading public key to GitHub.
77
- Uploading private key to Travis CI.
78
-
79
- You can store the private key to reuse it for other repositories (travis sshkey --upload FILE).
80
- Store private key? |no|
81
-
82
- Current SSH key: key for fetching dependencies for myorg/main
83
- ```
84
-
85
- You can omit the `-r myorg/main` if your current working directory is a clone of the "myorg/main" repository.
86
-
87
- At the end of the process, it will ask you whether you want to store the generated key somewhere, usually it is safe to say "no" here. After all, you can just generate a new key as necessary. See [below](#reusing-a-generated-key) for instructions on storing and reusing a generated key.
88
-
89
- #### Reusing a generated key
90
-
91
- Assumptions:
92
-
93
- * The repository you are running the builds for is called "myorg/main" and depends on "myorg/lib1" and "myorg/lib2".
94
- * You know the credentials for a user account that has at least read access to all three repositories.
95
- * You only want to generate a single key, so you can revoke it easily or use it for accessing other sourced for dependencies or deploy targets.
96
-
97
- This is absolutely optional, nothing keeps you from generating new keys for all the repositories you are testing.
98
-
99
- You follow the [steps above](#generating-a-new-key), but choose to store the key. It will ask you for a path to store it under.
100
-
101
- ``` console
102
- $ travis sshkey --generate -r myorg/main --description "CI dependencies"
103
- We need the GitHub login for the account you want to add the key to.
104
- This information will not be sent to Travis CI, only to api.github.com.
105
- The password will not be displayed.
106
-
107
- Username: ci-user
108
- Password for ci-user: **************
109
-
110
- Generating RSA key.
111
- Uploading public key to GitHub.
112
- Uploading private key to Travis CI.
113
-
114
- You can store the private key to reuse it for other repositories (travis sshkey --upload FILE).
115
- Store private key? |no| yes
116
- Path: |id_travis_rsa| myorg_key
117
-
118
- Current SSH key: CI dependencies
119
- ```
120
-
121
- And as always, you can omit the `-r myorg/main` if your current working directory is a clone of the "myorg/main" repository.
122
-
123
- You can then [upload](#using-an-existing-key) the key for myorg/main2:
124
-
125
- ``` console
126
- $ travis sshkey --upload myorg_key -r myorg/main2 --description "CI dependencies"
127
- updating ssh key for myorg/main with key from myorg_key
128
- Current SSH key: CI dependencies
129
- ```
130
-
131
- Starting with the 1.7.0 release of the `travis` command line tool, you are able to combine it with the `repos` command to set up the key not only for for "main" and "main2", but all repositories under the "myorg" organization.
132
-
133
- ``` console
134
- $ travis repos --active --owner myorg --pro | xargs -I % travis sshkey --upload myorg_key -r % --description "CI dependencies"
135
- updating ssh key for myorg/main with key from myorg_key
136
- Current SSH key: CI dependencies
137
- updating ssh key for myorg/main2 with key from myorg_key
138
- Current SSH key: CI dependencies
139
- updating ssh key for myorg/lib1 with key from myorg_key
140
- Current SSH key: CI dependencies
141
- updating ssh key for myorg/lib2 with key from myorg_key
142
- Current SSH key: CI dependencies
143
- ```
144
-
145
- ### Password
146
-
147
- Assumptions:
148
-
149
- * The repository you are running the builds for is called "myorg/main" and depends on "myorg/lib1" and "myorg/lib2".
150
- * You know the credentials for a user account that has at least read access to all three repositories.
151
- * You have a clone of the repository locally and run commands from a terminal where the copy is the current working directory (this is needed to make `travis encrypt --add` work).
152
-
153
- To pull in dependencies with a password, you will have to use the user name and password in the Git HTTPS URL: `https://ci-user:mypassword123@github.com/myorg/lib1.git`.
154
-
155
- Alternatively, you can also write the credentials to the `~.netrc` file:
156
-
157
- ``` netrc
158
- machine github.com
159
- login ci-user
160
- password mypassword123
161
- ```
162
-
163
- You can also encrypt the password and then write it to the netrc in a `before_install` step in your `.travis.yml`.
164
-
165
- ``` console
166
- $ travis encrypt CI_USER_PASSWORD=mypassword123 --add
167
- ```
168
-
169
- ``` yaml
170
- before_install:
171
- - echo "machine github.com\n login ci-user\n password $CI_USER_PASSWORD" >> ~/.netrc
172
- ```
173
-
174
- It is also possible to inject the credentials into URLs, for instance, in a Gemfile, it would look like this:
175
-
176
- ``` ruby
177
- source 'https://rubygems.org'
178
- gemspec
179
-
180
- if ENV['CI']
181
- # use HTTPS with password on Travis CI
182
- git_source :github do |repo_name|
183
- repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
184
- "https://ci-user:#{ENV.fetch("CI_USER_PASSWORD")}@github.com/#{repo_name}.git"
185
- end
186
- end
187
-
188
- gem 'lib1', github: "myorg/lib1"
189
- gem 'lib2', github: "myorg/lib2"
190
- ```
191
-
192
- ### API token
193
-
194
- Assumptions:
195
-
196
- * The repository you are running the builds for is called "myorg/main" and depends on "myorg/lib1" and "myorg/lib2".
197
- * You know the credentials for a user account that has at least read access to all three repositories.
198
- * You have a clone of the repository locally and run commands from a terminal where the copy is the current working directory (this is needed to make `travis encrypt --add` work).
199
-
200
- This approach works just like the [password](#password) approach outlined above, except instead of the username/password pair, you use a GitHub API token.
201
-
202
- Under the GitHub account settings for the user you want to use, navigate to [Applications](https://github.com/settings/applications) and generate a "personal access tokens". Make sure the token has the "repo" scope.
203
-
204
- Your `~/.netrc` should look like this:
205
-
206
- ``` netrc
207
- machine github.com
208
- login the-generated-token
209
- ```
210
-
211
- You can also use it in URLs directly: `https://the-generated-token@github.com/myorg/lib1.git`.
212
-
213
- Use the `encrypt` command to add the token to your `.travis.yml`.
214
-
215
- ``` console
216
- $ travis encrypt CI_USER_TOKEN=the-generated-token --add
217
- ```
218
-
219
- You can then have Travis CI write to the `~/.netrc` on every build.
220
-
221
- ``` yaml
222
- before_install:
223
- - echo "machine github.com\n login $CI_USER_TOKEN" >> ~/.netrc
224
- ```
225
-
226
- It is also possible to inject the token into URLs, for instance, in a Gemfile, it would look like this:
227
-
228
- ``` ruby
229
- source 'https://rubygems.org'
230
- gemspec
231
-
232
- if ENV['CI']
233
- # use HTTPS with token on Travis CI
234
- git_source :github do |repo_name|
235
- repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
236
- "https://#{ENV.fetch("CI_USER_TOKEN")}@github.com/#{repo_name}.git"
237
- end
238
- end
239
-
240
- gem 'lib1', github: "myorg/lib1"
241
- gem 'lib2', github: "myorg/lib2"
242
- ```
243
-
244
- ### Dedicated User Account
245
-
246
- As mentioned a few times, it might make sense to create a dedicated CI user for the following reasons:
247
-
248
- * The CI user will only have access to the repositories you want it to have access to.
249
- * You can limit the access to read access.
250
- * Less risk when it comes to leaking keys or credentials.
251
- * The CI user will not leave the organization for non-technical reasons and accidentally break all your builds.
252
-
253
- In order to do so, you need to register on GitHub as if you would be signing up for a normal user (pro tip: try using incognito mode in your browser, so you don't have to sign out of your main account). Registering users cannot be automated, since that would violate the GitHub Terms of Service.