kitchen-ec2 3.14.0 → 3.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kitchen/driver/aws/standard_platform/amazon2023.rb +51 -0
- data/lib/kitchen/driver/aws/standard_platform/centos.rb +1 -24
- data/lib/kitchen/driver/aws/standard_platform/macos.rb +51 -0
- data/lib/kitchen/driver/aws/standard_platform.rb +1 -0
- data/lib/kitchen/driver/ec2.rb +4 -1
- data/lib/kitchen/driver/ec2_version.rb +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 765177643e317a19c906f4d74bbeab0df60e3b24f40b56cf96cc1784511a2204
|
4
|
+
data.tar.gz: bdd75366f92fdfda91a3e6e07076cee7fc15eec5a4099bffb1e119d2abbe10c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae46afd545a7228e429ccfc23dc8e55ec1e1526853ba2977020934a2d394bf1beffe3006f9205f5a39f35704329a3d965c2fc65a828cc1d49e5e2fd89214eadb
|
7
|
+
data.tar.gz: 2ba5bbfb8c4bbc9ac2dfd827f427dfb4ecc42d548aa5e7c6926fbb2bdc1dfa52904b06f0a76cac1f03fb174513e2b604970540020ee7c3b1b684dedf329684b7
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: 2016-2018, Chef Software, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require_relative "../standard_platform"
|
17
|
+
|
18
|
+
module Kitchen
|
19
|
+
module Driver
|
20
|
+
class Aws
|
21
|
+
class StandardPlatform
|
22
|
+
# https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes.html
|
23
|
+
class Amazon2023 < StandardPlatform
|
24
|
+
StandardPlatform.platforms["amazon2023"] = self
|
25
|
+
|
26
|
+
# default username for this platform's ami
|
27
|
+
# @return [String]
|
28
|
+
def username
|
29
|
+
"ec2-user"
|
30
|
+
end
|
31
|
+
|
32
|
+
def image_search
|
33
|
+
search = {
|
34
|
+
"owner-id" => "137112412989",
|
35
|
+
"name" => version ? "al2023-ami-2023.0.#{version}*" : "al2023-ami-2023.0.*",
|
36
|
+
}
|
37
|
+
search["architecture"] = architecture if architecture
|
38
|
+
search
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.from_image(driver, image)
|
42
|
+
if /al2023-ami/i.match?(image.name)
|
43
|
+
image.name =~ /\b(\d+(\.\d+[\.\d])?)/i
|
44
|
+
new(driver, "amazon2023", (Regexp.last_match || [])[1], image.architecture)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -24,20 +24,10 @@ module Kitchen
|
|
24
24
|
StandardPlatform.platforms["centos"] = self
|
25
25
|
|
26
26
|
CENTOS_OWNER_ID = "125523088429".freeze
|
27
|
-
PRODUCT_CODES = {
|
28
|
-
"6" => "6x5jmcajty9edm3f211pqjfn2",
|
29
|
-
"7" => "aw0evgkw8e5c1q413zgy5pjce",
|
30
|
-
# It appears that v8 is not published to the
|
31
|
-
# AWS marketplace and hence does not have a product code
|
32
|
-
}.freeze
|
33
27
|
|
34
28
|
# default username for this platform's ami
|
35
29
|
# @return [String]
|
36
30
|
def username
|
37
|
-
# Centos 6.x images use root as the username (but the "centos 6"
|
38
|
-
# updateable image uses "centos")
|
39
|
-
return "root" if version && version.start_with?("6.")
|
40
|
-
|
41
31
|
"centos"
|
42
32
|
end
|
43
33
|
|
@@ -45,22 +35,9 @@ module Kitchen
|
|
45
35
|
# Version 8+ are published directly, not to the AWS marketplace. Use OWNER ID.
|
46
36
|
search = {
|
47
37
|
"owner-id" => CENTOS_OWNER_ID,
|
48
|
-
"name" => ["CentOS #{version}*", "CentOS-#{version}*-GA-*"],
|
38
|
+
"name" => ["CentOS #{version}*", "CentOS-#{version}*-GA-*", "CentOS Linux #{version}*", "CentOS Stream #{version}*"],
|
49
39
|
}
|
50
40
|
|
51
|
-
if version && version.split(".").first.to_i < 8
|
52
|
-
# Versions <8 are published to the AWS marketplace and use a different naming convention
|
53
|
-
search = {
|
54
|
-
"owner-alias" => "aws-marketplace",
|
55
|
-
"name" => ["CentOS Linux #{version}*", "CentOS-#{version}*-GA-*"],
|
56
|
-
}
|
57
|
-
# For versions published to aws-marketplace, additionally filter on product code to
|
58
|
-
# avoid non-official AMIs. Can't use CentOS owner ID here, as the owner ID is that of aws marketplace.
|
59
|
-
# https://github.com/test-kitchen/kitchen-ec2/issues/456
|
60
|
-
PRODUCT_CODES.keys.each do |major_version|
|
61
|
-
search["product-code"] = PRODUCT_CODES[major_version] if version.start_with?(major_version)
|
62
|
-
end
|
63
|
-
end
|
64
41
|
search["architecture"] = architecture if architecture
|
65
42
|
search
|
66
43
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: 2016-2018, Chef Software, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require_relative "../standard_platform"
|
17
|
+
|
18
|
+
module Kitchen
|
19
|
+
module Driver
|
20
|
+
class Aws
|
21
|
+
class StandardPlatform
|
22
|
+
class MacOS < StandardPlatform
|
23
|
+
StandardPlatform.platforms["macos"] = self
|
24
|
+
|
25
|
+
# default username for this platform's ami
|
26
|
+
# @return [String]
|
27
|
+
def username
|
28
|
+
"ec2-user"
|
29
|
+
end
|
30
|
+
|
31
|
+
def image_search
|
32
|
+
search = {
|
33
|
+
"owner-id" => "100343932686",
|
34
|
+
"name" => version ? "amzn-ec2-macos-#{version}*" : "amzn2-ec2-macos-*",
|
35
|
+
}
|
36
|
+
search["architecture"] = architecture if architecture
|
37
|
+
search["architecture"] = "arm64_mac" if architecture == "arm64"
|
38
|
+
search
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.from_image(driver, image)
|
42
|
+
if /amzn-ec2-macos/i.match?(image.name)
|
43
|
+
image.name =~ /\b(\d+(\.\d+[\.\d])?)/i
|
44
|
+
new(driver, "macos", (Regexp.last_match || [])[1], image.architecture)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/lib/kitchen/driver/ec2.rb
CHANGED
@@ -26,11 +26,13 @@ require_relative "aws/instance_generator"
|
|
26
26
|
require_relative "aws/standard_platform"
|
27
27
|
require_relative "aws/standard_platform/amazon"
|
28
28
|
require_relative "aws/standard_platform/amazon2"
|
29
|
+
require_relative "aws/standard_platform/amazon2023"
|
29
30
|
require_relative "aws/standard_platform/centos"
|
30
31
|
require_relative "aws/standard_platform/debian"
|
31
32
|
require_relative "aws/standard_platform/rhel"
|
32
33
|
require_relative "aws/standard_platform/fedora"
|
33
34
|
require_relative "aws/standard_platform/freebsd"
|
35
|
+
require_relative "aws/standard_platform/macos"
|
34
36
|
require_relative "aws/standard_platform/ubuntu"
|
35
37
|
require_relative "aws/standard_platform/windows"
|
36
38
|
require "aws-sdk-ec2"
|
@@ -79,6 +81,7 @@ module Kitchen
|
|
79
81
|
default_config :aws_secret_access_key, nil
|
80
82
|
default_config :aws_session_token, nil
|
81
83
|
default_config :aws_ssh_key_id, ENV["AWS_SSH_KEY_ID"]
|
84
|
+
default_config :aws_ssh_key_type, "rsa"
|
82
85
|
default_config :image_id, &:default_ami
|
83
86
|
default_config :image_search, nil
|
84
87
|
default_config :username, nil
|
@@ -853,7 +856,7 @@ module Kitchen
|
|
853
856
|
# to rapidly exhaust local entropy by creating a lot of keys. So this is
|
854
857
|
# probably fine. If you want very high security, probably don't use this
|
855
858
|
# feature anyway.
|
856
|
-
resp = ec2.client.create_key_pair(key_name: "kitchen-#{name_parts.join("-")}")
|
859
|
+
resp = ec2.client.create_key_pair(key_name: "kitchen-#{name_parts.join("-")}", key_type: config[:aws_ssh_key_type])
|
857
860
|
state[:auto_key_id] = resp.key_name
|
858
861
|
info("Created automatic key pair #{state[:auto_key_id]}")
|
859
862
|
# Write the key out with safe permissions
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-ec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fletcher Nichol
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -78,10 +78,12 @@ files:
|
|
78
78
|
- lib/kitchen/driver/aws/standard_platform.rb
|
79
79
|
- lib/kitchen/driver/aws/standard_platform/amazon.rb
|
80
80
|
- lib/kitchen/driver/aws/standard_platform/amazon2.rb
|
81
|
+
- lib/kitchen/driver/aws/standard_platform/amazon2023.rb
|
81
82
|
- lib/kitchen/driver/aws/standard_platform/centos.rb
|
82
83
|
- lib/kitchen/driver/aws/standard_platform/debian.rb
|
83
84
|
- lib/kitchen/driver/aws/standard_platform/fedora.rb
|
84
85
|
- lib/kitchen/driver/aws/standard_platform/freebsd.rb
|
86
|
+
- lib/kitchen/driver/aws/standard_platform/macos.rb
|
85
87
|
- lib/kitchen/driver/aws/standard_platform/rhel.rb
|
86
88
|
- lib/kitchen/driver/aws/standard_platform/ubuntu.rb
|
87
89
|
- lib/kitchen/driver/aws/standard_platform/windows.rb
|
@@ -91,7 +93,7 @@ homepage: https://github.com/test-kitchen/kitchen-ec2
|
|
91
93
|
licenses:
|
92
94
|
- Apache-2.0
|
93
95
|
metadata: {}
|
94
|
-
post_install_message:
|
96
|
+
post_install_message:
|
95
97
|
rdoc_options: []
|
96
98
|
require_paths:
|
97
99
|
- lib
|
@@ -99,15 +101,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
101
|
requirements:
|
100
102
|
- - ">="
|
101
103
|
- !ruby/object:Gem::Version
|
102
|
-
version: '2.
|
104
|
+
version: '2.7'
|
103
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
106
|
requirements:
|
105
107
|
- - ">="
|
106
108
|
- !ruby/object:Gem::Version
|
107
109
|
version: '0'
|
108
110
|
requirements: []
|
109
|
-
rubygems_version: 3.
|
110
|
-
signing_key:
|
111
|
+
rubygems_version: 3.4.3
|
112
|
+
signing_key:
|
111
113
|
specification_version: 4
|
112
114
|
summary: A Test Kitchen Driver for Amazon EC2
|
113
115
|
test_files: []
|