build-labels 0.0.11 → 0.0.13

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: 7c13448f17c62d3fd9278e6c956c55e2138644708802993b56e8fbc9482ef8d4
4
- data.tar.gz: b31a275746908a7a12aa58ee388b9800af43615afa71c44abe81c5ea28d31ccd
3
+ metadata.gz: 6ec498cbc10336a3948caf8d7f00c727a470313334c40d991df4bdaa242b52e2
4
+ data.tar.gz: fb2e1057d222673564957cea9aac81ee29d80f2b1434af9430933ca4d19e44ca
5
5
  SHA512:
6
- metadata.gz: f17feaefdde6ad275adaf8868f42e9d41639caebd4220fd11c13aa8ec0b752bd3d9a87432b51188b862c042c573cc187ffa9acd9772220de45cf62d098dd1ca2
7
- data.tar.gz: b13144e423f47fae5c5ce074c68f7a8ea176a32b9940d56ad51160ba0686e1654949b7c9da99fd43bb1ef372ebfb92e18c5f2a433eaaecd03c252dcdb169533e
6
+ metadata.gz: b67676c6fcbb6dca1fc79f4e7e946464a90db61b39ad2c8e262bce0d7b04ae533a38aa7cdedc39beb0d036ca92173fbd036d0db678af372429aa69ea45617dc0
7
+ data.tar.gz: c840ad0c2058f3d4f2cdc964913b28aa33dd67320a348e128535c81c81c8c81217c4b3145c3fb45fd42649690c15b9a3dfc621bd55acf4b772f6b319f8d9a1b7
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'].gsub( /:.*/, '')
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
+
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module BuildLabels
2
2
  class Builder
3
- VERSION = '0.0.11'
3
+ VERSION = '0.0.13'
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.11
4
+ version: 0.0.13
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-09-02 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