build-labels 0.0.11 → 0.0.13
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/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: 6ec498cbc10336a3948caf8d7f00c727a470313334c40d991df4bdaa242b52e2
         | 
| 4 | 
            +
              data.tar.gz: fb2e1057d222673564957cea9aac81ee29d80f2b1434af9430933ca4d19e44ca
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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
         | 
    
        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'].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
    
    
    
        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.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:  | 
| 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
         |