rops 1.2.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35e79d0ac5ba9b1b390e4764445c2d7ea0baefbb6f87546f951b350b56845f4a
4
- data.tar.gz: 50b2360868d759353b36cf1fc0e27439762fe973eb6b57c14240a1b747d6a992
3
+ metadata.gz: 5a9aa4788d53d39e653cf9ebe46f3082962b2efecdef76f32fe4ac034fbc5699
4
+ data.tar.gz: b47e1bc75453e0e60e596f33893d651ed080e605135b46c73832ebd38291072a
5
5
  SHA512:
6
- metadata.gz: 9481dce3e2fd292a47ea25ad00df8b230f47061f060b3fd65514b9f8e063c8645808a30a807f6a85055751948783b2f7dfd46891c632e7934cd874bd5359cca5
7
- data.tar.gz: 05b384626c27d7d0582c6000259acfa2f118734a8e25e30b1041bf481fedbb4bf23fc2d980b3d8da6ba46f0939dfdfab95561a0c8810b1d7f2cf9b69b3c5fc4b
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.1.0)
5
- activesupport (~> 6.1.4)
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 (6.1.4.1)
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
- zeitwerk (~> 2.3)
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.8.10)
25
+ i18n (1.12.0)
27
26
  concurrent-ruby (~> 1.0)
28
- minitest (5.14.4)
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.4)
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
@@ -39,6 +39,14 @@ module Record360
39
39
 
40
40
  protected
41
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
+
42
50
  def print_statuses(context, spec_statuses = nil)
43
51
  spec_statuses ||= deployer.specs_running(context)
44
52
  return if spec_statuses.blank?
@@ -140,6 +148,49 @@ module Record360
140
148
  end
141
149
  end
142
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
+
143
194
  class CurrentStatus < Dry::CLI::Command
144
195
  desc "Display status of all running specs"
145
196
  argument :context, desc: "Kubernetes context"
@@ -243,6 +294,7 @@ module Record360
243
294
  end
244
295
  end
245
296
 
297
+ register 'ready', ReadyTag
246
298
  register 'status', CurrentStatus
247
299
  register 'build', BuildImage
248
300
  register 'push', PushImage
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' => []
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Record360
2
2
  module Operations
3
- VERSION = '1.2.0'
3
+ VERSION = '1.3.0'
4
4
  end
5
5
  end
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.2.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: 2021-11-11 00:00:00.000000000 Z
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: 6.1.4
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: 6.1.4
40
+ version: 7.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: git
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  requirements: []
136
- rubygems_version: 3.1.6
136
+ rubygems_version: 3.3.7
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: Record360 Operations tool