firespring_dev_commands 2.1.13.pre.alpha.3 → 2.1.14.pre.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/firespring_dev_commands/aws/codepipeline.rb +4 -10
- data/lib/firespring_dev_commands/aws/parameter.rb +5 -13
- data/lib/firespring_dev_commands/aws.rb +12 -0
- data/lib/firespring_dev_commands/eol/aws.rb +117 -0
- data/lib/firespring_dev_commands/eol/product_version.rb +1 -3
- data/lib/firespring_dev_commands/jira.rb +21 -3
- data/lib/firespring_dev_commands/templates/aws.rb +19 -0
- data/lib/firespring_dev_commands/version.rb +1 -1
- metadata +59 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05de3b2e1af3b056c9f173a6ec470f802712ed2b7227c2472f32b6dcc14b4326
|
4
|
+
data.tar.gz: 6272959b3d7e75a3b7b66923df1ccb25579b65ae7cb9919897964117fdc63dfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2331931b5b49de1a0a78cc8ad1fb7cf6a9f21ca31a36c2362dedd00b27018de9200e328a9a979fa34cd3229d22d982b7dcd0e8b76b601d55e5dca41b78290f3
|
7
|
+
data.tar.gz: f8cf6ea20a574a8e08f6fd2fa3279b3ba9e84523361905d8fa49400b7b73db54c5d21ed017b29f41482f6e5449234eb11ae3b6185e43dccd43f1cff8eca84cb5
|
@@ -21,16 +21,10 @@ 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
|
-
|
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
|
24
|
+
pipelines = [].tap do |ary|
|
25
|
+
Dev::Aws.each_page(client, :list_pipelines) do |response|
|
26
|
+
ary.concat(response.pipelines)
|
27
|
+
end
|
34
28
|
end
|
35
29
|
|
36
30
|
pipelines.select! { |it| it.name.match(regex_match) } if regex_match
|
@@ -24,20 +24,12 @@ 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
|
-
|
32
|
-
path:,
|
33
|
-
recursive:,
|
34
|
-
with_decryption:,
|
35
|
-
next_token:
|
36
|
-
)
|
37
|
-
parameters += response.parameters
|
38
|
-
break unless (next_token = response.next_token)
|
27
|
+
[].tap do |ary|
|
28
|
+
params = {path:, recursive:, with_decryption:}
|
29
|
+
Dev::Aws.each_page(client, :get_parameters_by_path, params) do |response|
|
30
|
+
ary.concat(response.parameters)
|
31
|
+
end
|
39
32
|
end
|
40
|
-
parameters
|
41
33
|
end
|
42
34
|
|
43
35
|
# Sets the given parameter name's value to the given value
|
@@ -9,5 +9,17 @@ 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
|
12
24
|
end
|
13
25
|
end
|
@@ -0,0 +1,117 @@
|
|
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
|
@@ -55,9 +55,7 @@ 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
|
-
|
59
|
-
raise "unable to query eol detail for #{name}, #{cycle}" if detail.empty?
|
60
|
-
|
58
|
+
detail['eol'] = '1979-01-01' if detail.empty?
|
61
59
|
detail
|
62
60
|
end
|
63
61
|
|
@@ -4,6 +4,18 @@ require 'base64'
|
|
4
4
|
module Dev
|
5
5
|
# Class which contains methods to conenct to jira and query issues
|
6
6
|
class Jira
|
7
|
+
# The config file to try to load credentials from
|
8
|
+
CONFIG_FILE = "#{Dir.home}/.env.jira".freeze
|
9
|
+
|
10
|
+
# The text of the username variable key
|
11
|
+
JIRA_USERNAME = 'JIRA_USERNAME'.freeze
|
12
|
+
|
13
|
+
# The text of the token variable key
|
14
|
+
JIRA_TOKEN = 'JIRA_TOKEN'.freeze
|
15
|
+
|
16
|
+
# The text of the url variable key
|
17
|
+
JIRA_URL = 'JIRA_URL'.freeze
|
18
|
+
|
7
19
|
# Config object for setting top level jira config options
|
8
20
|
# "points_field_name" is the field holding the value for points on a story. If this is not present, all points will default to 0
|
9
21
|
# "user_lookup_list" should be an array of Jira::User objects representing the usernames, ids, etc for all jira users
|
@@ -11,9 +23,11 @@ module Dev
|
|
11
23
|
# and there is no way to query this information from Jira directly.
|
12
24
|
Config = Struct.new(:username, :token, :url, :points_field_name, :expand, :user_lookup_list, :read_timeout, :http_debug) do
|
13
25
|
def initialize
|
14
|
-
|
15
|
-
|
16
|
-
self.
|
26
|
+
Dotenv.load(CONFIG_FILE) if File.exist?(CONFIG_FILE)
|
27
|
+
|
28
|
+
self.username = ENV.fetch(JIRA_USERNAME, nil)
|
29
|
+
self.token = ENV.fetch(JIRA_TOKEN, nil)
|
30
|
+
self.url = ENV.fetch(JIRA_URL, nil)
|
17
31
|
self.points_field_name = nil
|
18
32
|
self.expand = []
|
19
33
|
self.user_lookup_list = []
|
@@ -40,6 +54,10 @@ module Dev
|
|
40
54
|
|
41
55
|
# Initialize a new jira client using the given inputs
|
42
56
|
def initialize(username: self.class.config.username, token: self.class.config.token, url: self.class.config.url)
|
57
|
+
raise 'username is required' if username.to_s.strip.empty?
|
58
|
+
raise 'token is required' if token.to_s.strip.empty?
|
59
|
+
raise 'url is required' if url.to_s.strip.empty?
|
60
|
+
|
43
61
|
@username = username
|
44
62
|
@token = token
|
45
63
|
@url = url
|
@@ -93,6 +93,25 @@ 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
|
96
115
|
end
|
97
116
|
end
|
98
117
|
end
|
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.14.pre.alpha.1
|
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-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -66,6 +66,62 @@ 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
|
69
125
|
- !ruby/object:Gem::Dependency
|
70
126
|
name: aws-sdk-s3
|
71
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -280,6 +336,7 @@ files:
|
|
280
336
|
- lib/firespring_dev_commands/dotenv.rb
|
281
337
|
- lib/firespring_dev_commands/env.rb
|
282
338
|
- lib/firespring_dev_commands/eol.rb
|
339
|
+
- lib/firespring_dev_commands/eol/aws.rb
|
283
340
|
- lib/firespring_dev_commands/eol/product_version.rb
|
284
341
|
- lib/firespring_dev_commands/git.rb
|
285
342
|
- lib/firespring_dev_commands/git/info.rb
|