@govuk-pay/cli 0.0.55 → 0.0.56

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.
Files changed (72) hide show
  1. package/package.json +1 -1
  2. package/resources/legacy-ruby-cli/README.md +5 -74
  3. package/resources/legacy-ruby-cli/lib/pay_cli/commands/doctor.rb +0 -85
  4. package/resources/legacy-ruby-cli/lib/pay_cli/config.rb +1 -23
  5. package/resources/legacy-ruby-cli/lib/pay_cli/entry_point.rb +4 -21
  6. package/resources/legacy-ruby-cli/.rspec +0 -1
  7. package/resources/legacy-ruby-cli/config/generate-secrets.yml +0 -9
  8. package/resources/legacy-ruby-cli/config/secrets.yml +0 -682
  9. package/resources/legacy-ruby-cli/config/service_secrets.yml +0 -203
  10. package/resources/legacy-ruby-cli/lib/pay_cli/aws/services.rb +0 -47
  11. package/resources/legacy-ruby-cli/lib/pay_cli/commands/aws.rb +0 -29
  12. package/resources/legacy-ruby-cli/lib/pay_cli/commands/browse.rb +0 -31
  13. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/app_client.rb +0 -216
  14. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/config.rb +0 -142
  15. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/config.yaml +0 -198
  16. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/docker.rb +0 -66
  17. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/all.yaml +0 -847
  18. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/card.yaml +0 -491
  19. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/custom.yaml +0 -71
  20. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/docker-compose.erb +0 -395
  21. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/end-to-end.erb +0 -30
  22. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/java.yaml +0 -456
  23. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/localstack/init-aws.sh +0 -70
  24. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/naxsi/readme.md +0 -1
  25. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/postgres/docker-entrypoint-initdb.d/make_payments_databases.sql +0 -26
  26. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/adminusers.env +0 -49
  27. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/cardid.env +0 -2
  28. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/connector.env +0 -70
  29. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/demo-service.env +0 -10
  30. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/egress/squid.conf +0 -47
  31. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/frontend.env +0 -12
  32. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/java_app.env +0 -1
  33. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ledger.env +0 -7
  34. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/products-ui.env +0 -14
  35. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/products.env +0 -25
  36. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/publicapi.env +0 -13
  37. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/publicauth.env +0 -13
  38. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/selfservice.env +0 -21
  39. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ssl/certs/frontend-proxy.crt +0 -18
  40. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ssl/certs/products-ui-proxy.crt +0 -20
  41. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ssl/certs/publicapi-proxy.crt +0 -18
  42. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ssl/certs/selfservice-proxy.crt +0 -20
  43. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ssl/certs/stubs-proxy.crt +0 -18
  44. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ssl/keys/frontend-proxy.key +0 -28
  45. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ssl/keys/products-ui-proxy.key +0 -28
  46. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ssl/keys/publicapi-proxy.key +0 -28
  47. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ssl/keys/selfservice-proxy.key +0 -28
  48. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ssl/keys/stubs-proxy.key +0 -28
  49. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/ssl/make-selfsigned.sh +0 -2
  50. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/stubs.env +0 -12
  51. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/toolbox.env +0 -5
  52. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/webhooks.env +0 -9
  53. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/toolbox.yaml +0 -473
  54. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local/image_extractor.rb +0 -20
  55. package/resources/legacy-ruby-cli/lib/pay_cli/commands/local.rb +0 -451
  56. package/resources/legacy-ruby-cli/lib/pay_cli/commands/secrets.rb +0 -114
  57. package/resources/legacy-ruby-cli/lib/pay_cli/commands/tunnel/services.yml +0 -49
  58. package/resources/legacy-ruby-cli/lib/pay_cli/naming.rb +0 -6
  59. package/resources/legacy-ruby-cli/lib/pay_cli/secrets.rb +0 -281
  60. package/resources/legacy-ruby-cli/package-lock.json +0 -6
  61. package/resources/legacy-ruby-cli/rds_access/connect.sh +0 -175
  62. package/resources/legacy-ruby-cli/spec/.rubocop.yml +0 -2
  63. package/resources/legacy-ruby-cli/spec/fixtures/dockerfile_examples/Dockerfile.complex +0 -34
  64. package/resources/legacy-ruby-cli/spec/fixtures/dockerfile_examples/Dockerfile.complex_differing_froms +0 -33
  65. package/resources/legacy-ruby-cli/spec/fixtures/dockerfile_examples/Dockerfile.no_from +0 -3
  66. package/resources/legacy-ruby-cli/spec/fixtures/dockerfile_examples/Dockerfile.simple +0 -5
  67. package/resources/legacy-ruby-cli/spec/fixtures/dockerfile_examples/Dockerfile.simple_no_tag +0 -5
  68. package/resources/legacy-ruby-cli/spec/fixtures/dockerfile_examples/Dockerfile.with_sha +0 -5
  69. package/resources/legacy-ruby-cli/spec/fixtures/dockerfile_examples/Dockerfile.with_sha_no_tag +0 -5
  70. package/resources/legacy-ruby-cli/spec/lib/pay_cli/commands/local/image_extractor_spec.rb +0 -55
  71. package/resources/legacy-ruby-cli/spec/naming_spec.rb +0 -19
  72. package/resources/legacy-ruby-cli/spec/spec_helper.rb +0 -106
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@govuk-pay/cli",
3
- "version": "0.0.55",
3
+ "version": "0.0.56",
4
4
  "description": "GOV.UK Pay Command Line Interface",
