Skip to content

Commit f4b0a99

Browse files
committed
add config option
1 parent e594c0e commit f4b0a99

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
omnipackage-agent-ruby (0.1.2)
4+
omnipackage-agent-ruby (0.1.3)
55

66
GEM
77
remote: https://rubygems.org/
@@ -21,14 +21,14 @@ GEM
2121
parser (3.3.9.0)
2222
ast (~> 2.4.1)
2323
racc
24-
prism (1.5.0)
24+
prism (1.5.1)
2525
pry (0.15.2)
2626
coderay (~> 1.1)
2727
method_source (~> 1.0)
2828
racc (1.8.1)
2929
rainbow (3.1.1)
3030
rake (13.3.0)
31-
regexp_parser (2.11.2)
31+
regexp_parser (2.11.3)
3232
reline (0.6.2)
3333
io-console (~> 0.5)
3434
rubocop (1.80.2)

lib/omnipackage_agent/build/runner.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ def build_cli(mounts, commands) # rubocop: disable Metrics/AbcSize, Metrics/Meth
8484

8585
if image_cache.enabled
8686
<<~CLI.chomp
87-
#{lock.to_cli} '#{image_cache.rm_cli} ; #{config.container_runtime} run --name #{image_cache.container_name} --entrypoint /bin/sh #{mount_cli} #{limits.to_cli} #{env_cli} #{image_cache.image} -c "#{commands.join(' && ')}" && #{image_cache.commit_cli}'
87+
#{lock.to_cli} '#{image_cache.rm_cli} ; #{config.container_runtime} run --name #{image_cache.container_name} --entrypoint /bin/sh #{mount_cli} #{limits_cli} #{env_cli} #{image_cache.image} -c "#{commands.join(' && ')}" && #{image_cache.commit_cli}'
8888
CLI
8989
else
9090
<<~CLI.chomp
91-
#{config.container_runtime} run --rm --entrypoint /bin/sh #{mount_cli} #{limits.to_cli} #{env_cli} #{image_cache.image} -c "#{commands.join(' && ')}"
91+
#{config.container_runtime} run --rm --entrypoint /bin/sh #{mount_cli} #{limits_cli} #{env_cli} #{image_cache.image} -c "#{commands.join(' && ')}"
9292
CLI
9393
end
9494
end
@@ -141,6 +141,12 @@ def image_cache_deps(build_conf)
141141
deps
142142
end.freeze
143143
end
144+
145+
def limits_cli
146+
return '' if config.container_limits_disable
147+
148+
limits.to_cli
149+
end
144150
end
145151
end
146152
end

lib/omnipackage_agent/config.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def load_file(fpath)
3535
apihost: ::String,
3636
build_dir: ::String,
3737
lockfiles_dir: ::String,
38-
image_cache_enable: [::TrueClass, ::FalseClass]
38+
image_cache_enable: [::TrueClass, ::FalseClass],
39+
container_limits_disable: [::TrueClass, ::FalseClass],
3940
}.freeze
4041

4142
def initialize(hash, attributes = ATTRIBUTES) # rubocop: disable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity

lib/omnipackage_agent/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module OmnipackageAgent
4-
VERSION = '0.1.2'
4+
VERSION = '0.1.3'
55
end

support/config.yml.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ lockfiles_dir: "<%= ::Dir.tmpdir %>/omnipackage-lock"
1212

1313
# optionally enable image cache to reduce subsequent build time in expense of storage space
1414
image_cache_enable: false
15+
16+
# optionally disable cpu/memory limits in child containers
17+
container_limits_disable: true

0 commit comments

Comments
 (0)