build-labels 0.0.10 → 0.0.12

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: daaf6cc3b069d9586bae2b848fbdc241badd60ea86ebb977cec28cf641305dee
4
- data.tar.gz: 79c980c2d71aca4b82b0c52c52815a493cfada3f51835c3fad7662c613ef246f
3
+ metadata.gz: 720b52bf85f4f82c4c89fed5561ba93ef58c52fec91674848c751fe4af523ab2
4
+ data.tar.gz: 04a2c81b8b8662ea174d878a0f093e24e6abbeaf864348331eb14a7c87c2007c
5
5
  SHA512:
6
- metadata.gz: c1c1ab92e86b73f7334493c7d0cbf956f8d9539904e1d7c7514faa0bb63c066e12e31d0f009d47ca135a4385947f7a35900db5b146355d7a7bc6f07d8a478b5e
7
- data.tar.gz: 00e0e3ceb492e339757e79ef9847f8231a142900f48fcca873e8bbfeac4a31e63b0157ba55a603c0269f6dff398496e961b0422d5355a2ae5cf9159eb90f1fc9
6
+ metadata.gz: 3e874e6162cc78d71a0c87df0d58635db9801903048ac7d77c93fca300fd1349805df377b8c4b4488ef05d0290a1c5a124401ee35aed8e25a626fe81722f5af0
7
+ data.tar.gz: 42f355c657e752ab004ceee45158043a059237e9388645c48b857664e7e184f1e5959d48ca8f8802ae10b0cdae432f89629cd6cd2c268f8f3a214b353f5f70a9
data/bin/build-labels CHANGED
@@ -8,6 +8,7 @@ require 'build-labels/command_line'
8
8
  require 'build-labels/command_to_compose'
9
9
  require 'build-labels/command_to_dockerfiles'
10
10
  require 'build-labels/command_gitlab'
11
+ require 'build-labels/command_cache'
11
12
  require 'build-labels/command_print'
12
13
 
13
14
  include BuildLabels
@@ -38,7 +38,7 @@ module BuildLabels
38
38
  def apply_environment
39
39
  @namespaces.each do |ns, struct|
40
40
  struct.each_pair do |name, value|
41
- value.sub! /^.*$/, `printf #{value}` if value.to_s =~ /\$/
41
+ value.sub!( /^.*$/, `printf #{value}`) if value.to_s =~ /\$/
42
42
  end
43
43
  end
44
44
  end
@@ -0,0 +1,25 @@
1
+ require_relative 'command_line'
2
+
3
+ BuildLabels::CommandLine::COMMANDS[:cache] = Class.new do
4
+ def run(builder, params, compose_text)
5
+ compose = YAML.load compose_text
6
+ compose['services'].each do |name, service|
7
+ next unless service['build']
8
+
9
+ if service['build'].class == String
10
+ service['build'] = { 'context' => service['build'] }
11
+ end
12
+ # registry = params[:registry]
13
+ image = service['image']
14
+ service['build']['cache_from'] = [ "type=registry,ref=#{image}:cache" ]
15
+ service['build']['cache_to'] = [ "type=registry,ref=#{image}:cache,mode=max" ]
16
+ # # - type=local,src=./.cache
17
+ # # - type=local,dest=./.cache,mode=max
18
+ end
19
+ compose_text.replace compose.to_yaml
20
+ end
21
+
22
+ def help = 'Add cache section'
23
+ end.new
24
+
25
+
@@ -14,7 +14,7 @@ BuildLabels::CommandLine::COMMANDS[:to_dockerfiles] = Class.new do
14
14
  dockerfile = File.expand_path dockerfile, compose_dir
15
15
  raise "file ot found: #{dockerfile}" unless File.exist? dockerfile
16
16
 
17
- dockerfile_lines = File.readlines(dockerfile).map(&:strip)
17
+ dockerfile_lines = File.readlines(dockerfile).map(&:rstrip)
18
18
 
19
19
  builder.each_labels do |ns, values|
20
20
  values.each_pair do |k, v|
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module BuildLabels
2
2
  class Builder
3
- VERSION = '0.0.10'
3
+ VERSION = '0.0.12'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-labels
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-21 00:00:00.000000000 Z
11
+ date: 2024-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.12'
47
+ version: 1.63.2
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.12'
54
+ version: 1.63.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop-rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -106,6 +106,7 @@ files:
106
106
  - examples/simple-compose.yml
107
107
  - lib/build-labels.rb
108
108
  - lib/build-labels/builder.rb
109
+ - lib/build-labels/command_cache.rb
109
110
  - lib/build-labels/command_gitlab.rb
110
111
  - lib/build-labels/command_line.rb
111
112
  - lib/build-labels/command_print.rb