5
5
  "bin": {
6
6
  "pay": "bin/cli.js",
@@ -1,4 +1,8 @@
1
- # pay-cli
1
+ # **DEPRECATED** pay-cli
2
+
3
+ ***NOTE:*** This is deprecated. Please use the [Node.js version of pay-cli](https://www.github.com/alphagov/pay-cli)
4
+
5
+ To execute this cli you should now use the Node.js version legacy subcommand `pay legacy -- --help`
2
6
 
3
7
  ## getting started
4
8
 
@@ -27,56 +31,6 @@ gem install nokogiri -v 1.8.4 -- --use-system-libraries=true --with-xml2-include
27
31
 
28
32
  then re-running `bundle install`)
29
33
 
30
- ### add the following to your `.bash_profile`, `.bashrc`, or `.zshrc`
31
-
32
- In all of the following examples replace `~/Code/pay-infra` or `$HOME/Code/pay-infra` with the path where you have the
33
- pay-infra repo checked out.
34
-
35
- Either:
36
- ```
37
- export PATH="$PATH:~/Code/pay-infra/cli/bin"
38
- ```
39
-
40
- or if you want to avoid ruby version conflicts then you can instead use the following function
41
-
42
- ```
43
- function pay {
44
- pushd "$HOME/Code/pay-infra/cli" >>/dev/null 2>&1 || return
45
- bundle exec bin/pay "$@"
46
- popd >>/dev/null 2>&1 || return
47
- }
48
- ```
49
-
50
- ### add a basic secrets file
51
-
52
- ```
53
- mkdir $HOME/.govuk-pay
54
- cat <<EOF > $HOME/.govuk-pay/secrets.yml
55
- ---
56
- dev-toby-3:
57
- terraform:
58
- ADMINUSERS_RDS_PASSWORD: dev-env-rds-password
59
- CONNECTOR_RDS_PASSWORD: dev-env-rds-password
60
- LEDGER_RDS_PASSWORD: dev-env-rds-password
61
- PRODUCTS_RDS_PASSWORD: dev-env-rds-password
62
- PUBLICAUTH_RDS_PASSWORD: dev-env-rds-password
63
- ANALYTICS_TRACKING_ID: something
64
-
65
- test-12: {}
66
- EOF
67
- ```
68
-
69
- Add the secrets to cli/config/secrets.yml under the local provider
70
- ```
71
- local:
72
- dev-toby-3:
73
- terraform:
74
- - ADMINUSERS_RDS_PASSWORD
75
- - CONNECTOR_RDS_PASSWORD
76
- - PRODUCTS_RDS_PASSWORD
77
- - PUBLICAUTH_RDS_PASSWORD
78
- ```
79
-
80
34
  ## read the usage (list all commands)
81
35
 
82
36
  ```
@@ -125,26 +79,3 @@ You can execute rubocop manually on a single file by running:
125
79
  ```
126
80
  bundle exec rubocop <file_path>
127
81
  ```
128
-
129
- ### Tests
130
-
131
- Rspec is used as the test runner in pay cli. All files with tests in need to have a filename which ends in `_spec.rb`
132
- and be placed in the `spec` directory. It's usual to include them in a directory hierarchy which matches the file
133
- under test. E.g. for `lib/pay_cli/my_file.rb` would have it's unit tests in `spec/lib/pay_cli/my_file_spec.rb`.
134
-
135
- To run all the tests, from the root of the project you can run:
136
-
137
- ```
138
- bundle exec rspec
139
- ```
140
-
141
- You can run the tests in a single file by adding the filepath:
142
-
143
- ```
144
- bundle exec rspec spec/lib/pay_cli/commands/local/image_extractor_spec.rb
145
- ```
146
-
147
- You can run a single spec by adding the line number:
148
- ```
149
- bundle exec rspec spec/lib/pay_cli/commands/local/image_extractor_spec.rb:11
150
- ```
@@ -1,17 +1,11 @@
1
1
  require 'fileutils'
2
- require 'yaml'
3
2
 
4
3
  class PayCLI::Commands::Doctor
5
4
  def start!
6
5
  check_workspace!
7
6
  check_ruby_version!
8
- check_old_pay_config_dir!
9
- check_secrets_file!
10
- check_pay_low_pass!
11
7
  check_terraform!
12
- check_aws!
13
8
  check_aws_vault!
14
- ensure_executable!("session-manager-plugin", "Needed for SSM: brew install session-manager-plugin")
15
9
  end
16
10
 
17
11
  def check_ruby_version!
@@ -28,71 +22,6 @@ class PayCLI::Commands::Doctor
28
22
  end
29
23
  end
30
24
 
31
- def check_secrets_file!
32
- secrets_template = <<~SECRETS
33
- ---
34
- test-12:
35
- terraform: {}
36
- connector: {}
37
- ...
38
- SECRETS
39
-
40
- secrets_explainer = <<~EXPLAIN
41
- # We want to ensure that the local secrets file looks like
42
- # Env (map)
43
- # Service (map)
44
- # SecretName => SecretValue
45
- EXPLAIN
46
-
47
- if File.exist? PayCLI::Config::LOCAL_SECRETS_PATH
48
- STDERR.puts "✅ Local secrets file already exists"
49
- else
50
- STDERR.puts "🔧 Making local secrets file"
51
- FileUtils.mkdir_p File.dirname(PayCLI::Config::LOCAL_SECRETS_PATH)
52
- File.write(PayCLI::Config::LOCAL_SECRETS_PATH, secrets_template)
53
- end
54
-
55
- secrets_content = YAML.load_file(PayCLI::Config::LOCAL_SECRETS_PATH)
56
- # keys is necessary otherwise yaml gets unwound
57
- secrets_are_correct = secrets_content.keys.all? do |env|
58
- secrets = secrets_content[env]
59
- unless secrets.class == Hash
60
- false
61
- else
62
- if secrets.empty?
63
- secrets.class == Hash
64
- else
65
- # necessary otherwise we get yaml mangling and get the wrong type
66
- first_value = secrets[secrets.keys.first]
67
- first_value.class == Hash
68
- end
69
- end
70
- end
71
-
72
- if secrets_are_correct
73
- STDERR.puts "✅ Local secrets looks okay"
74
- else
75
- STDERR.puts "🔥 Local secrets file is most likely out of date"
76
- STDERR.puts "🔥 Example of a good secrets file:"
77
- STDERR.puts "# #{PayCLI::Config::LOCAL_SECRETS_PATH}"
78
- STDERR.puts secrets_template
79
- STDERR.puts '# end of file'
80
- STDERR.puts secrets_explainer
81
- end
82
- end
83
-
84
- def check_old_pay_config_dir!
85
- old_secrets_dir = File.dirname(
86
- PayCLI::Config::LOCAL_SECRETS_PATH.gsub('.govuk-', '.')
87
- )
88
-
89
- if File.exist? old_secrets_dir
90
- STDERR.puts "🔥 Old pay config directory still exists (#{old_secrets_dir})"
91
- else
92
- STDERR.puts "✅ Old pay config directory deleted"
93
- end
94
- end
95
-
96
25
  def check_workspace!
97
26
  # Normally in doctor we continue to more tests, but if WORKSPACE isn't set lots of the tests will result in a crash
98
27
  if ! ENV.has_key?('WORKSPACE')
@@ -108,23 +37,10 @@ class PayCLI::Commands::Doctor
108
37
  STDERR.puts "✅ WORKSPACE looks okay"
109
38
  end
110
39
 
111
- def check_pay_low_pass!
112
- pay_low_pass_path = File.expand_path(ENV['WORKSPACE'], 'pay-low-pass')
113
- if File.exist? pay_low_pass_path
114
- STDERR.puts "✅ pay-low-pass is in the right place"
115
- else
116
- STDERR.puts "🔥 pay-low-pass is not present in #{pay_low_pass_path}"
117
- end
118
- end
119
-
120
40
  def check_terraform!
121
41
  ensure_executable!("terraform")
122
42
  end
123
43
 
124
- def check_aws!
125
- ensure_executable!("aws")
126
- end
127
-
128
44
  def ensure_executable!(executable, instructions_if_missing = nil)
129
45
  `which "#{executable}"`.chomp
130
46
  if $?.success?
@@ -154,5 +70,4 @@ class PayCLI::Commands::Doctor
154
70
  STDERR.puts "✅ aws-vault #{required_version} or greater is in your path"
155
71
  end
156
72
  end
157
-
158
73
  end
@@ -1,25 +1,3 @@
1
1
  module PayCLI::Config
2
- COMMANDS = %w(
3
- aws
4
- browse
5
- build
6
- deploy
7
- doctor
8
- dns
9
- healthcheck
10
- logs
11
- purgatory
12
- scale
13
- secrets
14
- tf
15
- tunnel
16
- validate
17
- performance
18
- ).freeze
19
-
20
- CLI_PATH = File.expand_path(File.join(__dir__, '..', '..'))
21
- CONFIG_PATH = File.join CLI_PATH, 'config'
22
- LOCAL_SECRETS_PATH = File.expand_path(
23
- File.join('~', '.govuk-pay', 'secrets.yml')
24
- )
2
+ CLI_PATH = File.expand_path(File.join(__dir__, '..', '..'))
25
3
  end
@@ -1,41 +1,24 @@
1
1
  require 'thor'
2
+ # This is a load bearing import of aws-sdk-route53, without it everything explodes....
3
+ # I don't understand why, but given we are binning this ruby CLI it's not worth the effort
4
+ # to untangle....so just leave it here and life will be better
5
+ require 'aws-sdk-route53'
2
6
 
3
7
  $LOAD_PATH << File.join(File.dirname(__FILE__))
4
8
 
5
9
  class PayCLI::EntryPoint < Thor
6
- desc 'aws', 'Interactions with AWS, e.g. fetching STS tokens'
7
- subcommand 'aws', PayCLI::Commands::Aws
8
-
9
- desc 'browse', 'Opens web browser link to useful links'
10
- subcommand 'browse', PayCLI::Commands::Browse
11
-
12
10
  desc 'doctor', 'Attempts to initialise or fix the Pay CLI'
13
-
14
11
  def doctor(*_args)
15
12
  PayCLI::Commands::Doctor.new.start!
16
13
  end
17
14
 
18
- desc 'secrets', 'Manage secrets in and between environments'
19
- subcommand 'secrets', PayCLI::Commands::Secrets
20
-
21
- desc 'ssm', 'Start an SSM session to boxes in environments'
22
-
23
- def ssm(*_args)
24
- PayCLI::Commands::Ssm.start!
25
- end
26
-
27
15
  desc 'tf', 'Runs Terraform'
28
-
29
16
  def tf(*_args)
30
17
  PayCLI::Commands::Tf.start!
31
18
  end
32
19
 
33
- desc 'local', 'Sets up local Pay development environment'
34
- subcommand 'local', PayCLI::Commands::Local
35
-
36
20
  desc 'schema', 'Generates web based database diagrams and metadata locally'
37
21
  def schema(*_args)
38
22
  PayCLI::Commands::Schema.start!
39
23
  end
40
-
41
24
  end
@@ -1 +0,0 @@
1
- --require spec_helper
@@ -1,9 +0,0 @@
1
- products-ui:
2
- SESSION_ENCRYPTION_KEY: random:20
3
-
4
- selfservice:
5
- SESSION_ENCRYPTION_KEY: random:20
6
-
7
- frontend:
8
- SESSION_ENCRYPTION_KEY: random:20
9
- SESSION_ENCRYPTION_KEY_2: random:20