retag 0.1.0.73710 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +13 -0
- data/Gemfile.lock +121 -0
- data/bin/console +16 -0
- data/bin/retag +180 -0
- data/bin/setup +8 -0
- data/lib/retag/image.rb +4 -14
- data/lib/retag/repo.rb +43 -0
- data/lib/retag/service.rb +9 -32
- data/lib/retag/utils.rb +1 -1
- data/lib/retag/version.rb +1 -1
- data/lib/retag.rb +2 -0
- data/retag.gemspec +41 -0
- data/sig/retag.rbs +4 -0
- metadata +44 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab2e731e32312b3a61a674ad910c1193b77130f6b7f72a93ec0675580bd5b078
|
4
|
+
data.tar.gz: 97835c0e4826a38949abd6de5882652705594eba0c24b501c8cec96a23f44151
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8bcbd2c1f5d286e9729b93179c6b03905533d2d71a06b07b361a55994a69ad9ccd981c94a37ea925f69caceb390591eee716cd4656a359c9a47e13a911d844c
|
7
|
+
data.tar.gz: 0352ce3e3aab8140a8e65cde805f5ca7846238a9725178a5c42dada297f90ca3c45bdcdc7a143c3ee34b8ce71204cdaaf7b455b29d8a1175fafc8da6b1cfef56
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
retag (0.1.4)
|
5
|
+
activesupport (~> 6.0)
|
6
|
+
colorize
|
7
|
+
gitlab
|
8
|
+
json
|
9
|
+
thor
|
10
|
+
uri
|
11
|
+
yaml
|
12
|
+
|
13
|
+
GEM
|
14
|
+
remote: https://rubygems.org/
|
15
|
+
specs:
|
16
|
+
activesupport (6.1.4.4)
|
17
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
+
i18n (>= 1.6, < 2)
|
19
|
+
minitest (>= 5.1)
|
20
|
+
tzinfo (~> 2.0)
|
21
|
+
zeitwerk (~> 2.3)
|
22
|
+
addressable (2.8.0)
|
23
|
+
public_suffix (>= 2.0.2, < 5.0)
|
24
|
+
ansi (1.5.0)
|
25
|
+
ast (2.4.2)
|
26
|
+
colorize (0.8.1)
|
27
|
+
concurrent-ruby (1.1.9)
|
28
|
+
crack (0.4.5)
|
29
|
+
rexml
|
30
|
+
diff-lcs (1.5.0)
|
31
|
+
docile (1.4.0)
|
32
|
+
gitlab (4.18.0)
|
33
|
+
httparty (~> 0.18)
|
34
|
+
terminal-table (>= 1.5.1)
|
35
|
+
hashdiff (1.0.1)
|
36
|
+
httparty (0.20.0)
|
37
|
+
mime-types (~> 3.0)
|
38
|
+
multi_xml (>= 0.5.2)
|
39
|
+
i18n (1.8.11)
|
40
|
+
concurrent-ruby (~> 1.0)
|
41
|
+
json (2.6.1)
|
42
|
+
mime-types (3.4.1)
|
43
|
+
mime-types-data (~> 3.2015)
|
44
|
+
mime-types-data (3.2022.0105)
|
45
|
+
minitest (5.15.0)
|
46
|
+
multi_xml (0.6.0)
|
47
|
+
parallel (1.21.0)
|
48
|
+
parser (3.1.0.0)
|
49
|
+
ast (~> 2.4.1)
|
50
|
+
public_suffix (4.0.6)
|
51
|
+
rainbow (3.1.1)
|
52
|
+
rake (13.0.6)
|
53
|
+
regexp_parser (2.2.0)
|
54
|
+
rexml (3.2.5)
|
55
|
+
rspec (3.10.0)
|
56
|
+
rspec-core (~> 3.10.0)
|
57
|
+
rspec-expectations (~> 3.10.0)
|
58
|
+
rspec-mocks (~> 3.10.0)
|
59
|
+
rspec-core (3.10.1)
|
60
|
+
rspec-support (~> 3.10.0)
|
61
|
+
rspec-expectations (3.10.2)
|
62
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
63
|
+
rspec-support (~> 3.10.0)
|
64
|
+
rspec-mocks (3.10.2)
|
65
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
66
|
+
rspec-support (~> 3.10.0)
|
67
|
+
rspec-support (3.10.3)
|
68
|
+
rspec_junit_formatter (0.5.1)
|
69
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
70
|
+
rubocop (1.25.0)
|
71
|
+
parallel (~> 1.10)
|
72
|
+
parser (>= 3.1.0.0)
|
73
|
+
rainbow (>= 2.2.2, < 4.0)
|
74
|
+
regexp_parser (>= 1.8, < 3.0)
|
75
|
+
rexml
|
76
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
77
|
+
ruby-progressbar (~> 1.7)
|
78
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
79
|
+
rubocop-ast (1.15.1)
|
80
|
+
parser (>= 3.0.1.1)
|
81
|
+
ruby-progressbar (1.11.0)
|
82
|
+
simplecov (0.21.2)
|
83
|
+
docile (~> 1.1)
|
84
|
+
simplecov-html (~> 0.11)
|
85
|
+
simplecov_json_formatter (~> 0.1)
|
86
|
+
simplecov-console (0.9.1)
|
87
|
+
ansi
|
88
|
+
simplecov
|
89
|
+
terminal-table
|
90
|
+
simplecov-html (0.12.3)
|
91
|
+
simplecov_json_formatter (0.1.3)
|
92
|
+
terminal-table (3.0.2)
|
93
|
+
unicode-display_width (>= 1.1.1, < 3)
|
94
|
+
thor (1.2.1)
|
95
|
+
tzinfo (2.0.4)
|
96
|
+
concurrent-ruby (~> 1.0)
|
97
|
+
unicode-display_width (2.1.0)
|
98
|
+
uri (0.11.0)
|
99
|
+
webmock (3.14.0)
|
100
|
+
addressable (>= 2.8.0)
|
101
|
+
crack (>= 0.3.2)
|
102
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
103
|
+
yaml (0.2.0)
|
104
|
+
zeitwerk (2.5.3)
|
105
|
+
|
106
|
+
PLATFORMS
|
107
|
+
x86_64-linux
|
108
|
+
|
109
|
+
DEPENDENCIES
|
110
|
+
bundler (~> 2.2, >= 2.2.1)
|
111
|
+
rake
|
112
|
+
retag!
|
113
|
+
rspec
|
114
|
+
rspec_junit_formatter
|
115
|
+
rubocop
|
116
|
+
simplecov
|
117
|
+
simplecov-console
|
118
|
+
webmock
|
119
|
+
|
120
|
+
BUNDLED WITH
|
121
|
+
2.2.33
|
data/bin/console
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'retag'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
16
|
+
|
data/bin/retag
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require 'thor'
|
5
|
+
require 'colorize'
|
6
|
+
require 'retag'
|
7
|
+
|
8
|
+
ENV_PREFIX = 'RETAG'
|
9
|
+
|
10
|
+
$logger = ActiveSupport::TaggedLogging.new(Retag::Logger.new(STDOUT))
|
11
|
+
$logger.level = :info
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
class RepoCommand < Thor
|
16
|
+
desc "tag <project> <tag>", "Create tag in Gitlab project"
|
17
|
+
long_desc <<-LONGDESC
|
18
|
+
LONGDESC
|
19
|
+
option :force, default: false,
|
20
|
+
required: false,
|
21
|
+
type: :boolean,
|
22
|
+
desc: "Override Gitlab tag if exists"
|
23
|
+
|
24
|
+
option :ref, default: ENV.fetch("#{ENV_PREFIX}_TAG_REF", 'master'),
|
25
|
+
required: true,
|
26
|
+
type: :string,
|
27
|
+
desc: "Gtilab refspec from which create tag"
|
28
|
+
|
29
|
+
option :message, default: nil,
|
30
|
+
type: :string,
|
31
|
+
desc: "Tag message"
|
32
|
+
|
33
|
+
def tag(project, tag)
|
34
|
+
$logger.level = :debug if opts['verbose']
|
35
|
+
opts = options.to_h.dup
|
36
|
+
|
37
|
+
begin
|
38
|
+
Gitlab.client.delete_tag(project, tag).inspect
|
39
|
+
rescue Gitlab::Error::NotFound
|
40
|
+
# Success: there is no such tag
|
41
|
+
end if opts['force']
|
42
|
+
|
43
|
+
puts Gitlab.client.create_tag(project, tag, options['ref'], options['message']).inspect
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class DockerCommand < Thor
|
48
|
+
desc "tag", "Tag Docker image without downloading"
|
49
|
+
long_desc <<-LONGDESC
|
50
|
+
LONGDESC
|
51
|
+
option :image, default: ENV.fetch("#{ENV_PREFIX}_TAG_IMAGE", nil),
|
52
|
+
required: true,
|
53
|
+
desc: "Env: #{ENV_PREFIX}_TAG_IMAGE. Full image to be tagged. Ex: docker.rnds.pro/aggredator/service-uprid3:latest"
|
54
|
+
|
55
|
+
option :tag, default: ENV.fetch("#{ENV_PREFIX}_TAG_TAG", nil),
|
56
|
+
required: true,
|
57
|
+
desc: "Env: #{ENV_PREFIX}_TAG_TAG. New tag"
|
58
|
+
|
59
|
+
option :suffix, default: ENV.fetch("#{ENV_PREFIX}_TAG_SUFFIX", nil),
|
60
|
+
required: false,
|
61
|
+
desc: "Env: #{ENV_PREFIX}_TAG_SUFFIX. Optional suffix added to image tag: <image>:<tag>[-<suffix>].
|
62
|
+
Example:
|
63
|
+
# retag tag --image=registry/image:0a4bfc5 --tag v1.2.3 --suffix stable is equivalent to
|
64
|
+
docker tag registry/image:0a4bfc5-stable registry/image:v1.2.3
|
65
|
+
"
|
66
|
+
|
67
|
+
def tag(*_args)
|
68
|
+
$logger.level = :debug if opts['verbose']
|
69
|
+
opts = options.to_h.dup
|
70
|
+
|
71
|
+
img, tag = opts['image'].split(':')
|
72
|
+
tag ||= 'latest'
|
73
|
+
tag = opts['suffix'].present? ? "#{tag}-#{opts['suffix']}" : tag
|
74
|
+
|
75
|
+
image = ::Retag::Image.new(img, tag)
|
76
|
+
image.retag!(opts['tag'])
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
class ReleaseCommand < Thor
|
82
|
+
default_command :release
|
83
|
+
|
84
|
+
desc "release", "Release projects bundler from release.yml manifest"
|
85
|
+
long_desc <<-LONGDESC
|
86
|
+
LONGDESC
|
87
|
+
option :config, default: ENV.fetch("#{ENV_PREFIX}_RELEASE_CONFIG", './release.yml'),
|
88
|
+
required: true,
|
89
|
+
desc: "Env: #{ENV_PREFIX}_RELEASE_CONFIG. Path to release manifest"
|
90
|
+
|
91
|
+
option :name, default: ENV.fetch("#{ENV_PREFIX}_RELEASE_NAME", nil),
|
92
|
+
required: false,
|
93
|
+
desc: "Env: #{ENV_PREFIX}_RELEASE_NAME. Name of the current release"
|
94
|
+
|
95
|
+
def release(*_args)
|
96
|
+
opts = options.to_h.dup
|
97
|
+
$logger.level = :debug if opts['verbose']
|
98
|
+
|
99
|
+
config = YAML.load_file(File.expand_path(opts['config']))
|
100
|
+
config['release'] = opts['name'] || config['release']
|
101
|
+
|
102
|
+
release = config['release'].to_s
|
103
|
+
suffix = config['suffix']
|
104
|
+
branch = config['branch']
|
105
|
+
|
106
|
+
services = config['services'].map do|(name, cfg)|
|
107
|
+
Retag::Service.new(name, cfg, release, suffix: cfg.fetch('suffix', suffix), branch: cfg.fetch('branch', branch)) unless name.start_with?('.')
|
108
|
+
end.compact
|
109
|
+
|
110
|
+
tag_message = "Release #{release} at #{DateTime.now.iso8601}"
|
111
|
+
|
112
|
+
$logger.info "*** Starting '#{tag_message.colorize(mode: :bold)}'...".colorize(:cyan)
|
113
|
+
|
114
|
+
services.each do |srv|
|
115
|
+
$logger.tagged(srv.name.colorize(:yellow), "#{srv.revision.colorize(mode: :bold)}@#{srv.branch}") do
|
116
|
+
$logger.info "#{'==>'.colorize(mode: :bold, color: :white)} Releasing service #{srv.name.colorize(mode: :bold)} from #{srv.repo.repo} at #{srv.branch.colorize(mode: :bold)}:".colorize(:green)
|
117
|
+
$logger.shift do
|
118
|
+
srv.images.each do |img|
|
119
|
+
$logger.info ">>> Image #{img.image}"
|
120
|
+
|
121
|
+
$logger.shift do
|
122
|
+
$logger.info "From ".ljust(5) + "[#{img.tag.colorize(:yellow)}]: ".ljust(35) + img.full
|
123
|
+
newimg = img.retag!(release)
|
124
|
+
$logger.info "To ".ljust(5) + "[#{newimg.tag.colorize(:yellow)}]: ".ljust(35) + newimg.full
|
125
|
+
end
|
126
|
+
|
127
|
+
$logger.info ">>> Repo #{srv.repo.repo}"
|
128
|
+
|
129
|
+
$logger.shift do
|
130
|
+
$logger.info "From ".ljust(5) + "[#{srv.revision.colorize(:yellow)}]: ".ljust(35) + "#{srv.repo.repo}~#{srv.revision}@#{srv.branch}"
|
131
|
+
newimg = img.retag!(release)
|
132
|
+
$logger.info "To ".ljust(5) + "[#{release.colorize(:yellow)}]: ".ljust(35) + "#{srv.repo.repo}~#{srv.revision}@#{release}"
|
133
|
+
end
|
134
|
+
|
135
|
+
srv.repo.tag!(release, message: tag_message)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
$logger.info "*** Completed '#{tag_message.colorize(mode: :bold)}'".colorize(:cyan)
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
|
148
|
+
class Cli < Thor
|
149
|
+
|
150
|
+
def self.exit_on_failure?
|
151
|
+
true
|
152
|
+
end
|
153
|
+
|
154
|
+
package_name "Retag is cli to manipulate docker images in handy way.
|
155
|
+
|
156
|
+
# Gitlab authorization
|
157
|
+
Using GITLAB_API_ENDPOINT and GITLAB_API_PRIVATE_TOKEN environment variable used for authorization
|
158
|
+
|
159
|
+
#{File.basename(__FILE__)}"
|
160
|
+
|
161
|
+
class_option :verbose, type: :boolean
|
162
|
+
|
163
|
+
desc 'version', 'Display version'
|
164
|
+
map %w[-v --version] => :version
|
165
|
+
|
166
|
+
def version
|
167
|
+
say Retag::VERSION
|
168
|
+
end
|
169
|
+
|
170
|
+
desc "repo SUBCOMMAND ...ARGS", "Manage git repository stuffs"
|
171
|
+
subcommand "repo", RepoCommand
|
172
|
+
|
173
|
+
desc "docker SUBCOMMAND ...ARGS", "Manage docker stuffs"
|
174
|
+
subcommand "docker", DockerCommand
|
175
|
+
|
176
|
+
desc "release SUBCOMMAND ...ARGS", "Manage releases"
|
177
|
+
subcommand "release", ReleaseCommand
|
178
|
+
end
|
179
|
+
|
180
|
+
::Cli.start
|
data/bin/setup
ADDED
data/lib/retag/image.rb
CHANGED
@@ -10,8 +10,8 @@ module Retag
|
|
10
10
|
def initialize(image, tag, suffix: nil)
|
11
11
|
@image = image
|
12
12
|
@tag = tag
|
13
|
-
@tag = "#{tag}-#{suffix}" if suffix.present?
|
14
|
-
@full = "#{image}:#{tag}"
|
13
|
+
@tag = "#{@tag}-#{suffix}" if suffix.present?
|
14
|
+
@full = "#{@image}:#{@tag}"
|
15
15
|
end
|
16
16
|
|
17
17
|
def retag!(newtag = tag)
|
@@ -24,25 +24,15 @@ module Retag
|
|
24
24
|
|
25
25
|
Tempfile.create('manifest') do |file|
|
26
26
|
manifest = JSON.parse(cmd!("curl -s -u '#{dockerauth(uri.host)}' -H 'Accept: #{content_type}' '#{uri}/v2/#{repo}/manifests/#{tag}' -o -", capture: true).strip)
|
27
|
-
raise manifest unless manifest.dig('layers') || manifest.dig('config')
|
27
|
+
raise manifest.inspect unless manifest.dig('layers') || manifest.dig('config')
|
28
28
|
|
29
29
|
file.write(manifest.to_json)
|
30
30
|
file.flush
|
31
31
|
result = cmd!("curl -s -u '#{dockerauth(uri.host)}' -H 'Content-Type: #{content_type}' -H 'Accept: #{content_type}' -X PUT --data-binary @#{file.path} '#{uri}/v2/#{repo}/manifests/#{newtag}' -o -", capture: true).strip
|
32
32
|
raise result unless result.empty?
|
33
33
|
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def pull(img = full)
|
37
|
-
cmd!("docker pull -q #{img}")
|
38
|
-
end
|
39
|
-
|
40
|
-
def push(img = full)
|
41
|
-
cmd!("docker push -q #{img}")
|
42
|
-
end
|
43
34
|
|
44
|
-
|
45
|
-
cmd!("docker rmi #{img}")
|
35
|
+
Image.new(image, newtag)
|
46
36
|
end
|
47
37
|
|
48
38
|
end
|
data/lib/retag/repo.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
module Retag
|
3
|
+
class Repo
|
4
|
+
|
5
|
+
include Utils
|
6
|
+
attr_reader :repo, :branch, :revision, :name
|
7
|
+
|
8
|
+
def initialize(repo, branch)
|
9
|
+
@repo = repo
|
10
|
+
@branch = branch
|
11
|
+
@gitlab = Gitlab.client
|
12
|
+
end
|
13
|
+
|
14
|
+
def tag!(tag, message: nil)
|
15
|
+
begin
|
16
|
+
result = @gitlab.tag(name, tag)
|
17
|
+
if result.to_h.dig('commit', 'short_id').to_s == revision
|
18
|
+
# Success: tag with same revision already exists
|
19
|
+
return true
|
20
|
+
end
|
21
|
+
rescue Gitlab::Error::NotFound
|
22
|
+
# Success: there is no such tag
|
23
|
+
end
|
24
|
+
|
25
|
+
@gitlab.create_tag(name, tag, revision, message)
|
26
|
+
end
|
27
|
+
|
28
|
+
def name
|
29
|
+
@name ||= @repo.split(':').last.gsub('.git', '')
|
30
|
+
end
|
31
|
+
|
32
|
+
def revision
|
33
|
+
@revision ||= begin
|
34
|
+
rev_name_pair = cmd!("git ls-remote #{repo} #{branch}", capture: true).split("\n").select{|line| line[/\/#{branch}$/] }.first
|
35
|
+
raise "There is no #{branch} revision at #{repo}" if rev_name_pair.nil?
|
36
|
+
rev, _name = rev_name_pair.split
|
37
|
+
rev[0..7]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
data/lib/retag/service.rb
CHANGED
@@ -1,48 +1,25 @@
|
|
1
|
+
require 'active_support/core_ext/module/delegation'
|
2
|
+
|
1
3
|
module Retag
|
2
4
|
class Service
|
3
5
|
|
4
6
|
include Retag::Utils
|
5
7
|
|
6
|
-
attr_reader :name, :config, :repo, :
|
8
|
+
attr_reader :name, :config, :repo, :release, :suffix
|
9
|
+
|
10
|
+
delegate :revision, :branch, to: :repo
|
7
11
|
|
8
|
-
def initialize(name, config, release)
|
12
|
+
def initialize(name, config, release, branch:, suffix:)
|
9
13
|
@name = name
|
10
14
|
@config = config
|
11
|
-
@repo = config['repo']
|
12
|
-
@branch = config['branch']
|
15
|
+
@repo = Retag::Repo.new(config['repo'], branch)
|
13
16
|
@release = release
|
17
|
+
@suffix = suffix
|
14
18
|
end
|
15
19
|
|
16
20
|
def images
|
17
|
-
@images ||= config['images'].map{|img| Retag::Image.new(img, revision, suffix:
|
18
|
-
end
|
19
|
-
|
20
|
-
def pull
|
21
|
-
images.each(&:pull)
|
22
|
-
end
|
23
|
-
|
24
|
-
def push
|
25
|
-
images.each(&:push)
|
26
|
-
end
|
27
|
-
|
28
|
-
def rm
|
29
|
-
images.each(&:rm)
|
30
|
-
end
|
31
|
-
|
32
|
-
def release!(tag = release)
|
33
|
-
images.each do |image|
|
34
|
-
image.retag!(tag)
|
35
|
-
end
|
21
|
+
@images ||= config['images'].map{|img| Retag::Image.new(img, revision, suffix: @suffix) }
|
36
22
|
end
|
37
|
-
|
38
|
-
def revision
|
39
|
-
@revision ||= begin
|
40
|
-
rev, _name = cmd!("git ls-remote #{repo} #{branch}", capture: true).split("\n").select{|line| line["heads/#{branch}"] }.first.split
|
41
|
-
rev[0..7]
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
23
|
end
|
47
24
|
end
|
48
25
|
|
data/lib/retag/utils.rb
CHANGED
@@ -10,7 +10,7 @@ module Retag
|
|
10
10
|
tag = $cmdnum.to_s.rjust(3, '0')
|
11
11
|
output = ''
|
12
12
|
|
13
|
-
logger.tagged("CMD#{tag}") { logger.debug cmd }
|
13
|
+
logger.tagged("CMD#{tag}".colorize(:light_black)) { logger.debug cmd.colorize(:light_black) }
|
14
14
|
|
15
15
|
code = Open3.popen3(cmd) do |stdin, stdout, stderr, thr|
|
16
16
|
stdin.close_write
|
data/lib/retag/version.rb
CHANGED
data/lib/retag.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support'
|
4
|
+
require 'gitlab'
|
4
5
|
require_relative 'retag/version'
|
5
6
|
require_relative 'retag/logger'
|
6
7
|
require_relative 'retag/utils'
|
7
8
|
require_relative 'retag/image'
|
9
|
+
require_relative 'retag/repo'
|
8
10
|
require_relative 'retag/service'
|
9
11
|
|
10
12
|
module Retag
|
data/retag.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/retag/version'
|
4
|
+
|
5
|
+
Gem::Specification.new 'retag' do |spec|
|
6
|
+
spec.version = ENV['BUILDVERSION'].to_i > 0 ? "#{Retag::VERSION}.#{ENV['BUILDVERSION'].to_i}" : Retag::VERSION
|
7
|
+
spec.authors = ['Samoilenko Yuri']
|
8
|
+
spec.email = ['kinnalru@gmail.com']
|
9
|
+
spec.description = spec.summary = 'Retag is cli to manipulate docker images in handy way'
|
10
|
+
spec.homepage = 'https://github.com/RnD-Soft/retag'
|
11
|
+
spec.license = 'MIT'
|
12
|
+
|
13
|
+
spec.required_ruby_version = '>= 2.5.0'
|
14
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
15
|
+
spec.metadata['source_code_uri'] = 'https://github.com/RnD-Soft/retag'
|
16
|
+
|
17
|
+
spec.files = Dir['bin/**/*', 'lib/**/*', 'sig/**/*', 'Gemfile*', 'LICENSE', 'README.md', '*.gemspec']
|
18
|
+
|
19
|
+
spec.bindir = 'bin'
|
20
|
+
spec.executables = spec.files.grep(%r{^bin/retag}) {|f| File.basename(f) }
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.1'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
27
|
+
spec.add_development_dependency 'rubocop'
|
28
|
+
spec.add_development_dependency 'simplecov'
|
29
|
+
spec.add_development_dependency 'simplecov-console'
|
30
|
+
spec.add_development_dependency 'webmock'
|
31
|
+
|
32
|
+
spec.add_runtime_dependency 'activesupport', '~> 6.0'
|
33
|
+
spec.add_runtime_dependency 'colorize'
|
34
|
+
spec.add_runtime_dependency 'json'
|
35
|
+
spec.add_runtime_dependency 'thor'
|
36
|
+
spec.add_runtime_dependency 'uri'
|
37
|
+
spec.add_runtime_dependency 'yaml'
|
38
|
+
spec.add_runtime_dependency 'gitlab'
|
39
|
+
|
40
|
+
end
|
41
|
+
|
data/sig/retag.rbs
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: retag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samoilenko Yuri
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -142,6 +142,20 @@ dependencies:
|
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '6.0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: colorize
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :runtime
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
145
159
|
- !ruby/object:Gem::Dependency
|
146
160
|
name: json
|
147
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,28 +212,51 @@ dependencies:
|
|
198
212
|
- - ">="
|
199
213
|
- !ruby/object:Gem::Version
|
200
214
|
version: '0'
|
215
|
+
- !ruby/object:Gem::Dependency
|
216
|
+
name: gitlab
|
217
|
+
requirement: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - ">="
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
type: :runtime
|
223
|
+
prerelease: false
|
224
|
+
version_requirements: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - ">="
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: '0'
|
201
229
|
description: Retag is cli to manipulate docker images in handy way
|
202
230
|
email:
|
203
231
|
- kinnalru@gmail.com
|
204
|
-
executables:
|
232
|
+
executables:
|
233
|
+
- retag
|
205
234
|
extensions: []
|
206
235
|
extra_rdoc_files: []
|
207
236
|
files:
|
237
|
+
- Gemfile
|
238
|
+
- Gemfile.lock
|
208
239
|
- LICENSE
|
209
240
|
- README.md
|
241
|
+
- bin/console
|
242
|
+
- bin/retag
|
243
|
+
- bin/setup
|
210
244
|
- lib/retag.rb
|
211
245
|
- lib/retag/image.rb
|
212
246
|
- lib/retag/logger.rb
|
247
|
+
- lib/retag/repo.rb
|
213
248
|
- lib/retag/service.rb
|
214
249
|
- lib/retag/utils.rb
|
215
250
|
- lib/retag/version.rb
|
251
|
+
- retag.gemspec
|
252
|
+
- sig/retag.rbs
|
216
253
|
homepage: https://github.com/RnD-Soft/retag
|
217
254
|
licenses:
|
218
255
|
- MIT
|
219
256
|
metadata:
|
220
257
|
homepage_uri: https://github.com/RnD-Soft/retag
|
221
258
|
source_code_uri: https://github.com/RnD-Soft/retag
|
222
|
-
post_install_message:
|
259
|
+
post_install_message:
|
223
260
|
rdoc_options: []
|
224
261
|
require_paths:
|
225
262
|
- lib
|
@@ -234,8 +271,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
271
|
- !ruby/object:Gem::Version
|
235
272
|
version: '0'
|
236
273
|
requirements: []
|
237
|
-
rubygems_version: 3.
|
238
|
-
signing_key:
|
274
|
+
rubygems_version: 3.2.28
|
275
|
+
signing_key:
|
239
276
|
specification_version: 4
|
240
277
|
summary: Retag is cli to manipulate docker images in handy way
|
241
278
|
test_files: []
|