fpm-fry 0.6.2 → 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: 4378e8616d6213898f76ec92b81ceed3cf591ac3f95dfb8d2cea75ea6ca0f2db
4
- data.tar.gz: e148dd2f1c9326046fb184332527551d46240efd029d713ffedaa41b6ad690bc
3
+ metadata.gz: 40cca764e11751a11f15254d74ab7324d02adf9b6d2852822baaeb668600c5e2
4
+ data.tar.gz: d017698f4fae8e13f33eb99ddbd7bef77d8e6cdd9e3b0d57b1bb4082b5d21164
5
5
  SHA512:
6
- metadata.gz: c6e0568bdf77a28ca62b093c3159e5a2a0eb13a157ed462ef6b77d2729a886f04434ab4c83ffe69a23e09c813053aa68730060a52f1ec3e3cd0ea6387702fba9
7
- data.tar.gz: ac6d77bef4612f2252b27dfcb2926da85c9f6b244cf8705a8d028de63da5f2de4f62febe4a2fc23d0e32aa88d656369a7815110575c0e8b91bf1f0f34b6a2286
6
+ metadata.gz: 250eac98d2fce4db0ea393a4eaea6108df9b05dd40f1770acd56e74cd5456b615ceffc34a6097b1d9d607fe59508586f17e2f24f44e88893203b16c8d4d9d1fc
7
+ data.tar.gz: ca3d321f4ec3fd487cff204530a7831ec92641d726ce68a1a304e13a402cd8534cb6f9bcd3eff6cf9da2f2c8850898237797e007153c0a1125de6b9d53d381a2
@@ -44,7 +44,7 @@ class FPM::Fry::Client
44
44
  ssl_verify_peer: options.fetch(:tlsverify){ false }
45
45
  }
46
46
  [:client_cert, :client_key, :ssl_ca_file].each do |k|
47
- if !File.exists?(@tls[k])
47
+ if !File.exist?(@tls[k])
48
48
  raise ArgumentError.new("#{k} #{@tls[k]} doesn't exist. Did you set DOCKER_CERT_PATH correctly?")
49
49
  end
50
50
  end
@@ -228,6 +228,8 @@ class FPM::Fry::Client
228
228
  when 'unix'
229
229
  uri = "unix:///"
230
230
  options[:socket] = address
231
+ options[:host] = ""
232
+ options[:hostname] = ""
231
233
  when 'tcp'
232
234
  if tls.any?
233
235
  return agent_for("https://#{address}", tls)
@@ -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
@@ -80,7 +81,7 @@ module FPM; module Fry
80
81
  end
81
82
 
82
83
  def lint_recipe_file!
83
- File.exists?(recipe) || raise(Recipe::NotFound)
84
+ File.exist?(recipe) || raise(Recipe::NotFound)
84
85
  end
85
86
 
86
87
  def lint_recipe!
@@ -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
@@ -368,7 +383,7 @@ module FPM; module Fry
368
383
  # Now that we have disabled this for debian we have to reenable if it for
369
384
  # all.
370
385
  etc = File.expand_path('etc', output.staging_path)
371
- if File.exists?( etc )
386
+ if File.exist?( etc )
372
387
  # Config plugin wasn't used. Add everything under /etc
373
388
  prefix_length = output.staging_path.size + 1
374
389
  added = []
@@ -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
@@ -72,7 +72,7 @@ module FPM; module Fry ; module Source
72
72
 
73
73
  def update
74
74
  begin
75
- if !File.exists? repodir
75
+ if !File.exist? repodir
76
76
  Exec::exec(package.git, "--git-dir=#{repodir}",'init', '--bare', description: "initializing git repository", logger: logger)
77
77
  end
78
78
  Exec::exec(package.git, "--git-dir=#{repodir}",'fetch','--depth=1', url.to_s, rev, description: 'fetching from remote', logger: logger)
@@ -118,7 +118,7 @@ module FPM; module Fry ; module Source
118
118
  raise ArgumentError, "Expected a Hash or a String, got #{file.inspect}"
119
119
  end
120
120
  options[:file] = File.expand_path(options[:file])
121
- if !File.exists?(options[:file])
121
+ if !File.exist?(options[:file])
122
122
  raise ArgumentError, "File doesn't exist: #{options[:file]}"
123
123
  end
124
124
  options
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.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxime Lagresle
@@ -10,10 +10,10 @@ authors:
10
10
  - Hannes Georg
11
11
  - Julian Tabel
12
12
  - Dennis Konert
13
- autorequire:
13
+ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2023-04-18 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
@@ -182,7 +182,7 @@ homepage: https://github.com/xing/fpm-fry
182
182
  licenses:
183
183
  - MIT
184
184
  metadata: {}
185
- post_install_message:
185
+ post_install_message:
186
186
  rdoc_options: []
187
187
  require_paths:
188
188
  - lib
@@ -197,8 +197,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  requirements: []
200
- rubygems_version: 3.1.6
201
- signing_key:
200
+ rubygems_version: 3.4.10
201
+ signing_key:
202
202
  specification_version: 4
203
203
  summary: FPM Fry
204
204
  test_files: []