gitlab-exporter 11.15.0 → 12.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.gitlab-ci.yml +29 -3
- data/.ruby-version +1 -1
- data/Gemfile.lock +16 -16
- data/config/gitlab-exporter.yml.example +5 -1
- data/gitlab-exporter.gemspec +3 -3
- data/lib/gitlab_exporter/database/row_count.rb +8 -21
- data/lib/gitlab_exporter/rack_vulndb_255039_patch.rb +35 -0
- data/lib/gitlab_exporter/tls_helper.rb +39 -0
- data/lib/gitlab_exporter/version.rb +1 -1
- data/lib/gitlab_exporter/web_exporter.rb +46 -1
- data/spec/integration/cli_spec.rb +20 -0
- data/spec/spec_helper.rb +17 -2
- metadata +15 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c67811051d44f3c3e2fe6213eeb60f7a1c7997ddd2409008d52949cff5560fa
|
4
|
+
data.tar.gz: 0d750aef0b50d237783a09c22c35fdbcef0651a4998f6363cef2447786b9f8e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e60b685e6005754b165963ad218462875a80eb26aef8f5a01753fb90c138f6e98e2ceb13a43aea058487579c2a9068328611af78b01ba6b58a391cc0d0e84a0
|
7
|
+
data.tar.gz: 611b3b9f1a66a50e7754a27f16f8fbd12f143559607fa1a4097c252823ace586043d334df8ae2a6a7060a52adb01b24ff6978141267bdddb2dc9b595d8f004e1
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
@@ -12,6 +12,7 @@ variables:
|
|
12
12
|
stages:
|
13
13
|
- test
|
14
14
|
- dast
|
15
|
+
- publish
|
15
16
|
|
16
17
|
default:
|
17
18
|
image: ruby:${RUBY_VERSION}
|
@@ -24,7 +25,8 @@ default:
|
|
24
25
|
.before_scripts: &before_scripts
|
25
26
|
- git config --global user.email "bot@gitlab.com"
|
26
27
|
- git config --global user.name "Bot User"
|
27
|
-
- bundle
|
28
|
+
- bundle config set --local deployment true
|
29
|
+
- bundle install -j $(nproc)
|
28
30
|
|
29
31
|
workflow:
|
30
32
|
rules: &workflow_rules
|
@@ -41,8 +43,19 @@ rspec:
|
|
41
43
|
before_script: *before_scripts
|
42
44
|
parallel:
|
43
45
|
matrix:
|
44
|
-
- RUBY_VERSION: "2.7"
|
45
|
-
|
46
|
+
- RUBY_VERSION: ["2.7", "3.0"]
|
47
|
+
|
48
|
+
rspec_integration:
|
49
|
+
script:
|
50
|
+
- bundle exec rspec spec -t integration -f d -c
|
51
|
+
before_script: *before_scripts
|
52
|
+
services:
|
53
|
+
- redis:latest
|
54
|
+
variables:
|
55
|
+
REDIS_URL: "redis://redis"
|
56
|
+
parallel:
|
57
|
+
matrix:
|
58
|
+
- RUBY_VERSION: ["2.7", "3.0"]
|
46
59
|
|
47
60
|
rubocop:
|
48
61
|
script:
|
@@ -57,3 +70,16 @@ gemnasium-dependency_scanning:
|
|
57
70
|
|
58
71
|
secret_detection:
|
59
72
|
rules: *workflow_rules
|
73
|
+
|
74
|
+
publish_to_rubygems:
|
75
|
+
stage: publish
|
76
|
+
script:
|
77
|
+
- mkdir -p ~/.gem
|
78
|
+
- 'echo ":rubygems_api_key: ${RUBYGEMS_API_KEY}" > ~/.gem/credentials'
|
79
|
+
- chmod 0600 ~/.gem/credentials
|
80
|
+
- gem build gitlab-exporter.gemspec --output=gitlab-exporter.gem
|
81
|
+
- gem push gitlab-exporter.gem
|
82
|
+
before_script: *before_scripts
|
83
|
+
rules:
|
84
|
+
# Only push to RubyGems.org when we tag a new version
|
85
|
+
- if: '$CI_COMMIT_TAG'
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.7
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gitlab-exporter (
|
4
|
+
gitlab-exporter (12.1.0)
|
5
5
|
connection_pool (= 2.2.5)
|
6
6
|
faraday (~> 1.8.0)
|
7
7
|
pg (= 1.2.3)
|
8
|
-
puma (= 5.6.
|
8
|
+
puma (= 5.6.5)
|
9
9
|
quantile (= 0.2.1)
|
10
10
|
redis (= 4.4.0)
|
11
|
-
redis-namespace (= 1.
|
11
|
+
redis-namespace (= 1.9.0)
|
12
12
|
sidekiq (= 6.4.0)
|
13
|
-
sinatra (~> 2.
|
13
|
+
sinatra (~> 2.2.0)
|
14
14
|
|
15
15
|
GEM
|
16
16
|
remote: https://rubygems.org/
|
@@ -37,24 +37,24 @@ GEM
|
|
37
37
|
faraday-net_http_persistent (1.2.0)
|
38
38
|
faraday-patron (1.0.0)
|
39
39
|
faraday-rack (1.0.0)
|
40
|
-
multipart-post (2.
|
41
|
-
mustermann (
|
40
|
+
multipart-post (2.2.3)
|
41
|
+
mustermann (2.0.2)
|
42
42
|
ruby2_keywords (~> 0.0.1)
|
43
43
|
nio4r (2.5.8)
|
44
44
|
parallel (1.20.1)
|
45
45
|
parser (3.0.0.0)
|
46
46
|
ast (~> 2.4.1)
|
47
47
|
pg (1.2.3)
|
48
|
-
puma (5.6.
|
48
|
+
puma (5.6.5)
|
49
49
|
nio4r (~> 2.0)
|
50
50
|
quantile (0.2.1)
|
51
|
-
rack (2.2.
|
52
|
-
rack-protection (2.
|
51
|
+
rack (2.2.5)
|
52
|
+
rack-protection (2.2.4)
|
53
53
|
rack
|
54
54
|
rainbow (3.0.0)
|
55
55
|
redis (4.4.0)
|
56
|
-
redis-namespace (1.
|
57
|
-
redis (>=
|
56
|
+
redis-namespace (1.9.0)
|
57
|
+
redis (>= 4)
|
58
58
|
regexp_parser (2.0.3)
|
59
59
|
rexml (3.2.4)
|
60
60
|
rspec (3.7.0)
|
@@ -87,12 +87,12 @@ GEM
|
|
87
87
|
connection_pool (>= 2.2.2)
|
88
88
|
rack (~> 2.0)
|
89
89
|
redis (>= 4.2.0)
|
90
|
-
sinatra (2.
|
91
|
-
mustermann (~>
|
90
|
+
sinatra (2.2.4)
|
91
|
+
mustermann (~> 2.0)
|
92
92
|
rack (~> 2.2)
|
93
|
-
rack-protection (= 2.
|
93
|
+
rack-protection (= 2.2.4)
|
94
94
|
tilt (~> 2.0)
|
95
|
-
tilt (2.0.
|
95
|
+
tilt (2.0.11)
|
96
96
|
unicode-display_width (1.7.0)
|
97
97
|
webrick (1.7.0)
|
98
98
|
|
@@ -107,4 +107,4 @@ DEPENDENCIES
|
|
107
107
|
webrick (~> 1.7)
|
108
108
|
|
109
109
|
BUNDLED WITH
|
110
|
-
2.2.
|
110
|
+
2.2.22
|
@@ -6,11 +6,15 @@ db_common: &db_common
|
|
6
6
|
|
7
7
|
# Web server config
|
8
8
|
server:
|
9
|
-
name:
|
9
|
+
name: webrick # cf. https://github.com/sinatra/sinatra#available-settings
|
10
10
|
listen_address: 0.0.0.0
|
11
11
|
listen_port: 9168
|
12
12
|
# Maximum amount of memory to use in megabytes, after which the process is killed
|
13
13
|
memory_threshold: 1024
|
14
|
+
# TLS settings
|
15
|
+
tls_enabled: false
|
16
|
+
tls_cert_path: /tmp/server.crt
|
17
|
+
tls_key_path: /tmp/server.key
|
14
18
|
|
15
19
|
# Probes config
|
16
20
|
probes:
|
data/gitlab-exporter.gemspec
CHANGED
@@ -23,12 +23,12 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_runtime_dependency "connection_pool", "2.2.5"
|
24
24
|
s.add_runtime_dependency "faraday", "~> 1.8.0"
|
25
25
|
s.add_runtime_dependency "pg", "1.2.3"
|
26
|
-
s.add_runtime_dependency "puma", "5.6.
|
26
|
+
s.add_runtime_dependency "puma", "5.6.5"
|
27
27
|
s.add_runtime_dependency "quantile", "0.2.1"
|
28
28
|
s.add_runtime_dependency "redis", "4.4.0"
|
29
|
-
s.add_runtime_dependency "redis-namespace", "1.
|
29
|
+
s.add_runtime_dependency "redis-namespace", "1.9.0"
|
30
30
|
s.add_runtime_dependency "sidekiq", "6.4.0"
|
31
|
-
s.add_runtime_dependency "sinatra", "~> 2.
|
31
|
+
s.add_runtime_dependency "sinatra", "~> 2.2.0"
|
32
32
|
|
33
33
|
s.add_development_dependency "rspec", "~> 3.7.0"
|
34
34
|
s.add_development_dependency "rspec-expectations", "~> 3.7.0"
|
@@ -19,11 +19,6 @@ module GitLab
|
|
19
19
|
projects.mirror = true
|
20
20
|
AND projects.archived = false
|
21
21
|
AND project_mirror_data.retry_count <= 14
|
22
|
-
AND (
|
23
|
-
(projects.visibility_level = 20 AND root_namespaces.visibility_level = 20)
|
24
|
-
OR
|
25
|
-
plans.name IN ('early_adopter', 'bronze', 'silver', 'gold')
|
26
|
-
)
|
27
22
|
AND project_mirror_data.next_execution_timestamp > '2020-03-28'
|
28
23
|
SQL
|
29
24
|
|
@@ -31,15 +26,6 @@ module GitLab
|
|
31
26
|
select: :projects,
|
32
27
|
joins: <<~SQL,
|
33
28
|
INNER JOIN project_mirror_data ON project_mirror_data.project_id = projects.id
|
34
|
-
INNER JOIN namespaces AS root_namespaces ON root_namespaces.id = (
|
35
|
-
WITH RECURSIVE "base_and_ancestors" AS (
|
36
|
-
(SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."id" = projects.namespace_id)
|
37
|
-
UNION
|
38
|
-
(SELECT "namespaces".* FROM "namespaces", "base_and_ancestors" WHERE "namespaces"."id" = "base_and_ancestors"."parent_id")
|
39
|
-
) SELECT "namespaces".id FROM "base_and_ancestors" AS "namespaces" WHERE "namespaces"."parent_id" IS NULL
|
40
|
-
)
|
41
|
-
LEFT JOIN gitlab_subscriptions ON gitlab_subscriptions.namespace_id = root_namespaces.id
|
42
|
-
LEFT JOIN plans ON plans.id = gitlab_subscriptions.hosted_plan_id
|
43
29
|
SQL
|
44
30
|
check: "SELECT 1 FROM information_schema.tables WHERE table_name='plans'"
|
45
31
|
}.freeze
|
@@ -125,9 +111,10 @@ module GitLab
|
|
125
111
|
archived: {}
|
126
112
|
}
|
127
113
|
},
|
128
|
-
|
114
|
+
namespaces: {
|
129
115
|
select: :namespaces,
|
130
116
|
fields: {
|
117
|
+
type: {},
|
131
118
|
visibility_level: {},
|
132
119
|
root: { definition: "(parent_id IS NULL)" }
|
133
120
|
}
|
@@ -136,7 +123,7 @@ module GitLab
|
|
136
123
|
select: :container_repositories,
|
137
124
|
where: <<~SQL
|
138
125
|
migration_state <> 'import_done'
|
139
|
-
AND created_at < '2022-
|
126
|
+
AND created_at < '2022-08-17 00:00:00'
|
140
127
|
SQL
|
141
128
|
},
|
142
129
|
container_repositories_pre_importing: {
|
@@ -174,7 +161,7 @@ module GitLab
|
|
174
161
|
select: :container_repositories,
|
175
162
|
where: <<~SQL
|
176
163
|
migration_state <> 'import_done'
|
177
|
-
AND created_at < '2022-
|
164
|
+
AND created_at < '2022-08-17 00:00:00'
|
178
165
|
AND (migration_plan IN ('free', 'early_adopter')
|
179
166
|
OR migration_plan IS NULL)
|
180
167
|
SQL
|
@@ -182,7 +169,7 @@ module GitLab
|
|
182
169
|
container_repositories_import_done_free: {
|
183
170
|
select: :container_repositories,
|
184
171
|
where: <<~SQL
|
185
|
-
migration_state = 'import_done'
|
172
|
+
(migration_state = 'import_done' OR created_at >= '2022-08-17 00:00:00')
|
186
173
|
AND (migration_plan IN ('free', 'early_adopter')
|
187
174
|
OR migration_plan IS NULL)
|
188
175
|
SQL
|
@@ -191,21 +178,21 @@ module GitLab
|
|
191
178
|
select: :container_repositories,
|
192
179
|
where: <<~SQL
|
193
180
|
migration_state = 'pre_importing'
|
194
|
-
AND (COALESCE(migration_pre_import_started_at,
|
181
|
+
AND (COALESCE(migration_pre_import_started_at, TO_TIMESTAMP(0)) < (now() - INTERVAL '20 minutes'))
|
195
182
|
SQL
|
196
183
|
},
|
197
184
|
container_repositories_stalled_pre_import_done: {
|
198
185
|
select: :container_repositories,
|
199
186
|
where: <<~SQL
|
200
187
|
migration_state = 'pre_import_done'
|
201
|
-
AND (COALESCE(migration_pre_import_done_at,
|
188
|
+
AND (COALESCE(migration_pre_import_done_at, TO_TIMESTAMP(0)) < (now() - INTERVAL '5 minutes'))
|
202
189
|
SQL
|
203
190
|
},
|
204
191
|
container_repositories_stalled_importing: {
|
205
192
|
select: :container_repositories,
|
206
193
|
where: <<~SQL
|
207
194
|
migration_state = 'importing'
|
208
|
-
AND (COALESCE(migration_import_started_at,
|
195
|
+
AND (COALESCE(migration_import_started_at, TO_TIMESTAMP(0)) < (now() - INTERVAL '5 minutes'))
|
209
196
|
SQL
|
210
197
|
},
|
211
198
|
container_repositories_skipped_not_in_plan: {
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
if Gem.loaded_specs["rack"].version >= Gem::Version.new("3.0.0")
|
4
|
+
fail <<~ERR
|
5
|
+
This patch is unnecessary in Rack versions 3.0.0 or newer.
|
6
|
+
Please remove this file and the associated spec.
|
7
|
+
|
8
|
+
See https://github.com/rack/rack/blob/main/CHANGELOG.md#security (issue #1733)
|
9
|
+
ERR
|
10
|
+
end
|
11
|
+
|
12
|
+
# Patches a cache poisoning attack vector in Rack by not allowing semicolons
|
13
|
+
# to delimit query parameters.
|
14
|
+
# See https://github.com/rack/rack/issues/1732.
|
15
|
+
#
|
16
|
+
# Solution is taken from the same issue.
|
17
|
+
#
|
18
|
+
# The actual patch is due for release in Rack 3.0.0.
|
19
|
+
module Rack
|
20
|
+
class Request # rubocop:disable Style/Documentation
|
21
|
+
Helpers.module_eval do
|
22
|
+
# rubocop: disable Naming/MethodName
|
23
|
+
def GET
|
24
|
+
if get_header(RACK_REQUEST_QUERY_STRING) == query_string
|
25
|
+
get_header(RACK_REQUEST_QUERY_HASH)
|
26
|
+
else
|
27
|
+
query_hash = parse_query(query_string, "&") # only allow ampersand here
|
28
|
+
set_header(RACK_REQUEST_QUERY_STRING, query_string)
|
29
|
+
set_header(RACK_REQUEST_QUERY_HASH, query_hash)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
# rubocop: enable Naming/MethodName
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Contains helper methods to generate TLS related configuration for web servers
|
2
|
+
module TLSHelper
|
3
|
+
CERT_REGEX = /-----BEGIN CERTIFICATE-----(?:.|\n)+?-----END CERTIFICATE-----/.freeze
|
4
|
+
|
5
|
+
def validate_tls_config(config)
|
6
|
+
%i[tls_cert_path tls_key_path].each do |key|
|
7
|
+
fail "TLS enabled, but #{key} not specified in config" unless config.key?(key)
|
8
|
+
|
9
|
+
fail "File specified via #{key} not found: #{config[key]}" unless File.exist?(config[key])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def webrick_tls_config(config)
|
14
|
+
# This monkey-patches WEBrick::GenericServer, so never require this unless TLS is enabled.
|
15
|
+
require "webrick/ssl"
|
16
|
+
|
17
|
+
certs = load_ca_certs_bundle(File.binread(config[:tls_cert_path]))
|
18
|
+
|
19
|
+
{
|
20
|
+
SSLEnable: true,
|
21
|
+
SSLCertificate: certs.shift,
|
22
|
+
SSLPrivateKey: OpenSSL::PKey.read(File.binread(config[:tls_key_path])),
|
23
|
+
# SSLStartImmediately is true by default according to the docs, but when WEBrick creates the
|
24
|
+
# SSLServer internally, the switch was always nil for some reason. Setting this explicitly fixes this.
|
25
|
+
SSLStartImmediately: true,
|
26
|
+
SSLExtraChainCert: certs
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# In Ruby OpenSSL v3.0.0, this can be replaced by OpenSSL::X509::Certificate.load
|
31
|
+
# https://github.com/ruby/openssl/issues/254
|
32
|
+
def load_ca_certs_bundle(ca_certs_string)
|
33
|
+
return [] unless ca_certs_string
|
34
|
+
|
35
|
+
ca_certs_string.scan(CERT_REGEX).map do |ca_cert_string|
|
36
|
+
OpenSSL::X509::Certificate.new(ca_cert_string)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,5 +1,9 @@
|
|
1
1
|
require "sinatra/base"
|
2
2
|
require "English"
|
3
|
+
require "cgi"
|
4
|
+
|
5
|
+
require_relative "rack_vulndb_255039_patch"
|
6
|
+
require_relative "tls_helper"
|
3
7
|
|
4
8
|
module GitLab
|
5
9
|
module Exporter
|
@@ -51,6 +55,8 @@ module GitLab
|
|
51
55
|
end
|
52
56
|
|
53
57
|
class << self
|
58
|
+
include TLSHelper
|
59
|
+
|
54
60
|
DEFAULT_WEB_SERVER = "webrick".freeze
|
55
61
|
|
56
62
|
def setup(config)
|
@@ -74,8 +80,47 @@ module GitLab
|
|
74
80
|
config ||= {}
|
75
81
|
|
76
82
|
set(:server, config.fetch(:name, DEFAULT_WEB_SERVER))
|
77
|
-
set(:bind, config.fetch(:listen_address, "0.0.0.0"))
|
78
83
|
set(:port, config.fetch(:listen_port, 9168))
|
84
|
+
|
85
|
+
# Depending on whether TLS is enabled or not, bind string
|
86
|
+
# will be different.
|
87
|
+
if config.fetch(:tls_enabled, "false").to_s == "true"
|
88
|
+
set_tls_config(config)
|
89
|
+
else
|
90
|
+
set(:bind, config.fetch(:listen_address, "0.0.0.0"))
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def set_tls_config(config) # rubocop:disable Naming/AccessorMethodName
|
95
|
+
validate_tls_config(config)
|
96
|
+
|
97
|
+
web_server = config.fetch(:name, DEFAULT_WEB_SERVER)
|
98
|
+
if web_server == "webrick"
|
99
|
+
set_webrick_tls(config)
|
100
|
+
elsif web_server == "puma"
|
101
|
+
set_puma_tls(config)
|
102
|
+
else
|
103
|
+
fail "TLS not supported for web server `#{web_server}`."
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def set_webrick_tls(config) # rubocop:disable Naming/AccessorMethodName
|
108
|
+
server_settings = {}
|
109
|
+
server_settings.merge!(webrick_tls_config(config))
|
110
|
+
|
111
|
+
set(:bind, config.fetch(:listen_address, "0.0.0.0"))
|
112
|
+
set(:server_settings, server_settings)
|
113
|
+
end
|
114
|
+
|
115
|
+
def set_puma_tls(config) # rubocop:disable Naming/AccessorMethodName
|
116
|
+
listen_address = config.fetch(:listen_address, "0.0.0.0")
|
117
|
+
listen_port = config.fetch(:listen_port, 8443)
|
118
|
+
tls_cert_path = CGI.escape(config.fetch(:tls_cert_path))
|
119
|
+
tls_key_path = CGI.escape(config.fetch(:tls_key_path))
|
120
|
+
|
121
|
+
bind_string = "ssl://#{listen_address}:#{listen_port}?cert=#{tls_cert_path}&key=#{tls_key_path}"
|
122
|
+
|
123
|
+
set(:bind, bind_string)
|
79
124
|
end
|
80
125
|
|
81
126
|
def setup_probes(config)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "gitlab_exporter/cli"
|
3
|
+
|
4
|
+
module GitLab
|
5
|
+
module Exporter
|
6
|
+
module CLI
|
7
|
+
describe SidekiqRunner, :integration do
|
8
|
+
let(:redis_url) { ENV.fetch("REDIS_URL", "redis://localhost:6379") }
|
9
|
+
let(:io) { StringIO.new }
|
10
|
+
|
11
|
+
it "can properly reach out to redis" do
|
12
|
+
args = CLIArgs.new([io], options: { /^--redis-url/ => redis_url })
|
13
|
+
runner = SidekiqRunner.new(args)
|
14
|
+
|
15
|
+
expect { runner.run }.not_to raise_error
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,6 +7,10 @@ require "tmpdir"
|
|
7
7
|
$LOAD_PATH.unshift File.expand_path(".")
|
8
8
|
Dir["spec/support/**/*.rb"].each do |f| require f end
|
9
9
|
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.filter_run_excluding integration: true
|
12
|
+
end
|
13
|
+
|
10
14
|
class GitRepoBuilder
|
11
15
|
def origin
|
12
16
|
@origin ||= create_origin
|
@@ -41,19 +45,30 @@ class GitRepoBuilder
|
|
41
45
|
end
|
42
46
|
|
43
47
|
class CLIArgs
|
44
|
-
def initialize(args)
|
48
|
+
def initialize(args, options: {})
|
45
49
|
@arguments = args
|
50
|
+
@options = options
|
46
51
|
end
|
47
52
|
|
48
53
|
def options
|
49
54
|
yield self
|
55
|
+
|
56
|
+
self
|
50
57
|
end
|
51
58
|
|
52
|
-
def on(*
|
59
|
+
def on(flag, *_)
|
60
|
+
match = @options.find { |regex, _| regex.match?(flag) }
|
61
|
+
|
62
|
+
yield match[1] if match
|
63
|
+
end
|
53
64
|
|
54
65
|
def banner=(banner); end
|
55
66
|
|
56
67
|
def parse!
|
57
68
|
@arguments
|
58
69
|
end
|
70
|
+
|
71
|
+
def shift
|
72
|
+
@arguments.shift
|
73
|
+
end
|
59
74
|
end
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-exporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 12.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pablo Carranza
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2016-07-27 00:00:00.000000000 Z
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 5.6.
|
61
|
+
version: 5.6.5
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 5.6.
|
68
|
+
version: 5.6.5
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: quantile
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
103
|
+
version: 1.9.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.
|
110
|
+
version: 1.9.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: sidekiq
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 2.
|
131
|
+
version: 2.2.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: 2.
|
138
|
+
version: 2.2.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,8 +202,10 @@ files:
|
|
202
202
|
- lib/gitlab_exporter/prober.rb
|
203
203
|
- lib/gitlab_exporter/process.rb
|
204
204
|
- lib/gitlab_exporter/prometheus.rb
|
205
|
+
- lib/gitlab_exporter/rack_vulndb_255039_patch.rb
|
205
206
|
- lib/gitlab_exporter/ruby.rb
|
206
207
|
- lib/gitlab_exporter/sidekiq.rb
|
208
|
+
- lib/gitlab_exporter/tls_helper.rb
|
207
209
|
- lib/gitlab_exporter/util.rb
|
208
210
|
- lib/gitlab_exporter/version.rb
|
209
211
|
- lib/gitlab_exporter/web_exporter.rb
|
@@ -215,6 +217,7 @@ files:
|
|
215
217
|
- spec/fixtures/smaps/sample.txt
|
216
218
|
- spec/git_process_proper_spec.rb
|
217
219
|
- spec/git_spec.rb
|
220
|
+
- spec/integration/cli_spec.rb
|
218
221
|
- spec/memstats_spec.rb
|
219
222
|
- spec/prometheus_metrics_spec.rb
|
220
223
|
- spec/ruby_spec.rb
|
@@ -224,7 +227,7 @@ homepage: http://gitlab.com
|
|
224
227
|
licenses:
|
225
228
|
- MIT
|
226
229
|
metadata: {}
|
227
|
-
post_install_message:
|
230
|
+
post_install_message:
|
228
231
|
rdoc_options: []
|
229
232
|
require_paths:
|
230
233
|
- lib
|
@@ -239,8 +242,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
242
|
- !ruby/object:Gem::Version
|
240
243
|
version: '0'
|
241
244
|
requirements: []
|
242
|
-
rubygems_version: 3.
|
243
|
-
signing_key:
|
245
|
+
rubygems_version: 3.1.6
|
246
|
+
signing_key:
|
244
247
|
specification_version: 4
|
245
248
|
summary: GitLab metrics exporter
|
246
249
|
test_files:
|
@@ -252,6 +255,7 @@ test_files:
|
|
252
255
|
- spec/fixtures/smaps/sample.txt
|
253
256
|
- spec/git_process_proper_spec.rb
|
254
257
|
- spec/git_spec.rb
|
258
|
+
- spec/integration/cli_spec.rb
|
255
259
|
- spec/memstats_spec.rb
|
256
260
|
- spec/prometheus_metrics_spec.rb
|
257
261
|
- spec/ruby_spec.rb
|