gitlab-labkit 0.21.3 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14048d91e2aa329e7917f040d355f7be56c2f489ebf127bfa20404a8f2f9be64
4
- data.tar.gz: ad10bb2702dd57e5d14fccc95c22c42741ccbe61dda33ec84a9c8a53298cb356
3
+ metadata.gz: 447d8fe136f58c456c4e8dc1c90e3664a436915becf619f1b747d13af817afb6
4
+ data.tar.gz: '0978b44b4a1c4bb6098ec545be92b3c0f8253c048361c479fd308f76e479de38'
5
5
  SHA512:
6
- metadata.gz: b47d6fe2f2cf24ab41a0829c0c70908f1f6848d077ad0d09cb57b1df5ea73bc42d279127ad944054ae2a3a8443369d64514b69f90b24f87a05045e55305a03c3
7
- data.tar.gz: 41f04b4d054735c701e80b242cba69aa79723a620abe059e0888b423be0d868e9ab792b8fce08451bc304b8eb84b684d67bb9bcfb67befefdc707188d492c433
6
+ metadata.gz: 4211c733283c75b13ee3a38d6d616bff31501138c6fcd92c261d9a8733d056c5017a7920029a5f391c3c3386618ec941e63fde3d439ff9993277c1047f3e206a
7
+ data.tar.gz: dbbd0ac0b29b7a1ae401b94b32d5bcf0a959e09d7ed418977c1c1cb85ed3cf2ce4c2f7305cec9d931aa3199e8632ca71165a713993132e2db7d473f9efafe6e5
data/Dangerfile CHANGED
@@ -2,10 +2,4 @@
2
2
 
3
3
  require 'gitlab-dangerfiles'
4
4
 
5
- gitlab_dangerfiles = Gitlab::Dangerfiles::Engine.new(self)
6
- gitlab_dangerfiles.import_plugins
7
- gitlab_dangerfiles.import_dangerfiles
8
-
9
- danger.import_plugin('danger/plugins/*.rb')
10
-
11
- danger.import_dangerfile(path: File.join('danger', 'roulette'))
5
+ Gitlab::Dangerfiles.for_project(self, 'labkit-ruby', &:import_defaults)
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_runtime_dependency "actionpack", ">= 5.0.0", "< 7.0.0"
23
23
  spec.add_runtime_dependency "activesupport", ">= 5.0.0", "< 7.0.0"
24
24
  spec.add_runtime_dependency "grpc", ">= 1.37" # Be sure to update the "grpc-tools" dev_dependency too
25
- spec.add_runtime_dependency "jaeger-client", "~> 1.1"
25
+ spec.add_runtime_dependency "jaeger-client", "~> 1.1.0"
26
26
  spec.add_runtime_dependency "opentracing", "~> 0.4"
27
27
  spec.add_runtime_dependency "pg_query", "~> 2.1"
28
28
  spec.add_runtime_dependency "redis", ">3.0.0", "<5.0.0"
@@ -9,7 +9,6 @@ require "active_support/core_ext/string/inflections"
9
9
  module Labkit
10
10
  # A context can be used to provide structured information on what resources
11
11
  # GitLab is working on within a service.
12
- # The currently supported keys are defined in the `KNOWN_KEYS` constant.
13
12
  #
14
13
  # Values can be provided by passing a hash. If one of the values is a Proc
15
14
  # the proc will only be called when the value is actually needed.
@@ -28,8 +27,6 @@ module Labkit
28
27
  CORRELATION_ID_KEY = "correlation_id"
29
28
  RAW_KEYS = [CORRELATION_ID_KEY].freeze
30
29
  HEADER_PREFIX = "X-Gitlab-"
31
- KNOWN_KEYS = %w[user project root_namespace subscription_plan caller_id
32
- remote_ip related_class feature_category client_id].freeze
33
30
 
34
31
  class << self
35
32
  def with_context(attributes = {})
@@ -122,7 +119,6 @@ module Labkit
122
119
 
123
120
  def assign_attributes(attributes)
124
121
  attributes = attributes.transform_keys(&method(:log_key))
125
- attributes = attributes.slice(*known_log_keys)
126
122
 
127
123
  data.merge!(attributes)
128
124
 
@@ -138,7 +134,7 @@ module Labkit
138
134
 
139
135
  private
140
136
 
