Skip to content

Commit

Permalink
Merge pull request #49 from reproio/fix-yaml-loading
Browse files Browse the repository at this point in the history
Fix yaml loading for Ruby 3.1
  • Loading branch information
itkrt2y authored Apr 26, 2023
2 parents 8f0226d + 7617597 commit f22e090
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
- 2.7
- 3.0
- 3.1
- 3.2
os:
- ubuntu-latest
name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
Expand Down
7 changes: 6 additions & 1 deletion lib/wrapbox/config_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ def initialize
end

def load_yaml(yaml_file)
configs = YAML.load(ERB.new(File.read(yaml_file)).result)
file = ERB.new(File.read(yaml_file)).result
configs = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("4.0.0")
YAML.load(file, aliases: true)
else
YAML.load(file)
end
configs.each do |name, configuration|
load_config(name, configuration.merge("name" => name))
end
Expand Down
21 changes: 8 additions & 13 deletions spec/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
default:
base: &base
cluster: <%= ENV["ECS_CLUSTER"] %>
runner: ecs
region: ap-northeast-1

default:
<<: *base
container_definition:
image: joker1007/wrapbox@sha256:0925926e867244907f7f72b322a24312501719960d10c989a3847de4890ec55a
cpu: 256
Expand All @@ -20,9 +23,7 @@ docker:
memory: 1024

ecs_with_launch_template:
cluster: <%= ENV["ECS_CLUSTER"] %>
runner: ecs
region: ap-northeast-1
<<: *base
container_definition:
image: joker1007/wrapbox@sha256:0925926e867244907f7f72b322a24312501719960d10c989a3847de4890ec55a
cpu: 256
Expand All @@ -49,9 +50,7 @@ ecs_without_runner:
essential: true

ecs_enable_execute_command:
cluster: <%= ENV["ECS_CLUSTER"] %>
runner: ecs
region: ap-northeast-1
<<: *base
enable_execute_command: true
container_definition:
image: joker1007/wrapbox@sha256:0925926e867244907f7f72b322a24312501719960d10c989a3847de4890ec55a
Expand All @@ -60,9 +59,7 @@ ecs_enable_execute_command:
essential: true

ecs_disable_execute_command:
cluster: <%= ENV["ECS_CLUSTER"] %>
runner: ecs
region: ap-northeast-1
<<: *base
enable_execute_command: false
container_definition:
image: joker1007/wrapbox@sha256:0925926e867244907f7f72b322a24312501719960d10c989a3847de4890ec55a
Expand All @@ -71,9 +68,7 @@ ecs_disable_execute_command:
essential: true

ecs_with_awslogs_fetcher:
cluster: <%= ENV["ECS_CLUSTER"] %>
runner: ecs
region: ap-northeast-1
<<: *base
execution_role_arn: <%= ENV["EXECUTION_ROLE_ARN"] %>
log_fetcher:
type: awslogs
Expand Down

0 comments on commit f22e090

Please sign in to comment.