fpm-fry 0.6.3 → 0.7.0

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: 40cca764e11751a11f15254d74ab7324d02adf9b6d2852822baaeb668600c5e2
4
+ data.tar.gz: d017698f4fae8e13f33eb99ddbd7bef77d8e6cdd9e3b0d57b1bb4082b5d21164
5
5
  SHA512:
6
- metadata.gz: a503b0c59cc14c77ed9f68c917f8947458d919a439a79d40abea054e981ff3d47060b52e3a167e649e9e3775901832af088d999ccae99fd3ea30dc055a17ef81
7
- data.tar.gz: 7164f000cb4591d21a2cd7c776e52d056c33e8523581f6bd864d25889b87b48d38a6e9794dd85ed7520734c88e8562675cc5b857b8bad8804600cb60f367b1de
6
+ metadata.gz: 250eac98d2fce4db0ea393a4eaea6108df9b05dd40f1770acd56e74cd5456b615ceffc34a6097b1d9d607fe59508586f17e2f24f44e88893203b16c8d4d9d1fc
7
+ data.tar.gz: ca3d321f4ec3fd487cff204530a7831ec92641d726ce68a1a304e13a402cd8534cb6f9bcd3eff6cf9da2f2c8850898237797e007153c0a1125de6b9d53d381a2
@@ -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
@@ -124,11 +125,14 @@ module FPM; module Fry
124
125
  if res.status == 404
125
126
  df = DockerFile::Source.new(builder.variables.merge(image: image_id),cache)
126
127
  begin
127
- url = client.url("build?rm=1&dockerfile=#{DockerFile::NAME}&t=#{cachetag}")
128
+ url = client.url("build")
129
+ query = { rm: 1, dockerfile: DockerFile::NAME, t: cachetag }
130
+ query[:platform] = platform if platform
128
131
  client.post(
129
132
  headers: {
130
133
  'Content-Type'=>'application/tar'
131
134
  },
135
+ query: query,
132
136
  expects: [200],
133
137
  path: url,
134
138
  request_block: BlockEnumerator.new(df.tar_io)
@@ -145,11 +149,14 @@ module FPM; module Fry
145
149
  df = DockerFile::Build.new(cachetag, builder.variables.dup,builder.recipe, update: update?)
146
150
  parser = BuildOutputParser.new(out)
147
151
  begin
148
- url = client.url("build?rm=1&dockerfile=#{DockerFile::NAME}")
152
+ url = client.url("build")
153
+ query = { rm: 1, dockerfile: DockerFile::NAME}
154
+ query[:platform] = platform if platform
149
155
  res = client.post(
150
156
  headers: {
151
157
  'Content-Type'=>'application/tar'
152
158
  },
159
+ query: query,
153
160
  expects: [200],
154
161
  path: url,
155
162
  request_block: BlockEnumerator.new(df.tar_io),
@@ -198,14 +205,16 @@ module FPM; module Fry
198
205
  def build!
199
206
  body = begin
200
207
  url = client.url('containers','create')
201
- res = client.post(
208
+ args = {
202
209
  headers: {
203
210
  'Content-Type' => 'application/json'
204
211
  },
205
212
  path: url,
206
213
  expects: [201],
207
214
  body: JSON.generate({"Image" => build_image})
208
- )
215
+ }
216
+ args[:query] = { platform: platform } if platform
217
+ res = client.post(args)
209
218
  JSON.parse(res.body)
210
219
  rescue Excon::Error
211
220
  logger.error "could not create #{build_image}, url: #{url}"
@@ -274,7 +283,7 @@ module FPM; module Fry
274
283
  logger: logger,
275
284
  client: client,
276
285
  keep_modified_files: builder.keep_modified_files,
277
- verbose: verbose
286
+ verbose: verbose,
278
287
  )
279
288
  builder.recipe.apply_input(input)
280
289
  begin
@@ -331,6 +340,7 @@ module FPM; module Fry
331
340
 
332
341
  out_map.each do |output, package|
333
342
  package.apply_output(output)
343
+ adjust_package_architecture(output)
334
344
  adjust_package_settings(output)
335
345
  adjust_config_files(output)
336
346
  end
@@ -348,6 +358,11 @@ module FPM; module Fry
348
358
 
349
359
  end
350
360
 
361
+ def adjust_package_architecture(output)
362
+ # strip prefix and only use the architecture part
363
+ output.architecture = platform.split("/").last if platform
364
+ end
365
+
351
366
  def adjust_package_settings( output )
352
367
  # FPM ignores the file permissions on rpm packages.
353
368
  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
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.0
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-13 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: excon