wslc-wip 0.17.5 → 0.17.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae440c584eee01b5fca703f10fe051f457cd24534a54b8d2c76fe485d33fc256
4
- data.tar.gz: '0078b9598b5084d7b62ff7cf3aa85589c61739801bdae6d8bfa76e3218459fde'
3
+ metadata.gz: adf27a8bafbb2482bfe25b393e3623a39fd0c8d77f92a7c6e6e60286506c8f17
4
+ data.tar.gz: 77d180849706ea0915e82c03a7bfcae6d5ee0c581a87db808e3eceacdb0b8210
5
5
  SHA512:
6
- metadata.gz: 8d92d054446d0b517db26312afa196e0f4486181ea3c6254d7eecb11a4bd239c5b0a48ff28804d3c2806d1acfc0f9beeaebcce5dcacdd73855b3ed629386774d
7
- data.tar.gz: 0b19afc749ee393752613e27306b56559e8ff5c31d29f0248ddc2bee05e0ba4b327725cef1a371b9f24f4fc9fef85c5972e1a005e041003100bd2e44a2c9f664
6
+ metadata.gz: f894b61d72a792604221a0bc41c5bef018cb2257ee7469d958f17f96fd5de57e52f2a1665b74e51bfbbd3e6cea6ba9f684f42a4ab64747462098c4742b7cd350
7
+ data.tar.gz: 68201cce4009583ffee442f06858d930a9d618a399553fbf04523281c8012630e0c8bedc1517012b5f9afca9896612d42829206303943b5548118d0a2d960d17
data/README.md CHANGED
@@ -370,8 +370,8 @@ valid compose.yml over sections it doesn't need to look at:
370
370
  | `wip version` | wip's version, plus WSLC's if it can be detected |
371
371
  | `wip doctor` | Diagnose WSL2, interop, WSLC, config, architecture, and Git |
372
372
  | `wip config` | Print the effective configuration (secrets masked) |
373
- | `wip build -- --no-cache` | Build the image from the `build` definition |
374
- | `wip up [-d] [--no-sync]` | Start the primary `dependencies:` entry (`container:` names which one) and its sidecars (creating any that are missing, on `network:` if set). `-d` runs the main container in the background; with `sync:` configured, the source is mirrored into the volume first unless `--no-sync` |
373
+ | `wip build [--no-cache] [-- OPTIONS]` | Build the image from the `build` definition. By default, wip passes the target tag as `--cache-from` so previous layers can be reused; `--no-cache` disables that cache path. |
374
+ | `wip up [-d] [--no-sync] [--no-cache]` | Start the primary `dependencies:` entry (`container:` names which one) and its sidecars (creating any that are missing, on `network:` if set). `-d` runs the main container in the background; with `sync:` configured, the source is mirrored into the volume first unless `--no-sync` |
375
375
  | `wip down` | Stop and remove the primary container and its sidecar `dependencies:` |
376
376
  | `wip exec [--no-interactive] COMMAND...` | Run a command in the existing container |
377
377
  | `wip run [--no-interactive] COMMAND...` | Run a command in a new `--rm` container (mode: compose `exec`s into `compose.service` instead — see "Compose mode" above) |
data/lib/wip/cli.rb CHANGED
@@ -66,8 +66,9 @@ module Wip
66
66
  end
67
67
 
68
68
  desc 'build [OPTIONS]', 'Build the configured image'
69
+ option :no_cache, type: :boolean, default: false, desc: 'Build without using cached layers'
69
70
  def build(*extra)
70
- extra.shift if extra.first == '--'
71
+ extra = build_extra_options(extra)
71
72
  settings = load_config.command('build') || {}
72
73
  context = Pathname(load_config.path).dirname.join(settings['context'] || '.').to_s
73
74
  warn "wip: staging build context (#{context})"
@@ -84,6 +85,7 @@ module Wip
84
85
  desc 'up', 'Start the configured container and its dependencies, creating them if necessary'
85
86
  option :detach, type: :boolean, default: false, aliases: '-d'
86
87
  option :sync, type: :boolean, default: true, desc: 'Mirror the source into the sync volume first (--no-sync skips)'
88
+ option :no_cache, type: :boolean, default: false, desc: 'Build compose-native images without cached layers'
87
89
  def up
88
90
  if load_config.compose?
89
91
  sync_before_boot if options[:sync]
@@ -308,8 +310,7 @@ module Wip
308
310
  # Stages spec['context'] the same way `wip build` does, so a .dockerignore next to
309
311
  # a compose-native service's build: is honored and progress is reported here too.
310
312
  def build_compose_image(spec)
311
- extra = spec['dockerfile'] ? ['-f', spec['dockerfile']] : []
312
- spec['args']&.each { |key, value| extra.push('--build-arg', "#{key}=#{value}") }
313
+ extra = compose_build_extra(spec)
313
314
  warn "wip: staging build context (#{spec['context']})"
314
315
  progress = StagingProgress.new
315
316
  BuildContext.new(spec['context']).stage(on_progress: progress.method(:tick)) do |staged_context|
@@ -321,6 +322,23 @@ module Wip
321
322
  progress&.finish
322
323
  end
323
324
 
325
+ def build_extra_options(extra)
326
+ extra = extra.dup
327
+ extra.shift if extra.first == '--'
328
+ with_no_cache_option(extra)
329
+ end
330
+
331
+ def compose_build_extra(spec)
332
+ extra = spec['dockerfile'] ? ['-f', spec['dockerfile']] : []
333
+ spec['args']&.each { |key, value| extra.push('--build-arg', "#{key}=#{value}") }
334
+ with_no_cache_option(extra)
335
+ end
336
+
337
+ def with_no_cache_option(extra)
338
+ extra.unshift('--no-cache') if options[:no_cache] && !extra.include?('--no-cache')
339
+ extra
340
+ end
341
+
324
342
  # Builds sync.build's image once per invocation (not per --watch tick, which
325
343
  # would pay Docker build-cache-lookup overhead on every mirror for no reason).
326
344
  # A no-op unless sync.build is configured.
@@ -142,7 +142,8 @@ module Wip
142
142
  tag = values['tag'] || values['image']
143
143
  raise ConfigError, 'Build image/tag must not be empty' if tag.to_s.empty?
144
144
 
145
- [@wslc, 'build', '-t', tag, *extra, context]
145
+ cache_options = extra.include?('--no-cache') ? [] : ['--cache-from', tag]
146
+ [@wslc, 'build', '-t', tag, *cache_options, *extra, context]
146
147
  end
147
148
 
148
149
  def custom(name, arguments)
data/lib/wip/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wip
4
- VERSION = '0.17.5'
4
+ VERSION = '0.17.6'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wslc-wip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.5
4
+ version: 0.17.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wip contributors