govuk-connect 0.7.1 → 0.8.0

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: eb1833e17a6b23f0f56d7dd8c7777df90aef85a88edc4d1d291392a4ae8d674e
4
- data.tar.gz: db810372f0a69022dfdd976fce2a5844b61595795badcba4e62ed52ca9e4ad4f
3
+ metadata.gz: 3809f92432d9568040b786cea22448406da43403917459d8bf96210457be9cd6
4
+ data.tar.gz: a606f53b33df1e4baa5c95f265c4fd078c886ec2f9d853c3950f087eb19b0201
5
5
  SHA512:
6
- metadata.gz: 108c4c799b5a9de65253a797dac03572c0b49f374bfd7c7bf9b3d2603e24b30fad7310d0b1ed5f7663292b6213dfbd87cda128855280f7017e8aeb6906e7910d
7
- data.tar.gz: e53d6fa5bd5535b864c350bd021a5b5dd4fbfd3a7935df4b7cef4e5658750d02bc24b9c727324b6e92ff3d6989a99cf00425be4f3a6efee73ae786c2ede2d9e3
6
+ metadata.gz: d47dce35c946feb4c5869eb3cbc3b7a6ac1796cdb668ecd79d79e4d19e19cd39800e9e593336239120d6681a6016e2f0c9a3561e7e6c6484f18eb1275ed002ed
7
+ data.tar.gz: 343c1544abe716c63783591c3a6d33a2cc83c03ad2bab7cb3ed273526c523dd8d46a362bd9d6333b513ea250b4c2655f2009f77d80c84cb4b6362aafbe27eb54
@@ -24,10 +24,6 @@ class GovukConnect::CLI
24
24
 
25
25
  gds govuk connect scp-pull --environment integration backend /tmp/filename.txt ~/Downloads/
26
26
 
27
- gds govuk connect app-console --environment staging publishing-api
28
-
29
- gds govuk connect app-dbconsole -e integration whitehall_backend/whitehall
30
-
31
27
  gds govuk connect rabbitmq -e staging aws/rabbitmq
32
28
 
33
29
  gds govuk connect amazonmq -e integration
@@ -72,8 +68,8 @@ class GovukConnect::CLI
72
68
 
73
69
  CONNECTION_TYPE_DESCRIPTIONS = {
74
70
  "ssh" => "Connect to a machine through SSH.",
75
- "app-console" => "Launch a console for an application. For example, a rails console when connecting to a Rails application.",
76
- "app-dbconsole" => "Launch a console for the database for an application.",
71
+ "app-console" => "(DEPRECATED; use kubectl instead) Launch a Rails console for an application.",
72
+ "app-dbconsole" => "(DEPRECATED; use kubectl instead) Launch a Rails database console for an application.",
77
73
  "rabbitmq" => "Setup port forwarding to the RabbitMQ admin interface.",
78
74
  "amazonmq" => "Setup port forwarding to the AmazonMQ admin interface.",
79
75
  }.freeze
@@ -121,6 +117,11 @@ class GovukConnect::CLI
121
117
  info "You may also wish to check that you are connected to the VPN, as attempting to SSH into an instance when NOT on the VPN can result in an operation timed out error"
122
118
  end
123
119
 
120
+ def print_k8s_setup_info
121
+ info "If that doesn't work for you, follow the setup instructions at"
122
+ info "https://govuk-k8s-user-docs.publishing.service.gov.uk/get-started/access-eks-cluster\n"
123
+ end
124
+
124
125
  # From Rosetta Code: https://rosettacode.org/wiki/Levenshtein_distance#Ruby
125
126
  def levenshtein_distance(string1, string2)
126
127
  string1 = string1.downcase
@@ -849,7 +850,7 @@ class GovukConnect::CLI
849
850
  hosting,
850
851
  )
851
852
 
852
- if domains.length.zero?
853
+ if domains.empty?
853
854
  error "error: couldn't find #{name} in #{hosting}/#{environment}"
854
855
 
855
856
  node_types = govuk_node_list_classes(environment, hosting)
@@ -915,20 +916,33 @@ class GovukConnect::CLI
915
916
  end
916
917
  end
917
918
 
919
+ def target_name_to_k8s_deployment(target_name)
920
+ {
921
+ /draft_[a-z_]+\/([a-z_-]+)/ => "draft-\\1",
922
+ /.*\// => "", # If not draft, drop the Puppet class prefix.
923
+ "whitehall_backend/whitehall" => "whitehall-admin",
924
+ "whitehall_frontend/whitehall" => "whitehall-frontend",
925
+ }.reduce(target_name) do |result, (pattern, replacement)|
926
+ result.sub(pattern, replacement)
927
+ end
928
+ end
929
+
918
930
  def types
919
931
  @types ||= {
920
- "app-console" => proc do |target, environment, args, extra_args, _options|
921
- check_for_target(target)
922
- check_for_additional_arguments("app-console", args)
923
- check_for_additional_arguments("app-console", extra_args)
924
- govuk_app_command(target, environment, "console")
932
+ "app-console" => proc do |target, _environment, _args, _extra_args, _options|
933
+ target ||= "<app-name>"
934
+ deployment = target_name_to_k8s_deployment(target)
935
+ info "#{bold('The command for opening a Rails console has changed. Run this instead:')}\n\n"
936
+ info " k exec -it deploy/#{deployment} -- rails c\n\n"
937
+ print_k8s_setup_info
925
938
  end,
926
939
 
927
- "app-dbconsole" => proc do |target, environment, args, extra_args, _options|
928
- check_for_target(target)
929
- check_for_additional_arguments("app-dbconsole", args)
930
- check_for_additional_arguments("app-dbconsole", extra_args)
931
- govuk_app_command(target, environment, "dbconsole")
940
+ "app-dbconsole" => proc do |target, _environment, _args, _extra_args, _options|
941
+ target ||= "<app-name>"
942
+ deployment = target_name_to_k8s_deployment(target)
943
+ info "#{bold('The command for opening a Rails dbconsole has changed. Run this instead:')}\n\n"
944
+ info " k exec -it deploy/#{deployment} -- rails db\n\n"
945
+ print_k8s_setup_info
932
946
  end,
933
947
 
934
948
  "rabbitmq" => proc do |target, environment, args, extra_args, _options|
@@ -1,3 +1,3 @@
1
1
  module GovukConnect
2
- VERSION = "0.7.1".freeze
2
+ VERSION = "0.8.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk-connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Government Digital Service
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-30 00:00:00.000000000 Z
11
+ date: 2023-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 4.9.0
61
+ version: 4.10.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 4.9.0
68
+ version: 4.10.0
69
69
  description: Command line tool to connect to GOV.UK infrastructure
70
70
  email:
71
71
  - govuk-dev@digital.cabinet-office.gov.uk
@@ -90,14 +90,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
91
  - - ">="
92
92
  - !ruby/object:Gem::Version
93
- version: '2.7'
93
+ version: '3.0'
94
94
  required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  requirements: []
100
- rubygems_version: 3.4.5
100
+ rubygems_version: 3.4.13
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: govuk-connect command line tool