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 +4 -4
- data/bin/build-labels +1 -0
- data/lib/build-labels/builder.rb +1 -1
- data/lib/build-labels/command_cache.rb +25 -0
- data/lib/build-labels/command_to_dockerfiles.rb +1 -1
- data/lib/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 720b52bf85f4f82c4c89fed5561ba93ef58c52fec91674848c751fe4af523ab2
|
4
|
+
data.tar.gz: 04a2c81b8b8662ea174d878a0f093e24e6abbeaf864348331eb14a7c87c2007c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/build-labels/builder.rb
CHANGED
@@ -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(&:
|
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
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.
|
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:
|
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:
|
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:
|
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
|