firespring_dev_commands 1.4.2 → 1.4.3.pre.alpha.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50324d3a1a3e2eb483d989c25c3621c9e8daa47218ad9fabdb0ca06a0ba26177
4
- data.tar.gz: 5365e89808d4ae62dfc9294858a77518f928c32493c6697aae53b4b70f824fd7
3
+ metadata.gz: 6202dfc1befb402bba5013a33cc9fb85181aa1ba704eed0cae6b1fc1a1a14a89
4
+ data.tar.gz: 5a83b16623b5f0d0ebb822dcd4bf3bc4a171b349a76c7e53a489c346a50e920e
5
5
  SHA512:
6
- metadata.gz: 791680ecd764ff90a500ba413b70a667eb99e5e2497193b87851d8ba0618c341889ade9f6026cba8f31216970618b8d6a86b8b18f280edf5242b2dec554fbaf9
7
- data.tar.gz: 10215141fb15130d6850629acb9e2cf7f95f2f2f2082fdd76e823cb4384f7fc8d320271afd49d19eb5e57fef7b92fd741df7f73cea8488a3d0c2b187e38885fd
6
+ metadata.gz: ee53711a91212ce350041b15b338230bd1ca7c314fc165b154ee73e3997329194184dea206b6ebfe222672e2705e1de9a625c3628bc14a2c15ec20a7d9cb24f7
7
+ data.tar.gz: 79fe039edb3293f8b5dd4a507d8d4639b34964c1e58614497517c5d37631bc8e0e6a6f6f7af8aa9166f569ca627be54941571e07c621ad45ac2a9f75f0d78f80
@@ -3,7 +3,11 @@ 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
- Config = Struct.new(:root, :children, :default, :registry)
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)
7
11
 
8
12
  # Instantiates a new top level config object if one hasn't already been created
9
13
  # Yields that config object to any given block
@@ -22,7 +26,7 @@ module Dev
22
26
  # The name of the file containing the Aws settings
23
27
  CONFIG_FILE = "#{Dev::Aws::CONFIG_DIR}/config".freeze
24
28
 
25
- attr_accessor :root, :children, :default, :registry
29
+ attr_accessor :root, :children, :default, :registry, :registries
26
30
 
27
31
  # Instantiate an account object
28
32
  # Requires that root account and at least one child account have been configured
@@ -35,7 +39,7 @@ module Dev
35
39
  @root = self.class.config.root
36
40
  @children = self.class.config.children
37
41
  @default = self.class.config.default
38
- @registry = self.class.config.registry
42
+ @registries = (Array(self.class.config.registries) << self.class.config.registry).compact.uniq
39
43
  end
40
44
 
41
45
  # Returns all configured account information objects
@@ -8,7 +8,7 @@ module Dev
8
8
  class Login
9
9
  # Main interface for logging in to an AWS account
10
10
  # If an account is not specified the user is given an account selection menu
11
- # If an account registry has been configured, the user is also logged in to the docker registry
11
+ # If account registries have been configured, the user is also logged in to the docker registries
12
12
  def login!(account = nil)
13
13
  # If more than one child account has been configured, have the user select the account they want to log in to
14
14
  account ||= Dev::Aws::Account.new.select
@@ -22,8 +22,8 @@ module Dev
22
22
  # Load credentials into the ENV for subprocesses
23
23
  Dev::Aws::Credentials.new.export!
24
24
 
25
- # Login in to the docker registry if the user has configured one
26
- registry_login! if Dev::Aws::Account.new.registry
25
+ # Login in to all configured docker registries
26
+ registry_logins!
27
27
  end
28
28
 
29
29
  # Authorize your local credentials
@@ -67,7 +67,17 @@ 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_login!(registry_id: Dev::Aws::Account.new.registry, region: Dev::Aws::DEFAULT_REGION)
70
+ def registry_logins!(registry_ids: Dev::Aws::Account.new.registries, region: Dev::Aws::DEFAULT_REGION)
71
+ return if registry_ids.empty?
72
+
73
+ puts
74
+ registry_ids.each { |id| registry_login!(registry_id: id, region: region) }
75
+ puts
76
+ end
77
+
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
+ # 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)
71
81
  raise 'registry_id is required' if registry_id.to_s.strip.empty?
72
82
  raise 'region is required' if region.to_s.strip.empty?
73
83
 
@@ -85,17 +95,17 @@ module Dev
85
95
  def docker_login!(registry_id: Dev::Aws::Account.new.registry, region: Dev::Aws::DEFAULT_REGION)
86
96
  warn '[DEPRECATION] `Dev::Aws::Login#docker_login!` is deprecated. Please use `Dev::Aws::Login#registry_login!` instead.'
87
97
  docker_cli_login!(registry: "#{registry_id}.dkr.ecr.#{region}.amazonaws.com", region: region)
98
+ puts
88
99
  end
89
100
 
90
101
  # Authroizes the docker cli to pull/push images from the Aws container registry
91
102
  # (e.g. if docker compose needs to pull an image)
92
103
  private def docker_cli_login!(registry:, region:)
93
- print(' Logging in to ECR in docker... ')
104
+ print(" Logging in to #{registry} in docker... ")
94
105
  login_cmd = "aws --profile=#{Dev::Aws::Profile.new.current} ecr --region=#{region} get-login-password"
95
106
  login_cmd << ' | '
96
107
  login_cmd << "docker login --password-stdin --username AWS #{registry}"
97
108
  Dev::Common.new.run_command([login_cmd])
98
- puts
99
109
  end
100
110
 
101
111
  # Authroizes the docker ruby library to pull/push images from the Aws container registry
@@ -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.2'.freeze
9
+ VERSION = '1.4.3.pre.alpha.2'.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.2
4
+ version: 1.4.3.pre.alpha.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
@@ -453,9 +453,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
453
453
  version: '2.7'
454
454
  required_rubygems_version: !ruby/object:Gem::Requirement
455
455
  requirements:
456
- - - ">="
456
+ - - ">"
457
457
  - !ruby/object:Gem::Version
458
- version: '0'
458
+ version: 1.3.1
459
459
  requirements: []
460
460
  rubygems_version: 3.1.6
461
461
  signing_key: