firespring_dev_commands 1.4.3.pre.alpha.2 → 1.4.3.pre.alpha.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6202dfc1befb402bba5013a33cc9fb85181aa1ba704eed0cae6b1fc1a1a14a89
4
- data.tar.gz: 5a83b16623b5f0d0ebb822dcd4bf3bc4a171b349a76c7e53a489c346a50e920e
3
+ metadata.gz: 764aab3927a5dc24b6474ba35af2e54f7b97dfa93ac54ae8187989ff954cfbbe
4
+ data.tar.gz: 33c04cd996134dcb26fa12358b5ec3ab436dcaa07f5db69f0f96d8b13fb1c5e4
5
5
  SHA512:
6
- metadata.gz: ee53711a91212ce350041b15b338230bd1ca7c314fc165b154ee73e3997329194184dea206b6ebfe222672e2705e1de9a625c3628bc14a2c15ec20a7d9cb24f7
7
- data.tar.gz: 79fe039edb3293f8b5dd4a507d8d4639b34964c1e58614497517c5d37631bc8e0e6a6f6f7af8aa9166f569ca627be54941571e07c621ad45ac2a9f75f0d78f80
6
+ metadata.gz: 572c3b804cf02d5d7e4a62060a4a779b67843a14047a36f207b3e1198868326eb1379b3cc44ee0160c714ef8bbdfaf14e3c76ccf58e75cf88784415df4595ea5
7
+ data.tar.gz: f91c0898808c71729efe61cb841eec2901824f7793d49a50fe42bee80b2accb42b415baf20659e52e95850b4a9fae6355c5f82b70f02a7fa4e19dcd12d28ba5f
data/README.md CHANGED
@@ -11,7 +11,7 @@ gem 'firespring_dev_commands', '~> 0.0.1'
11
11
  * This is not common
12
12
  * It is mostly used for testing local changes before the gem is released
13
13
  ```
14
- gem 'firespring_dev_commands', path: '/path/to/firespring/dev-commands-ruby'
14
+ gem 'firespring_dev_commands', path: '/path/to/dev_commands'
15
15
  ```
16
16
 
17
17
  * Add the following to your Rakefile
@@ -3,11 +3,7 @@ module Dev
3
3
  # Class containing useful methods for interacting with the Aws account
4
4
  class Account
5
5
  # Config object for setting top level Aws account config options
6
-
7
- # TODO: Can we add a "login_to_account_registry?
8
- # TODO: And then add additional_registries?
9
-
10
- Config = Struct.new(:root, :children, :default, :registry, :registries)
6
+ Config = Struct.new(:root, :children, :default, :registry, :ecr_registry_ids, :login_to_account_ecr_registry)
11
7
 
12
8
  # Instantiates a new top level config object if one hasn't already been created
13
9
  # Yields that config object to any given block
@@ -26,7 +22,7 @@ module Dev
26
22
  # The name of the file containing the Aws settings
27
23
  CONFIG_FILE = "#{Dev::Aws::CONFIG_DIR}/config".freeze
28
24
 
29
- attr_accessor :root, :children, :default, :registry, :registries
25
+ attr_accessor :root, :children, :default, :registry, :ecr_registry_ids
30
26
 
31
27
  # Instantiate an account object
32
28
  # Requires that root account and at least one child account have been configured
@@ -39,7 +35,12 @@ module Dev
39
35
  @root = self.class.config.root
40
36
  @children = self.class.config.children
41
37
  @default = self.class.config.default
42
- @registries = (Array(self.class.config.registries) << self.class.config.registry).compact.uniq
38
+
39
+ # Create the ecr registry list based off several possible configuration values
40
+ @ecr_registry_ids = Array(self.class.config.ecr_registry_ids)
41
+ @ecr_registry_ids << self.class.config.registry
42
+ @ecr_registry_ids << Dev::Aws::Profile.new.current if self.class.config.login_to_account_ecr_registry
43
+ @ecr_registry_ids = @ecr_registry_ids.flatten.compact.reject(&:empty?).uniq
43
44
  end
44
45
 
45
46
  # Returns all configured account information objects
@@ -77,7 +78,7 @@ module Dev
77
78
  region_default = defaultini['region'] || ENV['AWS_DEFAULT_REGION'] || Dev::Aws::DEFAULT_REGION
78
79
  defaultini['region'] = Dev::Common.new.ask('Default region name', region_default)
