firespring_dev_commands 2.1.12.pre.alpha.3 → 2.1.13.pre.alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/lib/firespring_dev_commands/aws/codepipeline.rb +10 -4
- data/lib/firespring_dev_commands/aws/parameter.rb +13 -5
- data/lib/firespring_dev_commands/aws.rb +0 -12
- data/lib/firespring_dev_commands/common.rb +77 -0
- data/lib/firespring_dev_commands/eol/product_version.rb +3 -1
- data/lib/firespring_dev_commands/templates/aws.rb +0 -19
- data/lib/firespring_dev_commands/version.rb +1 -1
- data/lib/firespring_dev_commands.rb +4 -0
- metadata +2 -59
- data/lib/firespring_dev_commands/eol/aws.rb +0 -117
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f84e05f66ceae5becece425cea392a8f1e0bb7e4f6c7f8ef6d6c7bfe068405e
|
4
|
+
data.tar.gz: 3367ff552bdea261d9612f1a92e10a1f69031e932173ff6e3ae783fa386de968
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bea1ed2293666af0990773ad2a38c9c5fe38d37a17773ab8c256a4bf08560f90d7fe7c1c4ecf3048fb3c3e08e9596a352ab9541ad2f587bb573bfdee97315b9
|
7
|
+
data.tar.gz: 3a91544429995e944f13fb12e66e969725614d076a23ee50cac2dacab475b04fe6fc0bffd1ae970773b95db2e79c1b800a9ba0892b774c3ec79ac13943c153e2
|
data/README.md
CHANGED
@@ -21,10 +21,16 @@ module Dev
|
|
21
21
|
def pipelines(regex_match = nil)
|
22
22
|
raise 'regex_match must be a regexp' if regex_match && !regex_match.is_a?(Regexp)
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
params = {}
|
25
|
+
response = client.list_pipelines(params)
|
26
|
+
pipelines = response.pipelines
|
27
|
+
|
28
|
+
next_token = response.next_token
|
29
|
+
while next_token
|
30
|
+
params[:next_token] = next_token
|
31
|
+
response = client.list_pipelines(params)
|
32
|
+
pipelines += response.pipelines
|
33
|
+
next_token = response.next_token
|
28
34
|
end
|
29
35
|
|
30
36
|
pipelines.select! { |it| it.name.match(regex_match) } if regex_match
|
@@ -24,12 +24,20 @@ module Dev
|
|
24
24
|
|
25
25
|
# Retrieve all parameters which start with the given path
|
26
26
|
def list(path, recursive: true, with_decryption: true)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
next_token = nil
|
28
|
+
|
29
|
+
parameters = []
|
30
|
+
loop do
|
31
|
+
response = client.get_parameters_by_path(
|
32
|
+
path:,
|
33
|
+
recursive:,
|
34
|
+
with_decryption:,
|
35
|
+
next_token:
|
36
|
+
)
|
37
|
+
parameters += response.parameters
|
38
|
+
break unless (next_token = response.next_token)
|
32
39
|
end
|
40
|
+
parameters
|
33
41
|
end
|
34
42
|
|
35
43
|
# Sets the given parameter name's value to the given value
|
@@ -9,17 +9,5 @@ module Dev
|
|
9
9
|
|
10
10
|
# The default role name used if none has been configured when logging in
|
11
11
|
DEFAULT_LOGIN_ROLE_NAME = 'ReadonlyAccessRole'.freeze
|
12
|
-
|
13
|
-
# Runs the query on the client with the parameters
|
14
|
-
# Yields each response page
|
15
|
-
def self.each_page(client, query, params = {})
|
16
|
-
response = client.send(query, params)
|
17
|
-
yield response
|
18
|
-
|
19
|
-
while response.next_page?
|
20
|
-
response = response.next_page
|
21
|
-
yield response
|
22
|
-
end
|
23
|
-
end
|
24
12
|
end
|
25
13
|
end
|
@@ -40,6 +40,7 @@ module Dev
|
|
40
40
|
# Wraps a block of code in a y/n question.
|
41
41
|
# If the user answers 'y' then the block is executed.
|
42
42
|
# If the user answers 'n' then the block is skipped.
|
43
|
+
# @deprecated Please use {Common#when_confirmed} instead
|
43
44
|
def with_confirmation(message, default = 'y', color_message: true)
|
44
45
|
message = "\n #{message}" << '? '.light_green
|
45
46
|
message = message.light_green if color_message
|
@@ -58,6 +59,82 @@ module Dev
|
|
58
59
|
yield
|
59
60
|
end
|
60
61
|
|
62
|
+
# Exits unless the user confirms they want to continue
|
63
|
+
# If the user answers 'y' then the code will continue
|
64
|
+
# All other inputs cause the code to exit
|
65
|
+
def exit_unless_confirmed(message, default: nil, colorize: true)
|
66
|
+
# If a default is given, it must be y or n
|
67
|
+
raise 'invalid default' if default && !%w(y n).include?(default)
|
68
|
+
|
69
|
+
# print the colorized message (if requested) with the default (if given)
|
70
|
+
print(confirmation_message(message, default:, colorize:))
|
71
|
+
|
72
|
+
# Default to the default
|
73
|
+
# Read from stdin unless non_interactive is set to true
|
74
|
+
answer = gather_input(default:)
|
75
|
+
|
76
|
+
return if answer.casecmp('y').zero?
|
77
|
+
|
78
|
+
puts "\n Cancelled.\n".light_yellow
|
79
|
+
exit 1
|
80
|
+
end
|
81
|
+
|
82
|
+
# Wraps a block of code in a y/n question
|
83
|
+
# If the user answers 'y' then the block is executed
|
84
|
+
# All other inputs cause the block to be skipped
|
85
|
+
def when_confirmed(message, default: nil, colorize: true)
|
86
|
+
# If a default is given, it must be y or n
|
87
|
+
raise 'invalid default' if default && !%w(y n).include?(default)
|
88
|
+
|
89
|
+
# print the colorized message (if requested) with the default (if given)
|
90
|
+
print(confirmation_message(message, default:, colorize:))
|
91
|
+
|
92
|
+
# Default to the default
|
93
|
+
# Read from stdin unless non_interactive is set to true
|
94
|
+
answer = gather_input(default:)
|
95
|
+
|
96
|
+
# Yield to the block if confirmed
|
97
|
+
yield if answer.casecmp('y').zero?
|
98
|
+
end
|
99
|
+
|
100
|
+
# Receive a string from the user on stdin unless non_interactive is set to true
|
101
|
+
# If a default value was specified and no answer was given, return the default
|
102
|
+
def gather_input(default: nil)
|
103
|
+
answer = $stdin.gets.to_s.strip unless ENV['NON_INTERACTIVE'] == 'true'
|
104
|
+
answer.to_s.strip
|
105
|
+
return default if default && answer.empty?
|
106
|
+
|
107
|
+
answer
|
108
|
+
end
|
109
|
+
|
110
|
+
# Build a confirmation message, colorizing each individual part appropriately
|
111
|
+
# Include the default value in the message if one was specified
|
112
|
+
def confirmation_message(question, default:, colorize:)
|
113
|
+
message = conditional_colorize(question, colorize:, color: :light_green)
|
114
|
+
options = conditional_colorize('(', colorize:, color: :light_green)
|
115
|
+
options << conditional_colorize('y', colorize:, color: :light_yellow)
|
116
|
+
options << conditional_colorize('/', colorize:, color: :light_green)
|
117
|
+
options << conditional_colorize('n', colorize:, color: :light_yellow)
|
118
|
+
options << conditional_colorize(')', colorize:, color: :light_green)
|
119
|
+
|
120
|
+
unless default.to_s.strip.empty?
|
121
|
+
options << ' '
|
122
|
+
options << conditional_colorize('[', colorize:, color: :light_green)
|
123
|
+
options << conditional_colorize(default.to_s.strip, colorize:, color: :light_yellow)
|
124
|
+
options << conditional_colorize(']', colorize:, color: :light_green)
|
125
|
+
end
|
126
|
+
|
127
|
+
options << conditional_colorize(':', colorize:, color: :light_green)
|
128
|
+
"#{message} #{options} "
|
129
|
+
end
|
130
|
+
|
131
|
+
# Colorize the string if it has been requested
|
132
|
+
def conditional_colorize(string, colorize:, color:)
|
133
|
+
return string.send(color) if colorize
|
134
|
+
|
135
|
+
string
|
136
|
+
end
|
137
|
+
|
61
138
|
# Asks for user input using the given message and returns it
|
62
139
|
# If a default was specified and the user doesn't give any input, the default will be returned
|
63
140
|
def ask(message, default = nil)
|
@@ -55,7 +55,9 @@ module Dev
|
|
55
55
|
# If EOL info is a boolean or missing from the current details, overwrite with the manual date (if present)
|
56
56
|
manual_date = Dev::EndOfLife.config.manual_dates["#{product}_#{cycle.tr('.', '_')}".to_sym]
|
57
57
|
detail['eol'] = manual_date if manual_date && (detail['eol'].boolean? || detail['eol'].nil?)
|
58
|
-
|
58
|
+
|
59
|
+
raise "unable to query eol detail for #{name}, #{cycle}" if detail.empty?
|
60
|
+
|
59
61
|
detail
|
60
62
|
end
|
61
63
|
|
@@ -93,25 +93,6 @@ module Dev
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
# rubocop:enable Metrics/MethodLength
|
96
|
-
|
97
|
-
# Create the rake task for the eol method
|
98
|
-
def create_eol_task!
|
99
|
-
# Have to set a local variable to be accessible inside of the instance_eval block
|
100
|
-
exclude = @exclude
|
101
|
-
|
102
|
-
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
103
|
-
return if exclude.include?(:eol)
|
104
|
-
|
105
|
-
desc 'Compares the current date to the EOL date for supported resources'
|
106
|
-
task eol: %w(init ensure_aws_credentials) do
|
107
|
-
account_id = Dev::Aws::Profile.new.current
|
108
|
-
account_name = Dev::Aws::Account.new.name_by_account(account_id)
|
109
|
-
LOG.info " Current AWS Account is #{account_name} (#{account_id})".light_yellow
|
110
|
-
|
111
|
-
Dev::EndOfLife.new(product_versions: Dev::EndOfLife::Aws.new.default_products).check
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
96
|
end
|
116
97
|
end
|
117
98
|
end
|
@@ -9,6 +9,10 @@ DEV_COMMANDS_PROJECT_NAME = File.basename(DEV_COMMANDS_ROOT_DIR)
|
|
9
9
|
# A reference to the top level object context
|
10
10
|
DEV_COMMANDS_TOP_LEVEL = self
|
11
11
|
|
12
|
+
# Load all gems referenced in the Gemfile
|
13
|
+
require 'bundler'
|
14
|
+
Bundler.require
|
15
|
+
|
12
16
|
# Add libdir to the default ruby path
|
13
17
|
libdir = File.realpath(File.dirname(__FILE__))
|
14
18
|
$LOAD_PATH.unshift libdir
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firespring_dev_commands
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.13.pre.alpha.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Firespring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -66,62 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.61.0
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: aws-sdk-elasticache
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.88.0
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 1.88.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: aws-sdk-lambda
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 1.101.0
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 1.101.0
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: aws-sdk-opensearchservice
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 1.24.0
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 1.24.0
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: aws-sdk-rds
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 1.183.0
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 1.183.0
|
125
69
|
- !ruby/object:Gem::Dependency
|
126
70
|
name: aws-sdk-s3
|
127
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -336,7 +280,6 @@ files:
|
|
336
280
|
- lib/firespring_dev_commands/dotenv.rb
|
337
281
|
- lib/firespring_dev_commands/env.rb
|
338
282
|
- lib/firespring_dev_commands/eol.rb
|
339
|
-
- lib/firespring_dev_commands/eol/aws.rb
|
340
283
|
- lib/firespring_dev_commands/eol/product_version.rb
|
341
284
|
- lib/firespring_dev_commands/git.rb
|
342
285
|
- lib/firespring_dev_commands/git/info.rb
|
@@ -1,117 +0,0 @@
|
|
1
|
-
require 'aws-sdk-lambda'
|
2
|
-
require 'aws-sdk-elasticache'
|
3
|
-
require 'aws-sdk-rds'
|
4
|
-
require 'aws-sdk-opensearchservice'
|
5
|
-
|
6
|
-
module Dev
|
7
|
-
class EndOfLife
|
8
|
-
# Class which queries several different AWS product types and
|
9
|
-
# returns ProductVersion entities which can be checked for EOL
|
10
|
-
class Aws
|
11
|
-
# Queries and returns product versions for the default product types
|
12
|
-
def default_products
|
13
|
-
(elasticache_products + lambda_products + opensearch_products + rds_products).flatten.compact
|
14
|
-
end
|
15
|
-
|
16
|
-
# Queries and returns product versions for elasticache products
|
17
|
-
def elasticache_products
|
18
|
-
client = ::Aws::ElastiCache::Client.new
|
19
|
-
|
20
|
-
[].tap do |ary|
|
21
|
-
Dev::Aws.each_page(client, :describe_cache_clusters) do |response|
|
22
|
-
response.cache_clusters.each do |cluster|
|
23
|
-
name = cluster.cache_cluster_id
|
24
|
-
product = cluster.engine
|
25
|
-
version = cluster.engine_version.reverse.split('.')[-2..].join('.').reverse
|
26
|
-
ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Queries and returns product versions for lambda products
|
33
|
-
def lambda_products
|
34
|
-
client = ::Aws::Lambda::Client.new
|
35
|
-
|
36
|
-
[].tap do |ary|
|
37
|
-
Dev::Aws.each_page(client, :list_functions) do |response|
|
38
|
-
response.functions.each do |function|
|
39
|
-
# Runtime is empty if using a docker image
|
40
|
-
next unless function.runtime
|
41
|
-
|
42
|
-
name = function.function_name
|
43
|
-
product = function&.runtime&.split(/[0-9]/, 2)&.first
|
44
|
-
version = function&.runtime&.split(/#{product}/, 2)&.last&.chomp('.x')
|
45
|
-
ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Queries and returns product versions for opensearch products
|
52
|
-
def opensearch_products
|
53
|
-
client = ::Aws::OpenSearchService::Client.new
|
54
|
-
|
55
|
-
[].tap do |ary|
|
56
|
-
Dev::Aws.each_page(client, :list_domain_names) do |response|
|
57
|
-
response.domain_names.each do |domain|
|
58
|
-
name = domain.domain_name
|
59
|
-
product = domain.engine_type
|
60
|
-
version = client.describe_domain(domain_name: name).domain_status.engine_version.split('_').last.split('.').first
|
61
|
-
ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
# Queries and returns product versions for rds products
|
68
|
-
def rds_products
|
69
|
-
rds_instance_products + rds_cluster_products
|
70
|
-
end
|
71
|
-
|
72
|
-
# Queries and returns product versions for rds instance products
|
73
|
-
def rds_instance_products
|
74
|
-
aws_engines = %w(mysql postgresql)
|
75
|
-
client = ::Aws::RDS::Client.new
|
76
|
-
|
77
|
-
[].tap do |ary|
|
78
|
-
Dev::Aws.each_page(client, :describe_db_instances) do |response|
|
79
|
-
response.db_instances.each do |instance|
|
80
|
-
name = instance.db_instance_identifier
|
81
|
-
engine = instance.engine.tr('aurora-', '')
|
82
|
-
product = if aws_engines.include?(engine)
|
83
|
-
"amazon-rds-#{engine}"
|
84
|
-
else
|
85
|
-
engine
|
86
|
-
end
|
87
|
-
version = instance.engine_version.reverse.split('.')[-2..].join('.').reverse
|
88
|
-
ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
# Queries and returns product versions for rds cluster products
|
95
|
-
def rds_cluster_products
|
96
|
-
aws_engines = %w(mysql postgresql)
|
97
|
-
client = ::Aws::RDS::Client.new
|
98
|
-
|
99
|
-
[].tap do |ary|
|
100
|
-
Dev::Aws.each_page(client, :describe_db_clusters) do |response|
|
101
|
-
response.db_clusters.each do |cluster|
|
102
|
-
name = cluster.db_cluster_identifier
|
103
|
-
engine = cluster.engine.tr('aurora-', '')
|
104
|
-
product = if aws_engines.include?(engine)
|
105
|
-
"amazon-rds-#{engine}"
|
106
|
-
else
|
107
|
-
engine
|
108
|
-
end
|
109
|
-
version = cluster.engine_version.reverse.split('.')[-2..].join('.').reverse
|
110
|
-
ary << Dev::EndOfLife::ProductVersion.new(product, version, name)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|