kitchen-linode 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
- source "http://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
2
4
 
3
5
  gemspec
data/README.md CHANGED
@@ -1,59 +1,70 @@
1
- # <a name="title"></a> Kitchen::Linode
1
+ # Kitchen::Linode
2
2
  [![Gem](https://img.shields.io/gem/v/kitchen-linode.svg)](https://rubygems.org/gems/kitchen-linode)
3
3
  [![Gem](https://img.shields.io/gem/dt/kitchen-linode.svg)](https://rubygems.org/gems/kitchen-linode)
4
4
  [![Gem](https://img.shields.io/gem/dtv/kitchen-linode.svg)](https://rubygems.org/gems/kitchen-linode)
5
5
  [![Code Climate](https://codeclimate.com/github/ssplatt/kitchen-linode/badges/gpa.svg)](https://codeclimate.com/github/ssplatt/kitchen-linode)
6
6
  [![Test Coverage](https://codeclimate.com/github/ssplatt/kitchen-linode/badges/coverage.svg)](https://codeclimate.com/github/ssplatt/kitchen-linode/coverage)
7
- [![Build Status](https://travis-ci.org/ssplatt/kitchen-linode.svg?branch=master)](https://travis-ci.org/ssplatt/kitchen-linode)
7
+ [![CI](https://github.com/ssplatt/kitchen-linode/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/ssplatt/kitchen-linode/actions/workflows/ci.yml)
8
8
 
9
9
  A Test Kitchen Driver for [Linode](http://www.linode.com).
10
10
 
11
11
  [![asciicast](https://asciinema.org/a/44348.png)](https://asciinema.org/a/44348)
12
12
 
13
- ## <a name="requirements"></a> Requirements
13
+ ## Requirements
14
14
 
15
- Requires [Test Kitchen](http://kitchen-ci.org) and a [Linode](http://www.linode.com) account.
16
- ```
15
+ Requires [Test Kitchen](https://kitchen.ci/) and a [Linode](http://www.linode.com) account.
16
+
17
+ ```sh
17
18
  gem install test-kitchen
18
19
  ```
19
20
 
20
- ## <a name="installation"></a> Installation and Setup
21
+ ## Installation and Setup
21
22
 
22
23
  The gem file is hosted at [RubyGems](https://rubygems.org/gems/kitchen-linode). To install the gem file, run:
23
- ```
24
+
25
+ ```sh
24
26
  gem install kitchen-linode
25
27
  ```
26
- Or, install with bundler if you have a Gemfile
28
+
29
+ Or, install with bundler if you have a Gemfile.
30
+
27
31
  Please read the [Driver usage][driver_usage] page for more details.
28
32
 
29
- ## <a name="config"></a> Configuration
33
+ ## Configuration
30
34
 
31
35
  For many of these, you can specify an ID number, a full name, or a partial name that will try to match something in the list but may not match exactly what you want.
32
- ```
33
- LINODE_API_KEY Linode API Key environment variable, default: nil
34
- :username ssh user name, default: "root"
35
- :password password for user, default: randomly generated hash
36
- :image Linux distribution, default: "Debian 8"
37
- :data_center data center, default: "Atlanta"
38
- :flavor linode type/amount of RAM, default: "Linode 1024"
39
- :payment_terms if you happen to have legacy, default: 1
40
- :kernel Linux kernel, default: "Latest 64 bit"
41
- :private_key_path Location of your private key file, default: "~/.ssh/id_rsa"
42
- :public_key_path Location of your public key file, default: "~/.ssh/id_rsa.pub"
43
- :ssh_timeout ssh timeout, default: 600 (seconds)
44
- :sudo use sudo, default: True
45
- :port ssh port, default: 22
46
- :server_name set the hostname and linode name
47
- ```
48
-
49
- ## <a name="usage"></a> Usage
50
36
 
51
- First, set your Linode API key in an environment variable:
52
- ```
53
- $ export LINODE_API_KEY='myrandomkey123123213h123bh12'
37
+ | Option | Env Var | Default | Description |
38
+ |-|-|-|-|
39
+ | `linode_token` | `LINODE_TOKEN` | none | Linode API token. Required. |
40
+ | `password` | `LINODE_PASSWORD` | Random UUID | Password for root. |
41
+ | `label` | none | Auto generated | Label for the server. |
42
+ | `tags` | none | `["kitchen"]` | List of tags to set on the server. |
43
+ | `hostname` | none | Label if provided, else kitchen instance name | The hostname of the server. |
44
+ | `image` | none | Kitchen platform name | Linode image. |
45
+ | `region` | `LINODE_REGION` | `us-east` | Linode region. |
46
+ | `type` | none | `g6-nanode-1` | Linode type. |
47
+ | `stackscript_id` | none | none | StackScript ID to provision the server with. |
48
+ | `stackscript_data` | none | none | StackScript data for user defined fields. |
49
+ | `swap_size` | none | none | Swap size in MB. |
50
+ | `private_ip` | none | `false` | Set to true to add a private IP to the server. |
51
+ | `authorized_users` | `LINODE_AUTH_USERS` | `[]` | List of authorized Linode users for seeding SSH keys. Environment variable should be a comma separated list of usernames. |
52
+ | `private_key_path` | `LINODE_PRIVATE_KEY` | `~/.ssh/id_rsa`, `~/.ssh/id_dsa`, `~/.ssh/identity`, or `~/.ssh/id_ecdsa`, whichever first exists. | Path to SSH private key that should be used to connect to the server. |
53
+ | `public_key_path` | none | Auto inferred based on the `private_key_path` | Path to SSH public key that should be installed on the server. |
54
+ | `disable_ssh_password` | none | `true` | When set to `true` and SSH keys are provided password auth for SSH is disabled. |
55
+ | `api_retries` | none | `5` | How many times to retry API calls on timeouts or rate limits. |
56
+
57
+ ## Usage
58
+
59
+ First, set your Linode API token in an environment variable:
60
+
61
+ ```sh
62
+ export LINODE_TOKEN='myrandomtoken123123213h123bh12'
54
63
  ```
64
+
55
65
  Then, create a .kitchen.yml file:
56
- ```
66
+
67
+ ```yaml
57
68
  ---
58
69
  driver:
59
70
  name: linode
@@ -67,53 +78,50 @@ provisioner:
67
78
  - vim
68
79
 
69
80
  platforms:
70
- - name: debian_jessie
81
+ - name: linode/debian10
71
82
 
72
83
  suites:
73
84
  - name: default
74
85
  ```
86
+
75
87
  then you're ready to run `kitchen test` or `kitchen converge`
88
+
89
+ ```sh
90
+ kitchen test
76
91
  ```
77
- $ kitchen test
78
- ```
79
- If you want to create a second yaml config; one for using Vagrant locally but another to use the Linode driver when run on your CI server, create a config with a name like `.kitchen-ci.yml`:
80
- ```
81
- ---
82
- driver:
83
- name: linode
84
92
 
85
- provisioner:
86
- name: salt_solo
87
- formula: vim
88
- state_top:
89
- base:
90
- "*":
91
- - vim
93
+ If you want to use Vagrant for local tests and Linode for CI tests then you can add the following to your `.kitchen.yml` to automatically switch the driver if the `LINODE_TOKEN` environment variable is set:
94
+
95
+ ```yaml
96
+ driver:
97
+ name: <%= ENV['LINODE_TOKEN'] ? 'linode' : 'vagrant' %>
92
98
 
93
99
  platforms:
94
- - name: debian_jessie
100
+ - name: debian-10
101
+ driver:
102
+ box: bento/debian-10
103
+ image: linode/debian10
95
104
 
96
105
  suites:
97
106
  - name: default
98
107
  ```
99
- Then you can run the second config by changing the KITCHEN_YAML environment variable:
100
- ```
101
- $ KITCHEN_YAML="./.kitchen-ci.yml" kitchen test
102
- ```
108
+
109
+ Note that both the `image` (linode) and the `box` (vagrant) options are supplied in the platform driver configuration.
110
+
103
111
  If you want to change any of the default settings, you can do so in the 'platforms' area:
104
- ```
105
- ...<snip>...
112
+
113
+ ```yaml
114
+ # ...<snip>...
106
115
  platforms:
107
- - name: debian_jessie
116
+ - name: ubuntu_lts
108
117
  driver:
109
- flavor: 2048
110
- data_center: Dallas
111
- kernel: 4.0.2-x86_64-linode56
112
- image: Debian 7
113
- ...<snip>...
118
+ type: g6-standard-2
119
+ region: eu-central
120
+ image: linode/ubuntu20.04
121
+ # ...<snip>...
114
122
  ```
115
123
 
116
- ## <a name="development"></a> Development
124
+ ## Development
117
125
 
118
126
  * Source hosted at [GitHub][repo]
119
127
  * Report issues/questions/feature requests on [GitHub Issues][issues]
@@ -128,17 +136,17 @@ example:
128
136
  4. Push to the branch (`git push origin my-new-feature`)
129
137
  5. Create new Pull Request
130
138
 
131
- ## <a name="authors"></a> Authors
139
+ ## Authors
132
140
 
133
141
  Created and maintained by [Brett Taylor][author] (<btaylor@linode.com>)
134
142
 
135
- ## <a name="license"></a> License
143
+ ## License
136
144
 
137
145
  Apache 2.0 (see [LICENSE][license])
138
146
 
139
147
 
140
- [author]: https://github.com/ssplatt
141
- [issues]: https://github.com/ssplatt/kitchen-linode/issues
142
- [license]: https://github.com/ssplatt/kitchen-linode/blob/master/LICENSE
143
- [repo]: https://github.com/ssplatt/kitchen-linode
144
- [driver_usage]: http://docs.kitchen-ci.org/drivers/usage
148
+ [author]: <https://github.com/ssplatt>
149
+ [issues]: <https://github.com/ssplatt/kitchen-linode/issues>
150
+ [license]: <https://github.com/ssplatt/kitchen-linode/blob/master/LICENSE>
151
+ [repo]: <https://github.com/ssplatt/kitchen-linode>
152
+ [driver_usage]: <https://kitchen.ci/docs/reference/configuration/>
data/Rakefile CHANGED
@@ -1,21 +1,25 @@
1
1
  require "bundler/gem_tasks"
2
- require 'cane/rake_task'
3
- require 'tailor/rake_task'
2
+ require "rspec/core/rake_task"
4
3
 
5
- desc "Run cane to check quality metrics"
6
- Cane::RakeTask.new do |cane|
7
- cane.canefile = './.cane'
4
+ desc "Run all specs in spec directory"
5
+ RSpec::Core::RakeTask.new(:test) do |t|
6
+ t.pattern = "spec/**/*_spec.rb"
8
7
  end
9
8
 
10
- Tailor::RakeTask.new
11
-
12
9
  desc "Display LOC stats"
13
10
  task :stats do
14
11
  puts "\n## Production Code Stats"
15
12
  sh "countloc -r lib"
16
13
  end
17
14
 
18
- desc "Run all quality tasks"
19
- task :quality => [:cane, :tailor, :stats]
15
+ begin
16
+ require "chefstyle"
17
+ require "rubocop/rake_task"
18
+ RuboCop::RakeTask.new(:style) do |task|
19
+ task.options += ["--display-cop-names", "--no-color"]
20
+ end
21
+ rescue LoadError
22
+ puts "chefstyle is not available. (sudo) gem install chefstyle to do style checking."
23
+ end
20
24
 
21
- task :default => [:quality]
25
+ task default: %i{test style}
@@ -1,28 +1,32 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'kitchen/driver/linode_version'
3
+ require "kitchen/driver/linode_version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = 'kitchen-linode'
6
+ spec.name = "kitchen-linode"
8
7
  spec.version = Kitchen::Driver::LINODE_VERSION
9
- spec.authors = ['Brett Taylor']
10
- spec.email = ['btaylor@linode.com']
11
- spec.description = 'A Test Kitchen Driver for Linode'
12
- spec.summary = 'A Test Kitchen Driver to use Linodes as your development environment'
13
- spec.homepage = 'https://github.com/ssplatt/kitchen-linode'
14
- spec.license = 'Apache-2.0'
8
+ spec.authors = ["Brett Taylor"]
9
+ spec.email = ["btaylor@linode.com"]
10
+ spec.description = "A Test Kitchen Driver for Linode"
11
+ spec.summary = "A Test Kitchen Driver to use Linodes as your development environment"
12
+ spec.homepage = "https://github.com/ssplatt/kitchen-linode"
13
+ spec.license = "Apache-2.0"
15
14
 
16
15
  spec.files = `git ls-files`.split($/)
17
16
  spec.executables = []
18
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ['lib']
18
+ spec.require_paths = ["lib"]
19
+ spec.required_ruby_version = ">= 2.6"
20
20
 
21
- spec.add_dependency 'test-kitchen', '~> 1.4'
22
- spec.add_dependency 'fog', '~> 1.34'
21
+ spec.add_dependency "fog-linode", "~> 0.0.1.rc2"
22
+ spec.add_dependency "retryable", ">= 2.0", "< 4.0"
23
+ spec.add_dependency "test-kitchen", ">= 1.4", "< 4"
23
24
 
24
- spec.add_development_dependency 'bundler', '~> 1.3'
25
- spec.add_development_dependency 'rake', '~> 10.4'
26
- spec.add_development_dependency 'rspec', '~> 3.4'
27
- spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.5'
25
+ spec.add_development_dependency "bundler"
26
+ spec.add_development_dependency "chefstyle", "= 2.2.2"
27
+ spec.add_development_dependency "countloc", "~> 0.4"
28
+ spec.add_development_dependency "rake"
29
+ spec.add_development_dependency "rspec", "~> 3.8"
30
+ spec.add_development_dependency "simplecov", "~> 0.9"
31
+ spec.add_development_dependency "webmock", "~> 3.5"
28
32
  end