79
80
 
80
- mfa_default = defaultini['mfa_serial'] || ENV['AWS_MFA_ARN'] || "arn:aws:iam::#{root}:mfa/#{ENV.fetch('USERNAME', nil)}"
81
+ mfa_default = defaultini['mfa_serial'] || ENV['AWS_MFA_ARN'] || "arn:aws:iam::#{root.id}:mfa/#{ENV.fetch('USERNAME', nil)}"
81
82
  defaultini['mfa_serial'] = Dev::Common.new.ask('Default mfa arn', mfa_default)
82
83
 
83
84
  session_name_default = defaultini['role_session_name'] || "#{ENV.fetch('USERNAME', nil)}_cli"
@@ -67,7 +67,7 @@ module Dev
67
67
 
68
68
  # Authroizes the docker cli to pull/push images from the Aws container registry (e.g. if docker compose needs to pull an image)
69
69
  # Authroizes the docker ruby library to pull/push images from the Aws container registry
70
- def registry_logins!(registry_ids: Dev::Aws::Account.new.registries, region: Dev::Aws::DEFAULT_REGION)
70
+ def registry_logins!(registry_ids: Dev::Aws::Account.new.ecr_registry_ids, region: Dev::Aws::DEFAULT_REGION)
71
71
  return if registry_ids.empty?
72
72
 
73
73
  puts
@@ -77,7 +77,7 @@ module Dev
77
77
 
78
78
  # Authroizes the docker cli to pull/push images from the Aws container registry (e.g. if docker compose needs to pull an image)
79
79
  # Authroizes the docker ruby library to pull/push images from the Aws container registry
80
- def registry_login!(registry_id: Dev::Aws::Account.new.registries, region: Dev::Aws::DEFAULT_REGION)
80
+ def registry_login!(registry_id: Dev::Aws::Account.new.ecr_registry_ids.last, region: Dev::Aws::DEFAULT_REGION)
81
81
  raise 'registry_id is required' if registry_id.to_s.strip.empty?
82
82
  raise 'region is required' if region.to_s.strip.empty?
83
83
 
@@ -92,7 +92,7 @@ module Dev
92
92
  # Authroizes the docker cli to pull/push images from the Aws container registry
93
93
  # (e.g. if docker compose needs to pull an image)
94
94
  # @deprecated Please use {Dev::Aws::Login#registry_login!} instead
95
- def docker_login!(registry_id: Dev::Aws::Account.new.registry, region: Dev::Aws::DEFAULT_REGION)
95
+ def docker_login!(registry_id: Dev::Aws::Account.new.ecr_registry_ids.last, region: Dev::Aws::DEFAULT_REGION)
96
96
  warn '[DEPRECATION] `Dev::Aws::Login#docker_login!` is deprecated. Please use `Dev::Aws::Login#registry_login!` instead.'
97
97
  docker_cli_login!(registry: "#{registry_id}.dkr.ecr.#{region}.amazonaws.com", region: region)
98
98
  puts
@@ -110,7 +110,7 @@ module Dev
110
110
 
111
111
  # Authroizes the docker ruby library to pull/push images from the Aws container registry
112
112
  # @deprecated Please use {Dev::Aws::Login#registry_login!} instead
113
- def ecr_login!(registry_id: Dev::Aws::Account.new.registry, region: Dev::Aws::DEFAULT_REGION)
113
+ def ecr_login!(registry_id: Dev::Aws::Account.new.ecr_registry_ids.last, region: Dev::Aws::DEFAULT_REGION)
114
114
  warn '[DEPRECATION] `Dev::Aws::Login#ecr_login!` is deprecated. Please use `Dev::Aws::Login#registry_login!` instead.'
115
115
  docker_lib_login!(registry_id: registry_id, region: region)
116
116
  end
@@ -6,6 +6,6 @@ module Dev
6
6
  # Use 'v.v.v.pre.alpha.v' for pre-release vesions
7
7
  # Use 'v.v.v.beta.v for beta versions
8
8
  # Use semantic versioning for any releases (https://semver.org/)
9
- VERSION = '1.4.3.pre.alpha.2'.freeze
9
+ VERSION = '1.4.3.pre.alpha.3'.freeze
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firespring_dev_commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3.pre.alpha.2
4
+ version: 1.4.3.pre.alpha.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring