exercism-config 0.41.0 → 0.46.0

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: 01f964544c9ddec6effc25a1b417ed9d2f3d0c5dcb98ebae0b6cd9c4b62e3963
4
- data.tar.gz: 61a0591b8b221bed122b2dc12cfceff707aaf7005f56335bab86e1e31633210b
3
+ metadata.gz: eb3b0fea425fb02156daa4db89fea9defa16dc54962b5c299359ada000d1f86a
4
+ data.tar.gz: ff4e9535337514761b1f09d3bb7172abd50a3a054dde0e1d7dae3347a3205433
5
5
  SHA512:
6
- metadata.gz: dd48bdaf9a8b8a86a3934e886442b6c23fd5285a2f0a578d0b6209ac1ac5b88ad58d2e34401459c84dbb7f0d57a99b5ef411199016f43833744811656ae6f188
7
- data.tar.gz: d0ac7eee145662d64d964f6b6dfd19d85aa780d5d387d9fb5c53adbe1c0963556389d4dfedb985c1617e81754d8ea5dc9e9befffecfe069826767d79d510e48f
6
+ metadata.gz: d59a574a95d289b4d37260e8c442b4351f8a176ba2528af98329c9cdd0e0e75b74410be73a239c707343a207fdc9425af3d2eb7300836506bfcba06ff35acfa4
7
+ data.tar.gz: 7f223275f782bd6113a1a1d973f550c3d08e511d6da64eddad8754ca48f3d267304faf4c00a7651aae4d6556d15242bb5d7b865eab0fdb15d05609c0fd94db80
@@ -13,11 +13,9 @@ Exercism.config.dynamodb_client = ExercismConfig::SetupDynamoDBClient.()
13
13
  # Setup local s3 #
14
14
  ##################
15
15
 
16
- # We don't need this running for CI atm as none of our
17
- # tests actually hit s3. Although we might choose to change this
18
- unless ENV["EXERCISM_CI"] || ENV["EXERCISM_SKIP_S3"]
16
+ unless ENV["EXERCISM_SKIP_S3"]
19
17
  [
20
- Exercism.config.aws_iterations_bucket,
18
+ Exercism.config.aws_submissions_bucket,
21
19
  Exercism.config.aws_tooling_jobs_bucket,
22
20
  ].each do |bucket|
23
21
  begin
@@ -30,10 +28,13 @@ unless ENV["EXERCISM_CI"] || ENV["EXERCISM_SKIP_S3"]
30
28
  end
31
29
  end
32
30
 
33
- ########################
34
- # Setup local dynamodb #
35
- ########################
36
- %w[tooling_jobs tooling_jobs-test].each do |table_name|
31
+ ###########################################
32
+ # Setup local dynamodb tooling jobs table #
33
+ ###########################################
34
+ [
35
+ Exercism.config.dynamodb_tooling_jobs_table,
36
+ Exercism.config.dynamodb_tooling_jobs_table + "-test"
37
+ ].each do |table_name|
37
38
  begin
38
39
  Exercism.config.dynamodb_client.delete_table(
39
40
  table_name: table_name
@@ -99,4 +100,80 @@ end
99
100
  }
100
101
  ]
101
102
  )
103
+
104
+ Exercism.config.dynamodb_client.update_table(
105
+ table_name: table_name,
106
+ attribute_definitions: [
107
+ {
108
+ attribute_name: "submission_uuid",
109
+ attribute_type: "S"
110
+ },
111
+ {
112
+ attribute_name: "type",
113
+ attribute_type: "S"
114
+ }
115
+ ],
116
+ global_secondary_index_updates: [
117
+ {
118
+ create: {
119
+ index_name: "submission_type", # required
120
+ key_schema: [ # required
121
+ {
122
+ attribute_name: "submission_uuid", # required
123
+ key_type: "HASH" # required, accepts HASH, RANGE
124
+ },
125
+ {
126
+ attribute_name: "type", # required
127
+ key_type: "RANGE" # required, accepts HASH, RANGE
128
+ }
129
+ ],
130
+ projection: { # required
131
+ projection_type: "INCLUDE",
132
+ non_key_attributes: ["id", "job_status"]
133
+ },
134
+ provisioned_throughput: {
135
+ read_capacity_units: 1, # required
136
+ write_capacity_units: 1 # required
137
+ }
138
+ }
139
+ }
140
+ ]
141
+ )
142
+ end
143
+
144
+ ##############################################
145
+ # Setup local dynamodb language groups table #
146
+ ##############################################
147
+ [
148
+ Exercism.config.dynamodb_tooling_language_groups_table,
149
+ Exercism.config.dynamodb_tooling_language_groups_table + "-test"
150
+ ].each do |table_name|
151
+ begin
152
+ Exercism.config.dynamodb_client.delete_table(
153
+ table_name: table_name
154
+ )
155
+ rescue Aws::DynamoDB::Errors::ResourceNotFoundException
156
+ end
157
+ puts "[x] #{table_name}"
158
+
159
+ Exercism.config.dynamodb_client.create_table(
160
+ table_name: table_name,
161
+ attribute_definitions: [
162
+ {
163
+ attribute_name: "group",
164
+ attribute_type: "S"
165
+ }
166
+ ],
167
+ key_schema: [
168
+ {
169
+ attribute_name: "group",
170
+ key_type: "HASH"
171
+ }
172
+ ],
173
+ provisioned_throughput: {
174
+ read_capacity_units: 1,
175
+ write_capacity_units: 1
176
+ }
177
+ )
102
178
  end
