kitchen-google-as 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7d476089e5f81028413e311b43c4d3be73567a72
4
+ data.tar.gz: 3d65ff6b6e53edf47c57caf483eae25ae39ff659
5
+ SHA512:
6
+ metadata.gz: 081fa3dd780ac6441cc54288fe2666353816f585397ffb9087b0efba6f41488b8154ac7d3f12326864f5576f7b0aaa44660c1541b089e7aba1a1615dcc1dde75
7
+ data.tar.gz: 1b394323b49b9841b2cb47ffdf76630661b8c63a5a10ca0f496bcd98fdf2ac653c514d4612fab1dc1969dc6ea4b91ecdcea398145c8be0f1f0ba26301e3164cb
@@ -0,0 +1,5 @@
1
+ *~
2
+ *#
3
+ .ruby-version
4
+ *.gem
5
+ Gemfile.lock
@@ -0,0 +1 @@
1
+ inherit_from: .rubocop_todo.yml
@@ -0,0 +1,11 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2014-09-20 08:00:47 -0700 using RuboCop version 0.26.0.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ # Offense count: 1
9
+ # Configuration parameters: CountComments.
10
+ Metrics/ClassLength:
11
+ Max: 102
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+ - 2.1.0
6
+ - 2.2
7
+
8
+ before_install:
9
+ - gem update bundler
@@ -0,0 +1,97 @@
1
+ ## 1.1.0 / 2016-03-17
2
+
3
+ * #32: Rubocop and Rake fixes to address Travis test issues
4
+ * #33: Automatically disable auto-restart and auto-migrate when using preemptible instances
5
+ * #34: Support for using subnetworks
6
+ * #35: Support for gcloud-style image aliases (i.e. "centos-7" will get you the latest CentOS image)
7
+
8
+ ## 1.0.0 / 2016-03-10
9
+
10
+ ### New Features
11
+
12
+ * #30: use of gcloud authentication files instead of requiring new service accounts
13
+ * #30: support for service account scope aliases in addition to regular full names/URLs
14
+ * #30: support for automated public project searching for well-known disk images
15
+
16
+ ### Improvements
17
+
18
+ * #30: rewrite using the google-api-client
19
+ * #30: use of the new Test Kitchen 1.4+ transport plugins
20
+ * #30: additional user feedback during API interactions
21
+
22
+ ## 0.3.0 / 2016-01-23
23
+
24
+ ### New Features
25
+
26
+ * #14: Support service_accounts option in Fog
27
+ * #22: Add JSON credential file and Preemptible VM support
28
+
29
+ ### Improvements
30
+
31
+ * Move to test-kitchen GitHub org
32
+ * Fixes to tests
33
+
34
+ ## 0.2.0 / 2014-09-20
35
+
36
+ ### Improvements
37
+
38
+ * #10: Deprecate "area" in configuration for "region"
39
+ * #11: Fix name length, via @pdunnavant
40
+ * #12: Generate instance names that are valid for GCE
41
+
42
+ ## 0.1.2 / 2014-04-16
43
+
44
+ ### New Features
45
+
46
+ * Add documentation for new asia-east1 region.
47
+
48
+ ### Improvements
49
+
50
+ * #9: Dependency updates: Remove faraday version constraint; require newer
51
+ ridley gem.
52
+
53
+ ## 0.1.0 / 2014-03-29
54
+
55
+ ### New Features
56
+
57
+ * PR #7: Add support for specifying SSH keys in public_key_path, via @someara
58
+ * Add support for setting username
59
+ * Support GCE v1 API, including persistent disks.
60
+
61
+ ### Improvements
62
+
63
+ * Add rspec tests and Travis support.
64
+
65
+ ## 0.0.6 / 2014-02-23:
66
+
67
+ * Require Ruby 1.9 or greater.
68
+
69
+ ### Improvements
70
+
71
+ * Add support for specifying GCE network and tags.
72
+
73
+ ### Bug fixes
74
+
75
+ * Temporarily pin Fog version to 1.19.0 until 1.20.0 support is added.
76
+ * Require Faraday Gem version to be ~> 0.8.9; 0.9.0 breaks test-kitchen.
77
+
78
+ ## 0.0.4 / 2013-12-28
79
+
80
+ ### Bug fixes
81
+
82
+ * In GCE, instance names must be unique; derive by default from
83
+ `<suite>-<platform>` and a UUID.
84
+ * Fix bug where running `kitchen create` multiple times would create
85
+ duplicate instances.
86
+ * Require version of Fog with exponential backoff in GCE API queries.
87
+
88
+ ### Improvements
89
+
90
+ * README formatting and clarity fixes.
91
+ * Add concept of an "area" (us, europe, any) to automatically select
92
+ an availability zone from those that are up within the requested
93
+ area for each instance.
94
+
95
+ ## 0.0.1 / 2013-10-20
96
+
97
+ ### Initial release
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify dependencies in gemspec:
4
+ gemspec
5
+
6
+ gem "chefstyle", git: "https://github.com/chef/chefstyle"
data/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Author:: Andrew Leonard (<andy@hurricane-ridge.com>)
2
+
3
+ Copyright (C) 2013-2014, Andrew Leonard
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
@@ -0,0 +1,345 @@
1
+ # Kitchen::Gce - A Test Kitchen Driver for Google Compute Engine
2
+
3
+ [![Build Status](https://travis-ci.org/test-kitchen/kitchen-google.png?branch=master)](https://travis-ci.org/test-kitchen/kitchen-google)
4
+ [![Code Climate](https://codeclimate.com/github/test-kitchen/kitchen-google.png)](https://codeclimate.com/github/test-kitchen/kitchen-google)
5
+
6
+ This is a [Test Kitchen](https://github.com/opscode/test-kitchen/)
7
+ driver for Google Compute Engine. While similar to EC2 and other IaaS
8
+ providers, GCE has a couple of advantages for Chef cookbook testing:
9
+
10
+ * (Subjectively) faster instance launch times; and
11
+ * Sub-hour billing.
12
+
13
+ ## Requirements
14
+
15
+ ### Ruby Version
16
+
17
+ Ruby 2.0 or greater.
18
+
19
+ ### Google Cloud Platform (GCP) Project
20
+ A [Google Cloud Platform](https://cloud.google.com) account is
21
+ required. If you do not already have an appropriate "project" in
22
+ which to run your test-kitchen instances, create one, noting the
23
+ "project id".
24
+
25
+ ### Authentication and Authorization
26
+
27
+ The [underlying API](https://github.com/google/google-api-ruby-client) this plugin uses relies on the
28
+ [Google Auth Library](https://github.com/google/google-auth-library-ruby) to handle authentication to the
29
+ Google Cloud API. The auth library expects that there is a JSON credentials file located at:
30
+
31
+ `~/.config/gcloud/application_default_credentials.json`
32
+
33
+ The easiest way to create this is to download and install the [Google Cloud SDK](https://cloud.google.com/sdk/) and run the
34
+ `gcloud auth login` command which will create the credentials file for you.
35
+
36
+ If you already have a file you'd like to use that is in a different location, set the
37
+ `GOOGLE_APPLICATION_CREDENTIALS` environment variable with the full path to that file.
38
+
39
+ ### SSH Keys
40
+
41
+ In order to bootstrap Linux nodes, you will first need to ensure your SSH
42
+ keys are set up correctly. Ensure your SSH public key is properly entered
43
+ into your project's Metadata tab in the GCP Console. GCE will add your key
44
+ to the appropriate user's `~/.ssh/authorized_keys` file when Chef first
45
+ connects to perform the bootstrap process.
46
+
47
+ * If you don't have one, create a key using `ssh-keygen`
48
+ * Log in to the GCP console, select your project, go to Compute Engine, and go to the Metadata tab.
49
+ * Select the "SSH Keys" tab.
50
+ * Add a new item, and paste in your public key.
51
+ * Note: to change the username automatically detected for the key, prefix your key with the username
52
+ you plan to use to connect to a new instance. For example, if you plan to connect
53
+ as "chefuser", your key should look like: `chefuser:ssh-rsa AAAAB3N...`
54
+ * Click "Save".
55
+
56
+ Alternatively, the Google Cloud SDK (a.k.a. `gcloud`) will create a SSH key
57
+ for you when you create and access your first instance:
58
+
59
+ 1. Create a small test instance:
60
+ `gcloud compute instances create instance1 --zone us-central1-f --image debian-8 --machine-type g1-small`
61
+ 1. Ensure your SSH keys allow access to the new instance
62
+ `gcloud compute ssh instance1 --zone us-central1-f`
63
+ 1. Log out and delete the instance
64
+ `gcloud compute instances delete instance1 --zone us-central1-f`
65
+
66
+ You will now have a local SSH keypair, `~/.ssh/google_compute_engine[.pub]` that
67
+ will be used for connecting to your GCE Linux instances for this local username
68
+ when you use the `gcloud compute ssh` command. You can tell Test Kitchen to use
69
+ this key by adding it to the transport section of your .kitchen.yml:
70
+
71
+ ```yaml
72
+ transport:
73
+ ssh_key:
74
+ - ~/.ssh/google_compute_engine
75
+ ```
76
+
77
+ You can find [more information on configuring SSH keys](https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys) in
78
+ the Google Compute Engine documentation.
79
+
80
+ ## Installation
81
+
82
+ Install the gem with:
83
+
84
+ ```sh
85
+ gem install kitchen-google
86
+ ```
87
+
88
+ Or, even better, if you're using the ChefDK:
89
+
90
+ ```sh
91
+ chef gem install kitchen-google
92
+ ```
93
+
94
+ If you're using Bundler, simply add it to your Gemfile:
95
+
96
+ ```ruby
97
+ gem "kitchen-google", "~> 1.0"
98
+ ```
99
+
100
+ ... and then run `bundle install`.
101
+
102
+
103
+ ## Configuration
104
+
105
+ ### `project`
106
+
107
+ **Required**. The project ID of the GCP project into which Test Kitchen
108
+ instances will be launched. This can be found on the "Manage All Projects"
109
+ screen, found under the "Select a Project" drop-down at the top of the
110
+ GCP console.
111
+
112
+ Note that this parameter requires the "Project ID", not the "Project Name."
113
+
114
+ Example: "funky-penguin-12345"
115
+
116
+ ### `image_project`
117
+
118
+ The project ID of the GCP project to search for the configured image or image
119
+ family. This must be specified to find either public images or your own images
120
+ that exist in another project.
121
+
122
+ Example: "ubuntu-os-cloud"
123
+
124
+ ### `image_family`
125
+
126
+ The family of the image to initialize your boot disk from, the latest
127
+ non-deprecated image will be used.
128
+
129
+ Note that this parameter will be ignored if `image_name` is also specified.
130
+
131
+ Example: "ubuntu-1604-lts"
132
+
133
+ ### `image_name`
134
+
135
+ The name of the disk image to use as the source image for the boot disk.
136
+
137
+ Example: `centos-7-v20170124`
138
+
139
+ This parameter will override `image_family` if they are both specified.
140
+
141
+ If `image_project` is not specified, only the GCP project specified in `project`
142
+ will be searched.
143
+
144
+ ### `zone`
145
+
146
+ **Required if `region` is left blank.** The name of the GCE zone in which to
147
+ launch your instances.
148
+
149
+ Example: `us-east1-b`
150
+
151
+ ### `region`
152
+
153
+ **Required if zone is left blank.** The name of the region in which to
154
+ launch your instances. A zone in the region will be randomly selected.
155
+
156
+ Example: `us-central1`
157
+
158
+ This parameter will be ignored if `zone` is specified.
159
+
160
+ ### `autodelete_disk`
161
+
162
+ Boolean specifying whether or not to automatically delete boot disk
163
+ for test instance. Default: `true`
164
+
165
+ NOTE: If you set this to false, once Test Kitchen destroys your instance,
166
+ the boot disk used will remain in your project. You will need to manually delete it to
167
+ avoid consuming unused resources by either using the `gcloud compute disks delete`
168
+ command in the GCP SDK or by using `knife google disk delete` from
169
+ [knife-google](https://github.com/chef/knife-google).
170
+
171
+ ### `auto_migrate`
172
+
173
+ Boolean specifying whether or not to automatically migrate the instance
174
+ to a host in the event of host maintenance. Default: `false`
175
+
176
+ ### `disk_size`
177
+
178
+ Size, in gigabytes, of boot disk. Default: `10`.
179
+
180
+ Some images, such as windows images, have a larger source image size
181
+ and require the disk_size to be the same size or larger than the source.
182
+ An error message will be displayed to you indicating this requirement
183
+ if necessary.
184
+
185
+ ### `email`
186
+
187
+ **Required for Windows instances.** The email address of the
188
+ currently-logged-in GCP user.
189
+
190
+ While the credentials file specified in the Authentication and Authorization
191
+ section is used for all API interactions, the email address is required when
192
+ performing the necessary password reset prior to bootstrapping the instance.
193
+
194
+ ### `machine_type`
195
+
196
+ GCE instance type (size) to launch; default: `n1-standard-1`
197
+
198
+ ### `network`
199
+
200
+ GCE network that instance will be attached to; default: `default`
201
+
202
+ ### `subnet`
203
+
204
+ GCE subnetwork that instance will be attached to. Only applies to custom networks.
205
+
206
+ ### `preemptible`
207
+
208
+ If set to `true`, GCE instance will be brought up as a [preemptible](https://cloud.google.com/compute/docs/instances/preemptible) virtual machine,
209
+ that runs at a much lower price than normal instances. However, Compute
210
+ Engine might terminate (preempt) these instances if it requires access
211
+ to those resources for other tasks; default: `false`
212
+
213
+ ### `service_account_name`
214
+
215
+ The name of the service account to use when enabling account scopes. This
216
+ is usually an email-formatted service account name created via the "Permissions"
217
+ tab of the GCP console.
218
+
219
+ This is ignored unless you specify any `service_account_scopes`.
220
+
221
+ Default: "default"
222
+
223
+ ### `service_account_scopes`
224
+
225
+ An array of scopes to add to the instance, used to grant additional permissions
226
+ within GCP.
227
+
228
+ The scopes can either be a full URL (i.e. `https://www.googleapis.com/auth/devstorage.read_write`),
229
+ the short-name (i.e. `devstorage.read_write`), or a gcloud alias (i.e. `storage-rw`).
230
+
231
+ See the output of `gcloud compute instances create --help` for a full list of scopes.
232
+
233
+ ### `tags`
234
+
235
+ Array of tags to associate with instance; default: `[]`
236
+
237
+ ### `use_private_ip`
238
+
239
+ Boolean indicating whether or not to connect to the instance using its
240
+ private IP address. If `true`, kitchen-google will also not provision
241
+ a public IP for this instance. Default: `false`
242
+
243
+ ### `wait_time`
244
+
245
+ Amount of time, in seconds, to wait for any API interactions. Default: 600
246
+
247
+ ### `refresh_rate`
248
+
249
+ Amount of time, in seconds, to refresh the status of an API interaction. Default: 2
250
+
251
+ ### Transport Settings
252
+
253
+ Beginning with Test Kitchen 1.4, settings related to the transport (i.e. how to connect
254
+ to the instance) have been moved to the `transport` section of the config, such as the
255
+ username, password, SSH key path, etc.
256
+
257
+ Therefore, you will need to update the transport section with the username configured
258
+ for the SSH Key you imported into your project metadata as described in the "SSH Keys"
259
+ section above. For example, if you are connecting as the "chefuser", your .kitchen.yml
260
+ might have a section like this:
261
+
262
+ ```yaml
263
+ transport:
264
+ username: chefuser
265
+ ```
266
+
267
+ Additionally, if you do not wish to use the standard default SSH key (`~/.ssh/id_rsa`),
268
+ you can set the `ssh_key` parameter in the `transport` section of your .kitchen.yml.
269
+ For example, if you want to use the SSH key auto-generated by the GCP SDK:
270
+
271
+ ```yaml
272
+ transport:
273
+ ssh_key:
274
+ - ~/.ssh/google_compute_engine
275
+ ```
276
+
277
+ ## Example .kitchen.yml
278
+
279
+ ```yaml
280
+ ---
281
+ driver:
282
+ name: gce
283
+ project: mycompany-test
284
+ zone: us-east1-c
285
+ email: me@mycompany.com
286
+ tags:
287
+ - devteam
288
+ - test-kitchen
289
+ service_account_scopes:
290
+ - devstorage.read_write
291
+ - userinfo.email
292
+
293
+ provisioner:
294
+ name: chef_zero
295
+
296
+ transport:
297
+ username: chefuser
298
+
299
+ platforms:
300
+ - name: centos-7
301
+ driver:
302
+ image_project: centos-cloud
303
+ image_name: centos-7-v20170124
304
+ - name: ubuntu-16.04
305
+ driver:
306
+ image_project: ubuntu-os-cloud
307
+ image_family: ubuntu-1604-lts
308
+ - name: windows
309
+ driver:
310
+ image_project: windows-cloud
311
+ image_name: windows-server-2012-r2-dc-v20170117
312
+ disk_size: 50
313
+
314
+ suites:
315
+ - name: default
316
+ run_list:
317
+ - recipe[gcetest::default]
318
+ attributes:
319
+ ```
320
+
321
+ ## Development
322
+
323
+ Source is hosted on [GitHub](https://github.com/test-kitchen/kitchen-google).
324
+
325
+ * Pull requests are welcome, using topic branches if possible:
326
+
327
+ 1. Fork the repo.
328
+ 2. Create a feature branch, commit changes to it and push them.
329
+ 3. Submit a pull request.
330
+
331
+ * Report issues or submit feature requests on [GitHub](https://github.com/test-kitchen/kitchen-google/issues)
332
+
333
+ ## Author, Acknowledgements, Etc.
334
+
335
+ Created and maintained by [Andrew Leonard](http://andyleonard.com)
336
+ ([andy@hurricane-ridge.com](mailto:andy@hurricane-ridge.com)).
337
+
338
+ The initial release drew heavily on the
339
+ [kitchen-ec2](https://github.com/opscode/kitchen-ec2/) gem for both
340
+ inspiration and implementation details. Any bugs, however, are solely
341
+ the author's own doing.
342
+
343
+ ## License
344
+
345
+ Licensed under Apache 2.0.