rops 1.0.8 → 1.3.0
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/Gemfile.lock +7 -9
- data/bin/rops +61 -0
- data/lib/deployer.rb +2 -6
- data/lib/version.rb +5 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a9aa4788d53d39e653cf9ebe46f3082962b2efecdef76f32fe4ac034fbc5699
|
4
|
+
data.tar.gz: b47e1bc75453e0e60e596f33893d651ed080e605135b46c73832ebd38291072a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad8c81d3214a90a5f59cf12cbdfd5457d0bb2a999bd6b6908617a4b881a6baf4f487ccbcec48de9209974f8c5bcda10fc68cfaef4b0321c3148b6cf889995202
|
7
|
+
data.tar.gz: a2898286981115871142e4058a04442c79c16dfee9ccb98d2afa49613dca4db4196fdc8e0fa7cef0cbb349b2635632b5ad9e34766de3b046f69f5c68401e1db4
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rops (1.0
|
5
|
-
activesupport (~>
|
4
|
+
rops (1.2.0)
|
5
|
+
activesupport (~> 7.0.3)
|
6
6
|
dry-cli (~> 0.7.0)
|
7
7
|
git (~> 1.9.1)
|
8
8
|
hashdiff (~> 1.0.1)
|
@@ -12,26 +12,24 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activesupport (
|
15
|
+
activesupport (7.0.3.1)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
17
|
i18n (>= 1.6, < 2)
|
18
18
|
minitest (>= 5.1)
|
19
19
|
tzinfo (~> 2.0)
|
20
|
-
|
21
|
-
concurrent-ruby (1.1.9)
|
20
|
+
concurrent-ruby (1.1.10)
|
22
21
|
dry-cli (0.7.0)
|
23
22
|
git (1.9.1)
|
24
23
|
rchardet (~> 1.8)
|
25
24
|
hashdiff (1.0.1)
|
26
|
-
i18n (1.
|
25
|
+
i18n (1.12.0)
|
27
26
|
concurrent-ruby (~> 1.0)
|
28
|
-
minitest (5.
|
27
|
+
minitest (5.16.2)
|
29
28
|
net-ssh (6.1.0)
|
30
29
|
ptools (1.4.2)
|
31
30
|
rchardet (1.8.0)
|
32
|
-
tzinfo (2.0.
|
31
|
+
tzinfo (2.0.5)
|
33
32
|
concurrent-ruby (~> 1.0)
|
34
|
-
zeitwerk (2.4.2)
|
35
33
|
|
36
34
|
PLATFORMS
|
37
35
|
x86_64-linux
|
data/bin/rops
CHANGED
@@ -9,6 +9,7 @@ require 'hashdiff'
|
|
9
9
|
|
10
10
|
require 'core_ext'
|
11
11
|
require 'deployer'
|
12
|
+
require 'version'
|
12
13
|
|
13
14
|
module Record360
|
14
15
|
module Operations
|
@@ -38,6 +39,14 @@ module Record360
|
|
38
39
|
|
39
40
|
protected
|
40
41
|
|
42
|
+
def format_commit(commit)
|
43
|
+
message = commit.message
|
44
|
+
if message.include?("\n")
|
45
|
+
message = message.split("\n").first + " ..."
|
46
|
+
end
|
47
|
+
"#{commit.date} [#{commit.sha[0,8]}] #{message}"
|
48
|
+
end
|
49
|
+
|
41
50
|
def print_statuses(context, spec_statuses = nil)
|
42
51
|
spec_statuses ||= deployer.specs_running(context)
|
43
52
|
return if spec_statuses.blank?
|
@@ -139,6 +148,49 @@ module Record360
|
|
139
148
|
end
|
140
149
|
end
|
141
150
|
|
151
|
+
class ReadyTag < Dry::CLI::Command
|
152
|
+
desc "Mark your latest commit that's ready for production"
|
153
|
+
argument :commit, desc: "Commit to tag as ready for production"
|
154
|
+
include Common
|
155
|
+
|
156
|
+
def call(commit: nil, **args)
|
157
|
+
super(branch: commit, **args)
|
158
|
+
repo = deployer.send(:git)
|
159
|
+
name, email = repo.config.values_at('user.name', 'user.email')
|
160
|
+
if name.blank?
|
161
|
+
puts "Unable to find user name in Git config. Run `git config --global user.name \"FIRST_NAME LAST_NAME\"`"
|
162
|
+
exit(-1)
|
163
|
+
elsif email.blank?
|
164
|
+
puts "Unable to find user email in Git config. Run `git config --global user.email \"EMAIL_ADDRESS\"`"
|
165
|
+
exit(-1)
|
166
|
+
end
|
167
|
+
tag = 'ready-' + name.split(' ').first.downcase
|
168
|
+
|
169
|
+
if commit
|
170
|
+
c = repo.object(commit)
|
171
|
+
unless c.author.email == email
|
172
|
+
puts "Commit author #{c.author.name.inspect} does not match #{name.inspect}, you can only tag your own commit"
|
173
|
+
exit(-1)
|
174
|
+
end
|
175
|
+
repo.tag(tag, c, f: true)
|
176
|
+
puts "New tag set to: ", format_commit(c)
|
177
|
+
|
178
|
+
elsif repo.tags.map(&:name).include?(tag)
|
179
|
+
commits = repo.log.author(name).between("#{tag}^", 'master')
|
180
|
+
commits[0...-1].each do |c|
|
181
|
+
puts " " + format_commit(c)
|
182
|
+
end
|
183
|
+
puts "=> " + format_commit(commits.last)
|
184
|
+
else
|
185
|
+
puts "No #{tag.inspect} tag found"
|
186
|
+
repo.log.author(name).to_a[0..9].each do |c|
|
187
|
+
puts format_commit(c)
|
188
|
+
end
|
189
|
+
puts "..."
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
142
194
|
class CurrentStatus < Dry::CLI::Command
|
143
195
|
desc "Display status of all running specs"
|
144
196
|
argument :context, desc: "Kubernetes context"
|
@@ -235,10 +287,19 @@ module Record360
|
|
235
287
|
end
|
236
288
|
end
|
237
289
|
|
290
|
+
class Version < Dry::CLI::Command
|
291
|
+
desc "output version information and exit"
|
292
|
+
def call
|
293
|
+
puts VERSION
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
register 'ready', ReadyTag
|
238
298
|
register 'status', CurrentStatus
|
239
299
|
register 'build', BuildImage
|
240
300
|
register 'push', PushImage
|
241
301
|
register 'deploy', DeployImage
|
302
|
+
register 'version', Version
|
242
303
|
end
|
243
304
|
end
|
244
305
|
|
data/lib/deployer.rb
CHANGED
@@ -9,7 +9,7 @@ class Deployer
|
|
9
9
|
CONFIG_DEFAULTS = {
|
10
10
|
'repository' => nil,
|
11
11
|
'default_branch' => 'master',
|
12
|
-
'registry' => 'r360',
|
12
|
+
'registry' => 'docker.io/r360',
|
13
13
|
'default_context' => 'staging',
|
14
14
|
'production_context' => 'production',
|
15
15
|
'images' => []
|
@@ -43,11 +43,7 @@ class Deployer
|
|
43
43
|
@branch.delete_prefix!('g') if @branch.match(/^g\h{8}$/)
|
44
44
|
@commit = git.object(@branch).sha
|
45
45
|
|
46
|
-
|
47
|
-
@image_tag = "g#{short_id}"
|
48
|
-
if (@branch != default_branch) && !@branch.start_with?(short_id)
|
49
|
-
@image_tag += "-#{@branch}"
|
50
|
-
end
|
46
|
+
@image_tag = @commit[0, 8]
|
51
47
|
images.each do |image|
|
52
48
|
image.commit = commit
|
53
49
|
image.tag = image_tag
|
data/lib/version.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rops
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Sloan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 7.0.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 7.0.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: git
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- lib/git_ext.rb
|
114
114
|
- lib/image.rb
|
115
115
|
- lib/site.rb
|
116
|
+
- lib/version.rb
|
116
117
|
homepage: https://github.com/Record360/rops
|
117
118
|
licenses:
|
118
119
|
- MIT
|
@@ -132,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
133
|
- !ruby/object:Gem::Version
|
133
134
|
version: '0'
|
134
135
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
136
|
+
rubygems_version: 3.3.7
|
136
137
|
signing_key:
|
137
138
|
specification_version: 4
|
138
139
|
summary: Record360 Operations tool
|