dri 0.8.0 → 0.9.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: 3b4a86b6e658b2426bfce682d92f34f1441a9a1812f0cc805088b8c250991d4d
4
- data.tar.gz: 3cf2b62c9aa5b1ef8de5cd51f8fdd927fa5335c9a1299b4947ab162b8afe2526
3
+ metadata.gz: 2b398cef45fa101592e0abecf4d014969e4e26dac5b5e3fd9f7f774b6108618f
4
+ data.tar.gz: 96a6b402d7dfcccf9fe2e69e01a4ece8af13d56be0213dc8ffa3824ea9a5ed2a
5
5
  SHA512:
6
- metadata.gz: 4d79cdc2db7e1f959fee5b80988516677455a1d18e151a300923b2d19a58f0bb4fc4342db5e3785c34b5ef4475655b37cb10ad8850e488429ab12cfd8ad03fb8
7
- data.tar.gz: 5120e934a2e8a45a51b4328bf5a1ae3af1a55b19e42023e538f65c958bfad0a8810f89844b7f2ef40608d0c7233d64f652ba9f101cff37f203a900d940084771
6
+ metadata.gz: 9d94573de9142a648b643819381244382a65fedd7c180ae5b78013ea2738204e54e543e43ed5ad6209c2a3ae5a3af4cd1ecb2a7937afa5607b3c04435ce5a2a2
7
+ data.tar.gz: 48e010a476d8b1a2b48b3b74ba485e7a9c533aa17f96e4639eead23e486f2a309a8f60fed3c282a9b85ec38154cc2bb0b26fdbf28d3389981d1bf26578336b87
@@ -0,0 +1,28 @@
1
+ ## Diff
2
+ <!-- Replace `v0.9.0` with the previous DRI release, and `6a9c4fcc150741d578ec75141d3706891b6694bc` with the latest commit from https://gitlab.com/gitlab-org/quality/dri/-/commits/master that will be included in the release -->
3
+ https://gitlab.com/gitlab-org/quality/dri/-/compare/v0.9.0...6a9c4fcc150741d578ec75141d3706891b6694bc
4
+
5
+ ## Release Notes
6
+
7
+ ```markdown
8
+ ### Features
9
+ - !aaa <Title of the aaa MR>
10
+
11
+ ### Bug Fixes
12
+ - !bbb <Title of the bbb MR>
13
+
14
+ ### Maintenance
15
+ - !ccc <Title of the ccc MR>
16
+ ```
17
+
18
+ ## Checklists
19
+
20
+ ### Before merging:
21
+ - [ ] MR title is set to `Bump version to <version>`, where `<version>` is the new version, according to [SemVer](https://semver.org/).
22
+ - [ ] Diff link is up-to-date.
23
+ - [ ] Release notes are accurate.
24
+ - [ ] `lib/dri/version.rb` is updated with the new version number.
25
+ - [ ] `bundle update` was run to update `Gemfile.lock` with the new version number.
26
+
27
+ ### After merging:
28
+ - [ ] Update the release notes for the [newly created tag](https://gitlab.com/gitlab-org/quality/dri/-/tags) with the release notes from this MR.
data/.gitlab-ci.yml CHANGED
@@ -26,7 +26,7 @@ include:
26
26
  - /ci/ref-update.gitlab-ci.yml
27
27
 
28
28
  variables:
29
- RUBY_VERSION: "2.7"
29
+ RUBY_VERSION: "3.0"
30
30
 
31
31
  stages:
32
32
  - build
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.4
1
+ 3.0.5
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.0.4
1
+ ruby 3.0.5
data/Gemfile.lock CHANGED
@@ -1,19 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dri (0.8.0)
4
+ dri (0.9.0)
5
5
  amatch (~> 0.4.1)
6
- gitlab (~> 4.18)
7
- httparty (~> 0.20.0)
6
+ gitlab (~> 4.19)
7
+ httparty (~> 0.21.0)
8
8
  json (~> 2.6.1)
9
9
  markdown-tables (~> 1.1.1)
10
10
  pastel (~> 0.8.0)
11
- thor (~> 1.0.1)
11
+ thor (~> 1.2.0)
12
12
  tty-box (~> 0.7.0)
13
- tty-config (~> 0.4.0)
14
- tty-editor (~> 0.6)
13
+ tty-config (~> 0.6.0)
14
+ tty-editor (~> 0.7)
15
15
  tty-font (~> 0.5)
16
16
  tty-logger (~> 0.6.0)
17
+ tty-markdown (~> 0.7.0)
17
18
  tty-prompt (~> 0.23.1)
18
19
  tty-spinner (~> 0.9)
19
20
  tty-table (~> 0.12.0)
@@ -21,19 +22,19 @@ PATH
21
22
  GEM
22
23
  remote: https://rubygems.org/
23
24
  specs:
24
- activesupport (7.0.2.3)
25
+ activesupport (7.0.4.2)
25
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
26
27
  i18n (>= 1.6, < 2)
27
28
  minitest (>= 5.1)
28
29
  tzinfo (~> 2.0)
29
- addressable (2.8.0)
30
- public_suffix (>= 2.0.2, < 5.0)
30
+ addressable (2.8.1)
31
+ public_suffix (>= 2.0.2, < 6.0)
31
32
  amatch (0.4.1)
32
33
  mize
33
34
  tins (~> 1.0)
34
35
  ast (2.4.2)
35
36
  coderay (1.1.3)
36
- concurrent-ruby (1.1.10)
37
+ concurrent-ruby (1.2.2)
37
38
  crack (0.4.5)
38
39
  rexml
39
40
  diff-lcs (1.5.0)
@@ -48,37 +49,38 @@ GEM
48
49
  rubocop-rails (~> 2.9)
49
50
  rubocop-rspec (~> 1.44)
50
51
  hashdiff (1.0.1)
51
- httparty (0.20.0)
52
- mime-types (~> 3.0)
52
+ httparty (0.21.0)
53
+ mini_mime (>= 1.0.0)
53
54
  multi_xml (>= 0.5.2)
54
- i18n (1.10.0)
55
+ i18n (1.12.0)
55
56
  concurrent-ruby (~> 1.0)
56
- json (2.6.2)
57
+ json (2.6.3)
58
+ kramdown (2.4.0)
59
+ rexml
57
60
  markdown-tables (1.1.1)
58
61
  method_source (1.0.0)
59
- mime-types (3.4.1)
60
- mime-types-data (~> 3.2015)
61
- mime-types-data (3.2022.0105)
62
- minitest (5.15.0)
63
- mize (0.4.0)
62
+ mini_mime (1.1.2)
63
+ minitest (5.18.0)
64
+ mize (0.4.1)
64
65
  protocol (~> 2.0)
65
66
  multi_xml (0.6.0)
66
67
  parallel (1.22.1)
67
- parser (3.1.1.0)
68
+ parser (3.2.1.0)
68
69
  ast (~> 2.4.1)
69
70
  pastel (0.8.0)
70
71
  tty-color (~> 0.5)
71
72
  protocol (2.0.0)
72
73
  ruby_parser (~> 3.0)
73
- pry (0.14.1)
74
+ pry (0.14.2)
74
75
  coderay (~> 1.1)
75
76
  method_source (~> 1.0)
76
- public_suffix (4.0.6)
77
- rack (2.2.3)
77
+ public_suffix (5.0.1)
78
+ rack (3.0.4.2)
78
79
  rainbow (3.1.1)
79
80
  rake (13.0.6)
80
- regexp_parser (2.2.1)
81
+ regexp_parser (2.7.0)
81
82
  rexml (3.2.5)
83
+ rouge (3.30.0)
82
84
  rspec (3.10.0)
83
85
  rspec-core (~> 3.10.0)
84
86
  rspec-expectations (~> 3.10.0)
@@ -101,11 +103,11 @@ GEM
101
103
  rubocop-ast (>= 0.6.0)
102
104
  ruby-progressbar (~> 1.7)
103
105
  unicode-display_width (>= 1.4.0, < 2.0)
104
- rubocop-ast (1.16.0)
105
- parser (>= 3.1.1.0)
106
+ rubocop-ast (1.27.0)
107
+ parser (>= 3.2.1.0)
106
108
  rubocop-gitlab-security (0.1.1)
107
109
  rubocop (>= 0.51)
108
- rubocop-graphql (0.14.2)
110
+ rubocop-graphql (0.19.0)
109
111
  rubocop (>= 0.87, < 2)
110
112
  rubocop-performance (1.9.2)
111
113
  rubocop (>= 0.90.0, < 2.0)
@@ -117,8 +119,8 @@ GEM
117
119
  rubocop-rspec (1.44.1)
118
120
  rubocop (~> 0.87)
119
121
  rubocop-ast (>= 0.7.1)
120
- ruby-progressbar (1.11.0)
121
- ruby_parser (3.19.1)
122
+ ruby-progressbar (1.13.0)
123
+ ruby_parser (3.20.0)
122
124
  sexp_processor (~> 4.16)
123
125
  sexp_processor (4.16.1)
124
126
  strings (0.2.1)
@@ -129,22 +131,29 @@ GEM
129
131
  sync (0.5.0)
130
132
  terminal-table (3.0.2)
131
133
  unicode-display_width (>= 1.1.1, < 3)
132
- thor (1.0.1)
133
- timecop (0.9.5)
134
- tins (1.31.1)
134
+ thor (1.2.1)
135
+ timecop (0.9.6)
136
+ tins (1.32.1)
135
137
  sync
136
138
  tty-box (0.7.0)
137
139
  pastel (~> 0.8)
138
140
  strings (~> 0.2.0)
139
141
  tty-cursor (~> 0.7)
140
142
  tty-color (0.6.0)
141
- tty-config (0.4.0)
143
+ tty-config (0.6.0)
142
144
  tty-cursor (0.7.1)
143
145
  tty-editor (0.7.0)
144
146
  tty-prompt (~> 0.22)
145
147
  tty-font (0.5.0)
146
148
  tty-logger (0.6.0)
147
149
  pastel (~> 0.8)
150
+ tty-markdown (0.7.1)
151
+ kramdown (>= 1.16.2, < 3.0)
152
+ pastel (~> 0.8)
153
+ rouge (~> 3.14)
154
+ strings (~> 0.2.0)
155
+ tty-color (~> 0.5)
156
+ tty-screen (~> 0.8)
148
157
  tty-prompt (0.23.1)
149
158
  pastel (~> 0.8)
150
159
  tty-reader (~> 0.8)
@@ -159,11 +168,11 @@ GEM
159
168
  pastel (~> 0.8)
160
169
  strings (~> 0.2.0)
161
170
  tty-screen (~> 0.8)
162
- tzinfo (2.0.4)
171
+ tzinfo (2.0.6)
163
172
  concurrent-ruby (~> 1.0)
164
173
  unicode-display_width (1.8.0)
165
174
  unicode_utils (1.4.0)
166
- webmock (3.14.0)
175
+ webmock (3.18.1)
167
176
  addressable (>= 2.8.0)
168
177
  crack (>= 0.3.2)
169
178
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -182,4 +191,4 @@ DEPENDENCIES
182
191
  webmock (~> 3.5)
183
192
 
184
193
  BUNDLED WITH
185
- 2.3.16
194
+ 2.4.7
data/README.md CHANGED
@@ -59,6 +59,7 @@ $ dri profile
59
59
  - quarantines
60
60
  - dequarantines
61
61
  - featureflags
62
+ - runbooks
62
63
  - [4. publish](#4-publish)
63
64
  - report
64
65
  - [5. rm](#5-rm)
@@ -139,6 +140,13 @@ $ dri fetch pipelines
139
140
  Fetches a table containing last executed pipeline and its test report link for all monitored pipelines.
140
141
  The timestamps are in UTC
141
142
 
143
+ ```shell
144
+ $ dri fetch runbooks [runbook]
145
+ ```
146
+
147
+ Fetches a runbook from the [runbooks](https://gitlab.com/gitlab-org/quality/runbooks) project.
148
+ If `[runbook]` is omitted, the command will prompt the user to select from a list of available runbooks.
149
+
142
150
  #### 4. publish
143
151
 
144
152
  ```shell
data/dri.gemspec CHANGED
@@ -23,17 +23,18 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ['lib']
24
24
 
25
25
  spec.add_dependency 'amatch', '~> 0.4.1'
26
- spec.add_dependency "gitlab", "~> 4.18"
27
- spec.add_dependency 'httparty', '~> 0.20.0'
26
+ spec.add_dependency "gitlab", "~> 4.19"
27
+ spec.add_dependency 'httparty', '~> 0.21.0'
28
28
  spec.add_dependency 'json', '~> 2.6.1'
29
29
  spec.add_dependency 'markdown-tables', '~> 1.1.1'
30
30
  spec.add_dependency 'pastel', '~> 0.8.0'
31
- spec.add_dependency 'thor', '~> 1.0.1'
31
+ spec.add_dependency 'thor', '~> 1.2.0'
32
32
  spec.add_dependency 'tty-box', '~> 0.7.0'
33
- spec.add_dependency 'tty-config', '~> 0.4.0'
34
- spec.add_dependency 'tty-editor', '~> 0.6'
33
+ spec.add_dependency 'tty-config', '~> 0.6.0'
34
+ spec.add_dependency 'tty-editor', '~> 0.7'
35
35
  spec.add_dependency 'tty-font', '~> 0.5'
36
36
  spec.add_dependency 'tty-logger', '~> 0.6.0'
37
+ spec.add_dependency 'tty-markdown', '~> 0.7.0'
37
38
  spec.add_dependency 'tty-prompt', '~> 0.23.1'
38
39
  spec.add_dependency 'tty-spinner', '~> 0.9'
39
40
  spec.add_dependency 'tty-table', '~> 0.12.0'
@@ -279,6 +279,28 @@ module Dri
279
279
  gitlab.pipeline_jobs(project_id, pipeline_id, options).auto_paginate
280
280
  end
281
281
 
282
+ # Fetch runbooks from the runbooks project
283
+ #
284
+ # @param [Integer] project_id
285
+ # @return [Array<Gitlab::ObjectifedHash>]
286
+ def list_runbooks(project_id = RUNBOOKS_PROJECT_ID)
287
+ tree = gitlab.tree(project_id, { recursive: true, ref: 'main' }).auto_paginate
288
+
289
+ tree.select do |node|
290
+ node.type == 'tree' && !node.name.start_with?('_')
291
+ end
292
+ end
293
+
294
+ # Fetches file contents at <path>
295
+ #
296
+ # @param [String] path
297
+ # @param [String] ref
298
+ # @param [Integer] project_id
299
+ # @return [Gitlab::ObjectifiedHash]
300
+ def get_file(path, ref:, project_id:)
301
+ gitlab.get_file(project_id, path, ref)
302
+ end
303
+
282
304
  private
283
305
 
284
306
  attr_reader :token, :ops_token
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../command'
4
+ require_relative '../../utils/constants'
5
+ require 'tty-markdown'
6
+ require 'tty-prompt'
7
+ require 'base64'
8
+
9
+ module Dri
10
+ module Commands
11
+ class Fetch
12
+ class Runbooks < Dri::Command
13
+ def initialize(options)
14
+ @options = options
15
+ end
16
+
17
+ def execute(folder: nil, input: $stdin, output: $stdout)
18
+ return fetch_summary(output: output) unless folder
19
+
20
+ fetch_runbook("#{folder}/index.md", output: output)
21
+ end
22
+
23
+ def fetch_summary(output:)
24
+ logger.info 'Fetching runbooks'
25
+ prompt = TTY::Prompt.new
26
+ runbooks = api_client.list_runbooks
27
+
28
+ return output.puts 'No runbooks could be found' if runbooks.empty?
29
+
30
+ choices = runbooks.map(&:path)
31
+ path = prompt.select('Which runbook would you like to look at?', choices)
32
+
33
+ fetch_runbook("#{path}/index.md", output: output)
34
+ end
35
+
36
+ def fetch_runbook(path, output:)
37
+ runbook = nil
38
+ spinner.run do
39
+ runbook = api_client.get_file(
40
+ path,
41
+ ref: 'main',
42
+ project_id: Utils::Constants::ProjectIDs::RUNBOOKS_PROJECT_ID
43
+ )
44
+ rescue Gitlab::Error::NotFound
45
+ logger.error "The runbook #{path} could not be found."
46
+ end
47
+
48
+ return unless runbook
49
+
50
+ content = Base64.decode64(runbook.content)
51
+ markdown(content, output)
52
+ end
53
+
54
+ private
55
+
56
+ def markdown(str, io)
57
+ io.puts TTY::Markdown.parse(str, symbols: :ascii)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -94,6 +94,17 @@ module Dri
94
94
  require_relative 'fetch/pipelines'
95
95
  Dri::Commands::Fetch::Pipelines.new(options).execute
96
96
  end
97
+
98
+ desc 'runbooks', 'Fetch runbooks'
99
+ method_option :help, aliases: '-h', type: :boolean,
100
+ desc: 'Display usage information'
101
+
102
+ def runbooks(*args)
103
+ return invoke :help, %w[runbooks] if options[:help]
104
+
105
+ require_relative 'fetch/runbooks'
106
+ Dri::Commands::Fetch::Runbooks.new(options).execute(folder: args.first)
107
+ end
97
108
  end
98
109
  end
99
110
  end
@@ -10,6 +10,7 @@ module Dri
10
10
  CUSTOMERSDOT_PROJECT_ID = 2670515
11
11
  FEATURE_FLAG_LOG_PROJECT_ID = 15208716
12
12
  INFRA_TEAM_PROD_PROJECT_ID = 7444821
13
+ RUNBOOKS_PROJECT_ID = 41045213
13
14
  end
14
15
 
15
16
  module Triage
data/lib/dri/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dri
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-16 00:00:00.000000000 Z
11
+ date: 2023-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amatch
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '4.18'
33
+ version: '4.19'
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: '4.18'
40
+ version: '4.19'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: httparty
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.20.0
47
+ version: 0.21.0
48
48
  type: :runtime
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: 0.20.0
54
+ version: 0.21.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: json
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.0.1
103
+ version: 1.2.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.0.1
110
+ version: 1.2.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: tty-box
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -128,28 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.4.0
131
+ version: 0.6.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.4.0
138
+ version: 0.6.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: tty-editor
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0.6'
145
+ version: '0.7'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0.6'
152
+ version: '0.7'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: tty-font
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -178,6 +178,20 @@ dependencies:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
180
  version: 0.6.0
181
+ - !ruby/object:Gem::Dependency
182
+ name: tty-markdown
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 0.7.0
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 0.7.0
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: tty-prompt
183
197
  requirement: !ruby/object:Gem::Requirement
@@ -315,6 +329,7 @@ files:
315
329
  - ".editorconfig"
316
330
  - ".gitignore"
317
331
  - ".gitlab-ci.yml"
332
+ - ".gitlab/merge_request_templates/Release.md"
318
333
  - ".rspec"
319
334
  - ".rubocop.yml"
320
335
  - ".ruby-version"
@@ -339,6 +354,7 @@ files:
339
354
  - lib/dri/commands/fetch/featureflags.rb
340
355
  - lib/dri/commands/fetch/pipelines.rb
341
356
  - lib/dri/commands/fetch/quarantines.rb
357
+ - lib/dri/commands/fetch/runbooks.rb
342
358
  - lib/dri/commands/fetch/testcases.rb
343
359
  - lib/dri/commands/fetch/triaged.rb
344
360
  - lib/dri/commands/incidents.rb