141
- delegate :log_key, :known_log_keys, to: :class
137
+ delegate :log_key, to: :class
142
138
 
143
139
  attr_reader :data
144
140
 
@@ -10,6 +10,7 @@ module Labkit
10
10
  def call(_worker_class, job, _queue)
11
11
  worker_name = (job["wrapped"].presence || job["class"]).to_s
12
12
  data = job.merge(Labkit::Context.log_key(:caller_id) => worker_name)
13
+ .select { |key, _| key.start_with?("#{Labkit::Context::LOG_KEY}.") || Labkit::Context::RAW_KEYS.include?(key.to_s) }
13
14
 
14
15
  Labkit::Context.with_context(data) do |_context|
15
16
  yield
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-labkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.3
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Newdigate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-22 00:00:00.000000000 Z
11
+ date: 2022-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -70,14 +70,14 @@ dependencies:
70
70
  requirements:
71
71
  - - "~>"
72
72
  - !ruby/object:Gem::Version
73
- version: '1.1'
73
+ version: 1.1.0
74
74
  type: :runtime
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
- version: '1.1'
80
+ version: 1.1.0
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: opentracing
83
83
  requirement: !ruby/object:Gem::Requirement
@@ -371,8 +371,6 @@ files:
371
371
  - LICENSE
372
372
  - README.md
373
373
  - Rakefile
374
- - danger/plugins/project_helper.rb
375
- - danger/roulette/Dangerfile
376
374
  - gitlab-labkit.gemspec
377
375
  - lib/gitlab-labkit.rb
378
376
  - lib/labkit/context.rb
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Danger
4
- # Common helper functions for danger scripts
5
- class ProjectHelper < ::Danger::Plugin
6
- def changes
7
- # We do not need to categorize files in this code base
8
- helper.changes([])
9
- end
10
-
11
- def project_name
12
- "labkit-ruby"
13
- end
14
- end
15
- end
@@ -1,62 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- MESSAGE = <<MARKDOWN
4
- ## Reviewer roulette
5
-
6
- Changes that require review have been detected! A merge request is normally
7
- reviewed by both a reviewer and a maintainer in its primary category and by a
8
- maintainer in all other categories.
9
- MARKDOWN
10
-
11
- TABLE_MARKDOWN = <<MARKDOWN
12
-
13
- To spread load more evenly across eligible reviewers, Danger has picked a candidate for each
14
- review slot. Feel free to
15
- [override these selections](https://about.gitlab.com/handbook/engineering/projects/#labkit-ruby)
16
- if you think someone else would be better-suited
17
- or request help in the `#labkit` Slack channel.
18
-
19
- To read more on how to use the reviewer roulette, please take a look at the
20
- [Engineering workflow](https://about.gitlab.com/handbook/engineering/workflow/#basics)
21
- and [code review guidelines](https://docs.gitlab.com/ee/development/code_review.html).
22
-
23
- Once you've decided who will review this merge request, mention them as you
24
- normally would! Danger does not automatically notify them for you.
25
-
26
- | Reviewer | Maintainer |
27
- | -------- | ---------- |
28
- MARKDOWN
29
-
30
- def note_for_spins_role(spins, role)
31
- spins.each do |spin|
32
- note = note_for_spin_role(spin, role)
33
-
34
- return note if note
35
- end
36
-
37
- 'No %{role} available' % { role: role }
38
- end
39
-
40
- def note_for_spin_role(spin, role)
41
- spin.public_send(role)&.markdown_name(author: roulette.team_mr_author) # rubocop:disable GitlabSecurity/PublicSend
42
- end
43
-
44
- def markdown_row_for_spins(spins_array)
45
- reviewer_note = note_for_spins_role(spins_array, :reviewer)
46
- maintainer_note = note_for_spins_role(spins_array, :maintainer)
47
-
48
- "#{reviewer_note} | #{maintainer_note} |"
49
- end
50
-
51
- if project_helper.changes.any?
52
- project = project_helper.project_name
53
-
54
- random_roulette_spins = roulette.spin(project, [nil], timezone_experiment: false)
55
-
56
- rows = random_roulette_spins.map do |spin|
57
- markdown_row_for_spins([spin])
58
- end
59
-
60
- markdown(MESSAGE)
61
- markdown(TABLE_MARKDOWN + rows.join("\n")) unless rows.empty?
62
- end