fpm-fry 0.6.3 → 0.7.1

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: 3d03481dd318deb8b40460423f2029cb88c6bac211d564ac79a5cee1bb39fc47
4
- data.tar.gz: cea0a428ec17eb9efd64ca4cb13612f85f807876137f29a649f4445e930a2fe9
3
+ metadata.gz: 15acbb0f9196652a3e2269a7e9dbfc9f3e0e215a42d7e24d03a955c17171ad5c
4
+ data.tar.gz: db1351dac3ce47056b35fc257eee88480292da50efa53c96cb5a14c68df8e794
5
5
  SHA512:
6
- metadata.gz: a503b0c59cc14c77ed9f68c917f8947458d919a439a79d40abea054e981ff3d47060b52e3a167e649e9e3775901832af088d999ccae99fd3ea30dc055a17ef81
7
- data.tar.gz: 7164f000cb4591d21a2cd7c776e52d056c33e8523581f6bd864d25889b87b48d38a6e9794dd85ed7520734c88e8562675cc5b857b8bad8804600cb60f367b1de
6
+ metadata.gz: c73cf50dbd9e5e8105fbd37c8af6cf95655241121afa7ba0853b61b1a97e745f1d8ea1b6694dd492e9725f60b6296d443f0237b4837b9601d9bf678cdef9f442
7
+ data.tar.gz: 8a3aa11180a66194d08c7f9a7a643f3136b4455c74ba14b3342e4d6255cd034ad554a14b422540352075af055785bc1f4b2e101d3bc0f61874f77e92dd035881
@@ -5,9 +5,10 @@ module FPM; module Fry
5
5
  option '--keep', :flag, 'Keep the container after build'
6
6
  option '--overwrite', :flag, 'Overwrite package', default: true
7
7
  option '--verbose', :fag, 'Verbose output', default: false
8
+ option '--platform', 'PLATFORM', default: nil
8
9
 
9
10
  UPDATE_VALUES = ['auto','never','always']
10
- option '--update',"<#{UPDATE_VALUES.join('|')}>", 'Update image before installing packages ( only apt currently )',attribute_name: 'update', default: 'auto' do |value|
11
+ option '--update',"<#{UPDATE_VALUES.join('|')}>", 'Update image before installing packages ( only apt currently )', attribute_name: 'update', default: 'auto' do |value|
11
12
  if !UPDATE_VALUES.include? value
12
13
  raise "Unknown value for --update: #{value.inspect}\nPossible values are #{UPDATE_VALUES.join(', ')}"
13
14
  else
@@ -57,6 +58,7 @@ module FPM; module Fry
57
58
  b = nil
58
59
  Inspector.for_image(client, image) do |inspector|
59
60
  variables = Detector.detect(inspector)
61
+ variables[:architecture] = platform
60
62
  logger.debug("Loading recipe",variables: variables, recipe: recipe)
61
63
  b = Recipe::Builder.new(variables, logger: ui.logger, inspector: inspector)
62
64
  b.load_file( recipe )
@@ -124,11 +126,14 @@ module FPM; module Fry
124
126
  if res.status == 404
125
127
  df = DockerFile::Source.new(builder.variables.merge(image: image_id),cache)
126
128
  begin
127
- url = client.url("build?rm=1&dockerfile=#{DockerFile::NAME}&t=#{cachetag}")
129
+ url = client.url("build")
130
+ query = { rm: 1, dockerfile: DockerFile::NAME, t: cachetag }
131
+ query[:platform] = platform if platform
128
132
  client.post(
129
133
  headers: {
130
134
  'Content-Type'=>'application/tar'
131
135
  },
136
+ query: query,
132
137
  expects: [200],
133
138
  path: url,
134
139
  request_block: BlockEnumerator.new(df.tar_io)
@@ -145,11 +150,14 @@ module FPM; module Fry
145
150
  df = DockerFile::Build.new(cachetag, builder.variables.dup,builder.recipe, update: update?)
146
151
  parser = BuildOutputParser.new(out)
147
152
  begin
148
- url = client.url("build?rm=1&dockerfile=#{DockerFile::NAME}")
153
+ url = client.url("build")
154
+ query = { rm: 1, dockerfile: DockerFile::NAME}
155
+ query[:platform] = platform if platform
149
156
  res = client.post(
150
157
  headers: {
151
158
  'Content-Type'=>'application/tar'
152
159
  },
160
+ query: query,
153
161
  expects: [200],
154
162
  path: url,
155
163
  request_block: BlockEnumerator.new(df.tar_io),
@@ -198,14 +206,16 @@ module FPM; module Fry
198
206
  def build!
199
207
  body = begin
200
208
  url = client.url('containers','create')
201
- res = client.post(
209
+ args = {
202
210
  headers: {
203
211
  'Content-Type' => 'application/json'
204
212
  },
205
213
  path: url,
206
214
  expects: [201],
207
215
  body: JSON.generate({"Image" => build_image})
208
- )
216
+ }
217
+ args[:query] = { platform: platform } if platform
218
+ res = client.post(args)
209
219
  JSON.parse(res.body)
210
220
  rescue Excon::Error
211
221
  logger.error "could not create #{build_image}, url: #{url}"
@@ -274,7 +284,7 @@ module FPM; module Fry
274
284
  logger: logger,
275
285
  client: client,
276
286
  keep_modified_files: builder.keep_modified_files,
277
- verbose: verbose
287
+ verbose: verbose,
278
288
  )
279
289
  builder.recipe.apply_input(input)
280
290
  begin
@@ -331,6 +341,7 @@ module FPM; module Fry
331
341
 
332
342
  out_map.each do |output, package|
333
343
  package.apply_output(output)
344
+ adjust_package_architecture(output)
334
345
  adjust_package_settings(output)
335
346
  adjust_config_files(output)
336
347
  end
@@ -348,6 +359,11 @@ module FPM; module Fry
348
359
 
349
360
  end
350
361
 
362
+ def adjust_package_architecture(output)
363
+ # strip prefix and only use the architecture part
364
+ output.architecture = platform.split("/").last if platform
365
+ end
366
+
351
367
  def adjust_package_settings( output )
352
368
  # FPM ignores the file permissions on rpm packages.
353
369
  output.attributes[:rpm_use_file_permissions?] = true
@@ -12,7 +12,7 @@ module FPM; module Fry
12
12
 
13
13
  option '--debug', :flag, 'Turns on debugging'
14
14
  option '--[no-]tls', :flag, 'Turns on tls ( default is false for schema unix, tcp and http and true for https )'
15
- option '--[no-]tlsverify', :flag, 'Turns off tls peer verification', default:true, environment_variable: 'DOCKER_TLS_VERIFY'
15
+ option '--[no-]tlsverify', :flag, 'Turns off tls peer verification', default: true, environment_variable: 'DOCKER_TLS_VERIFY'
16
16
  option ["-t", "--tmpdir"], "PATH", 'Write tmp data to PATH', default: '/tmp/fpm-fry', attribute_name: :dir do |s|
17
17
  String(s)
18
18
  end
@@ -55,6 +55,10 @@ module FPM::Fry
55
55
  variables[:codename]
56
56
  end
57
57
 
58
+ def architecture
59
+ variables[:architecture]
60
+ end
61
+
58
62
  def iteration(value = Not)
59
63
  get_or_set('@iteration',value)
60
64
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fpm-fry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxime Lagresle
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2023-05-22 00:00:00.000000000 Z
16
+ date: 2023-06-14 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: excon