179
+
@@ -7,6 +7,7 @@ require_relative 'exercism_config/environment'
7
7
  require_relative 'exercism_config/determine_environment'
8
8
  require_relative 'exercism_config/generate_aws_settings'
9
9
  require_relative 'exercism_config/setup_dynamodb_client'
10
+ require_relative 'exercism_config/setup_ecr_client'
10
11
  require_relative 'exercism_config/setup_s3_client'
11
12
  require_relative 'exercism_config/retrieve'
12
13
  require_relative 'exercism_config/generate_aws_settings'
@@ -2,6 +2,7 @@ module Exercism
2
2
  class Config < OpenStruct
3
3
  PROPS_WITH_TEST_SUFFIX = %i[
4
4
  dynamodb_tooling_jobs_table
5
+ dynamodb_tooling_language_groups_table
5
6
  ].freeze
6
7
 
7
8
  def initialize(data, aws_settings)
@@ -4,6 +4,10 @@ module ExercismConfig
4
4
 
5
5
  def call
6
6
  env = ENV['EXERCISM_ENV'] || ENV['RAILS_ENV'] || ENV['APP_ENV']
7
+ unless env
8
+ env = Rails.env.to_s if Object.const_defined?(:Rails) && Rails.respond_to?(:env)
9
+ end
10
+
7
11
  raise Exercism::ConfigError, 'No environment set - set one of EXERCISM_ENV, RAILS_ENV or APP_ENV' unless env
8
12
 
9
13
  Environment.new(env)
@@ -0,0 +1,18 @@
1
+ module ExercismConfig
2
+ class SetupECRClient
3
+ include Mandate
4
+
5
+ def call
6
+ aws_settings = GenerateAwsSettings.().merge(
7
+ # endpoint: config_endpoint,
8
+
9
+ # We don't want a profile for this AWS service
10
+ # as we run it locally. But we do normally, so
11
+ # we locally override this here.
12
+ profile: nil
13
+ ).select { |_k, v| v }
14
+
15
+ Aws::ECR::Client.new(aws_settings)
16
+ end
17
+ end
18
+ end
@@ -21,7 +21,7 @@ module ExercismConfig
21
21
  memoize
22
22
  def config_endpoint
23
23
  return nil if Exercism.env.production?
24
- return "http://127.0.0.1:#{ENV['S3_PORT']}" if ENV['EXERCISM_CI']
24
+ return "http://127.0.0.1:#{ENV['S3_PORT']}" if Exercism.env.test? && ENV['EXERCISM_CI']
25
25
 
26
26
  host = ENV['EXERCISM_DOCKER'] ? 's3:9090' : 'localhost:3041'
27
27
  "http://#{host}"
@@ -1,3 +1,3 @@
1
1
  module ExercismConfig
2
- VERSION = '0.41.0'.freeze
2
+ VERSION = '0.46.0'.freeze
3
3
  end
@@ -1,8 +1,9 @@
1
1
  anycable_redis_url: redis://127.0.0.1:6379/1
2
2
  anycable_rpc_host: 127.0.0.1:50051
3
- aws_iterations_bucket: exercism-staging-iterations
3
+ aws_submissions_bucket: exercism-staging-submissions
4
4
  aws_tooling_jobs_bucket: exercism-staging-tooling-jobs
5
5
  dynamodb_tooling_jobs_table: tooling_jobs
6
+ dynamodb_tooling_language_groups_table: tooling_language_groups
6
7
  spi_url: http://127.0.0.1:3020
7
8
  tooling_orchestrator_url: http://127.0.0.1:3021
8
9
 
@@ -1,8 +1,9 @@
1
1
  anycable_redis_url: redis://redis:6379/1
2
2
  anycable_rpc_host: 0.0.0.0:50051
3
- aws_iterations_bucket: exercism-staging-iterations
3
+ aws_submissions_bucket: exercism-staging-submissions
4
4
  aws_tooling_jobs_bucket: exercism-staging-tooling-jobs
5
5
  dynamodb_tooling_jobs_table: tooling_jobs
6
+ dynamodb_tooling_language_groups_table: tooling_language_groups
6
7
  mysql_master_endpoint: mysql
7
8
  mysql_port: 3306
8
9
  spi_url: http://website:3020
@@ -1,8 +1,9 @@
1
1
  anycable_redis_url: redis://127.0.0.1:6379/1
2
2
  anycable_rpc_host: 127.0.0.1:50051
3
- aws_iterations_bucket: exercism-staging-iterations
3
+ aws_submissions_bucket: exercism-staging-submissions
4
4
  aws_tooling_jobs_bucket: exercism-staging-tooling-jobs
5
5
  dynamodb_tooling_jobs_table: tooling_jobs
6
+ dynamodb_tooling_language_groups_table: tooling_language_groups
6
7
  mysql_master_endpoint: localhost
7
8
  mysql_socket: /tmp/mysql.sock
8
9
  spi_url: http://127.0.0.1:3020
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exercism-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.41.0
4
+ version: 0.46.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Walker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-29 00:00:00.000000000 Z
11
+ date: 2020-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-dynamodb
@@ -153,6 +153,7 @@ files:
153
153
  - lib/exercism_config/generate_aws_settings.rb
154
154
  - lib/exercism_config/retrieve.rb
155
155
  - lib/exercism_config/setup_dynamodb_client.rb
156
+ - lib/exercism_config/setup_ecr_client.rb
156
157
  - lib/exercism_config/setup_s3_client.rb
157
158
  - lib/exercism_config/version.rb
158
159
  - package.json