sensu-plugins-jenkins 0.1.0 → 1.0.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
  SHA1:
3
- metadata.gz: 9e757920a55c831fe7d0238b5845533a263b4e67
4
- data.tar.gz: ae38f4a31c37b33a77619b2a788f7c4c326f6831
3
+ metadata.gz: ce5da8e2554e866365bfa1883dd804a087f5e8b5
4
+ data.tar.gz: bbcdaf848ac7bfdf329d0b7529088de7eb28db6d
5
5
  SHA512:
6
- metadata.gz: 86379dc0571be4a12e1b7bfcfe934457574f83170c051d23d15e02e2d79b257269b75a26a94f9511f3139e760e72ffa1f2dc34a2bfb0d338f5be34853f656008
7
- data.tar.gz: c24519f8cd7ea4e1d4b939d0e816d2cd2fd599f43b27a262e45ba281fe7779926ecc4bb9cb8da0d11c93a28aa68472198dbccdc194324463c7a661cc447ff737
6
+ metadata.gz: 77d61043c24ac39505cf80c8f3c4f3a6affe49068c79a4574f855f844cafa86bea7f9c5e6231a821ac4e812213c84ffc3b6eb9a5e89dec74f9097b19a6ffaaae
7
+ data.tar.gz: b36af9e56820c97762183b7f989bcfa699b87bc7f64693689dd6128f2be20320025acb85c857aa453222eab8c6e212274090266925c252b7d771b2cba7210357
data/CHANGELOG.md CHANGED
@@ -3,7 +3,19 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
- ## [Unreleased][unreleased]
6
+ ## [Unreleased]
7
+
8
+ ## [1.0.0] - 2016-10-04
9
+ ### Added
10
+ - Ruby 2.3.0 support
11
+
12
+ ### Removed
13
+ - Ruby 1.9.3 support
14
+
15
+ ### Changed
16
+ - check-jenkins-job-status.rb: if a job is in progress, use the result of the last completed build instead
17
+ - Update to rubocop 0.40 and cleanup
18
+ - Relax `sensu-plugin` dependency
7
19
 
8
20
  ## [0.1.0] - 2015-12-14
9
21
  ### Added
@@ -27,12 +39,18 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
27
39
  fail to succeed within a certain duration or configurable time window.
28
40
 
29
41
  ## [0.0.2] - 2015-06-03
30
-
31
42
  ### Added
32
43
  - PR #1
33
44
  - Added ability to specify Jenkins port. Will default to 8080
34
45
 
35
46
  ## 0.0.1 - 2015-05-04
36
-
37
47
  ### Added
38
48
  - initial release
49
+
50
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/1.0.0...HEAD
51
+ [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/0.1.0...1.0.0
52
+ [0.1.0]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/0.0.5...0.1.0
53
+ [0.0.5]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/0.0.4...0.0.5
54
+ [0.0.4]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/0.0.3...0.0.4
55
+ [0.0.3]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/0.0.2...0.0.3
56
+ [0.0.2]: https://github.com/sensu-plugins/sensu-plugins-jenkins/compare/0.0.1...0.0.2
data/README.md CHANGED
@@ -5,7 +5,6 @@
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-jenkins/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-jenkins)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-jenkins/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-jenkins)
7
7
  [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-jenkins.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-jenkins)
8
- [![Codeship Status for sensu-plugins/sensu-plugins-jenkins](https://codeship.com/projects/996809a0-d48b-0132-55b8-02473ab9142c/status?branch=master)](https://codeship.com/projects/77815)
9
8
 
10
9
  ## Functionality
11
10
 
@@ -115,15 +115,15 @@ class JenkinsBuildTime < Sensu::Plugin::Check::CLI
115
115
  time_after_window_start_yesterday = (window_start - ONE_DAY) < time
116
116
  time_in_window_yesterday = time_after_window_start_yesterday && (window_end - ONE_DAY) > time
117
117
 
118
- if @now < window_end && @now > window_start # we are in the window, so we will accept today or yesterday
119
- time_ok = (time_in_window_today || time_in_window_yesterday)
120
- elsif @now < window_end
121
- # we are before the window, so we only accept yesterday
122
- time_ok = time_in_window_yesterday
123
- else
124
- # we are after the window, so we only accept today
125
- time_ok = time_in_window_today
126
- end
118
+ time_ok = if @now < window_end && @now > window_start # we are in the window, so we will accept today or yesterday
119
+ (time_in_window_today || time_in_window_yesterday)
120
+ elsif @now < window_end
121
+ # we are before the window, so we only accept yesterday
122
+ time_in_window_yesterday
123
+ else
124
+ # we are after the window, so we only accept today
125
+ time_in_window_today
126
+ end
127
127
  time_ok
128
128
  end
129
129
 
@@ -144,7 +144,7 @@ class JenkinsBuildTime < Sensu::Plugin::Check::CLI
144
144
  job_param = config[:jobs].split(',')
145
145
  job_param.each do |j|
146
146
  name, time_expression = j.split('=')
147
- fail "Jobs mut be expressed as JOB_NAME=TIME_EXPRESSION. Invalid parameter: '#{j}'" if time_expression.nil?
147
+ raise "Jobs mut be expressed as JOB_NAME=TIME_EXPRESSION. Invalid parameter: '#{j}'" if time_expression.nil?
148
148
  jobs[name] = time_expression
149
149
  end
150
150
  jobs
@@ -4,6 +4,7 @@
4
4
  #
5
5
  # DESCRIPTION:
6
6
  # This plugin checks that the Jenkins Metrics healthcheck is healthy throughout
7
+ # See the Jenkins Metric plugin: https://wiki.jenkins-ci.org/display/JENKINS/Metrics+Plugin
7
8
  #
8
9
  # OUTPUT:
9
10
  # plain text
@@ -84,7 +84,14 @@ class JenkinsJobChecker < Sensu::Plugin::Check::CLI
84
84
  end
85
85
 
86
86
  def job_status(job_name)
87
- jenkins_api_client.job.get_current_build_status(job_name)
87
+ status = jenkins_api_client.job.get_current_build_status(job_name)
88
+ # If the job is currently running, get the status of the last build instead
89
+ if status == 'running'
90
+ last_build = jenkins_api_client.job.get_current_build_number(job_name) - 1
91
+ build = jenkins_api_client.job.get_build_details(job_name, last_build)
92
+ status = build['result'].downcase
93
+ end
94
+ status
88
95
  rescue
89
96
  critical "Error looking up Jenkins job: #{job_name}"
90
97
  end
@@ -38,7 +38,7 @@ require 'json'
38
38
  # Jenkins JQS Metrics
39
39
  #
40
40
  class JenkinsJQSMetrics < Sensu::Plugin::Metric::CLI::Graphite
41
- SKIP_ROOT_KEYS = %w(version)
41
+ SKIP_ROOT_KEYS = %w(version).freeze
42
42
 
43
43
  option :scheme,
44
44
  description: 'Metric naming scheme',
@@ -38,7 +38,7 @@ require 'json'
38
38
  # Jenkins Metrics
39
39
  #
40
40
  class JenkinsMetrics < Sensu::Plugin::Metric::CLI::Graphite
41
- SKIP_ROOT_KEYS = %w(version)
41
+ SKIP_ROOT_KEYS = %w(version).freeze
42
42
 
43
43
  option :scheme,
44
44
  description: 'Metric naming scheme',
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsJenkins
2
2
  module Version
3
- MAJOR = 0
4
- MINOR = 1
3
+ MAJOR = 1
4
+ MINOR = 0
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,51 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-jenkins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRIwEAYDVQQDDAltYXR0
14
- am9uZXMxGDAWBgoJkiaJk/IsZAEZFgh5aWVsZGJvdDETMBEGCgmSJomT8ixkARkW
15
- A2NvbTAeFw0x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4lk
31
- HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
- -----END CERTIFICATE-----
33
- date: 2015-12-14 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2016-10-05 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: sensu-plugin
37
15
  requirement: !ruby/object:Gem::Requirement
38
16
  requirements:
39
- - - '='
17
+ - - "~>"
40
18
  - !ruby/object:Gem::Version
41
- version: 1.2.0
19
+ version: '1.2'
42
20
  type: :runtime
43
21
  prerelease: false
44
22
  version_requirements: !ruby/object:Gem::Requirement
45
23
  requirements:
46
- - - '='
24
+ - - "~>"
47
25
  - !ruby/object:Gem::Version
48
- version: 1.2.0
26
+ version: '1.2'
49
27
  - !ruby/object:Gem::Dependency
50
28
  name: rest-client
51
29
  requirement: !ruby/object:Gem::Requirement
@@ -89,143 +67,143 @@ dependencies:
89
67
  - !ruby/object:Gem::Version
90
68
  version: 0.10.6
91
69
  - !ruby/object:Gem::Dependency
92
- name: codeclimate-test-reporter
70
+ name: bundler
93
71
  requirement: !ruby/object:Gem::Requirement
94
72
  requirements:
95
73
  - - "~>"
96
74
  - !ruby/object:Gem::Version
97
- version: '0.4'
75
+ version: '1.7'
98
76
  type: :development
99
77
  prerelease: false
100
78
  version_requirements: !ruby/object:Gem::Requirement
101
79
  requirements:
102
80
  - - "~>"
103
81
  - !ruby/object:Gem::Version
104
- version: '0.4'
82
+ version: '1.7'
105
83
  - !ruby/object:Gem::Dependency
106
- name: rubocop
84
+ name: codeclimate-test-reporter
107
85
  requirement: !ruby/object:Gem::Requirement
108
86
  requirements:
109
- - - '='
87
+ - - "~>"
110
88
  - !ruby/object:Gem::Version
111
- version: 0.32.1
89
+ version: '0.4'
112
90
  type: :development
113
91
  prerelease: false
114
92
  version_requirements: !ruby/object:Gem::Requirement
115
93
  requirements:
116
- - - '='
94
+ - - "~>"
117
95
  - !ruby/object:Gem::Version
118
- version: 0.32.1
96
+ version: '0.4'
119
97
  - !ruby/object:Gem::Dependency
120
- name: rspec
98
+ name: github-markup
121
99
  requirement: !ruby/object:Gem::Requirement
122
100
  requirements:
123
101
  - - "~>"
124
102
  - !ruby/object:Gem::Version
125
- version: '3.1'
103
+ version: '1.3'
126
104
  type: :development
127
105
  prerelease: false
128
106
  version_requirements: !ruby/object:Gem::Requirement
129
107
  requirements:
130
108
  - - "~>"
131
109
  - !ruby/object:Gem::Version
132
- version: '3.1'
110
+ version: '1.3'
133
111
  - !ruby/object:Gem::Dependency
134
- name: bundler
112
+ name: pry
135
113
  requirement: !ruby/object:Gem::Requirement
136
114
  requirements:
137
115
  - - "~>"
138
116
  - !ruby/object:Gem::Version
139
- version: '1.7'
117
+ version: '0.10'
140
118
  type: :development
141
119
  prerelease: false
142
120
  version_requirements: !ruby/object:Gem::Requirement
143
121
  requirements:
144
122
  - - "~>"
145
123
  - !ruby/object:Gem::Version
146
- version: '1.7'
124
+ version: '0.10'
147
125
  - !ruby/object:Gem::Dependency
148
126
  name: rake
149
127
  requirement: !ruby/object:Gem::Requirement
150
128
  requirements:
151
129
  - - "~>"
152
130
  - !ruby/object:Gem::Version
153
- version: '10.0'
131
+ version: '10.5'
154
132
  type: :development
155
133
  prerelease: false
156
134
  version_requirements: !ruby/object:Gem::Requirement
157
135
  requirements:
158
136
  - - "~>"
159
137
  - !ruby/object:Gem::Version
160
- version: '10.0'
138
+ version: '10.5'
161
139
  - !ruby/object:Gem::Dependency
162
- name: github-markup
140
+ name: redcarpet
163
141
  requirement: !ruby/object:Gem::Requirement
164
142
  requirements:
165
143
  - - "~>"
166
144
  - !ruby/object:Gem::Version
167
- version: '1.3'
145
+ version: '3.2'
168
146
  type: :development
169
147
  prerelease: false
170
148
  version_requirements: !ruby/object:Gem::Requirement
171
149
  requirements:
172
150
  - - "~>"
173
151
  - !ruby/object:Gem::Version
174
- version: '1.3'
152
+ version: '3.2'
175
153
  - !ruby/object:Gem::Dependency
176
- name: redcarpet
154
+ name: rubocop
177
155
  requirement: !ruby/object:Gem::Requirement
178
156
  requirements:
179
157
  - - "~>"
180
158
  - !ruby/object:Gem::Version
181
- version: '3.2'
159
+ version: 0.40.0
182
160
  type: :development
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
163
  requirements:
186
164
  - - "~>"
187
165
  - !ruby/object:Gem::Version
188
- version: '3.2'
166
+ version: 0.40.0
189
167
  - !ruby/object:Gem::Dependency
190
- name: yard
168
+ name: rspec
191
169
  requirement: !ruby/object:Gem::Requirement
192
170
  requirements:
193
171
  - - "~>"
194
172
  - !ruby/object:Gem::Version
195
- version: '0.8'
173
+ version: '3.4'
196
174
  type: :development
197
175
  prerelease: false
198
176
  version_requirements: !ruby/object:Gem::Requirement
199
177
  requirements:
200
178
  - - "~>"
201
179
  - !ruby/object:Gem::Version
202
- version: '0.8'
180
+ version: '3.4'
203
181
  - !ruby/object:Gem::Dependency
204
- name: pry
182
+ name: yard
205
183
  requirement: !ruby/object:Gem::Requirement
206
184
  requirements:
207
185
  - - "~>"
208
186
  - !ruby/object:Gem::Version
209
- version: '0.10'
187
+ version: '0.8'
210
188
  type: :development
211
189
  prerelease: false
212
190
  version_requirements: !ruby/object:Gem::Requirement
213
191
  requirements:
214
192
  - - "~>"
215
193
  - !ruby/object:Gem::Version
216
- version: '0.10'
194
+ version: '0.8'
217
195
  description: |-
218
196
  This plugin provides native Jenkins instrumentation
219
197
  for monitoring and metrics collection, including:
220
198
  health, job status, metrics via `JQS`, and others
221
199
  email: "<sensu-users@googlegroups.com>"
222
200
  executables:
223
- - metrics-jenkins.rb
224
- - metrics-jenkins-jqs.rb
225
- - check-jenkins.rb
226
- - check-jenkins-job-status.rb
227
- - check-jenkins-health.rb
228
201
  - check-jenkins-build-time.rb
202
+ - check-jenkins-health.rb
203
+ - check-jenkins-job-status.rb
204
+ - check-jenkins.rb
205
+ - metrics-jenkins-jqs.rb
206
+ - metrics-jenkins.rb
229
207
  extensions: []
230
208
  extra_rdoc_files: []
231
209
  files:
@@ -258,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
258
236
  requirements:
259
237
  - - ">="
260
238
  - !ruby/object:Gem::Version
261
- version: 1.9.3
239
+ version: 2.0.0
262
240
  required_rubygems_version: !ruby/object:Gem::Requirement
263
241
  requirements:
264
242
  - - ">="
@@ -266,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
244
  version: '0'
267
245
  requirements: []
268
246
  rubyforge_project:
269
- rubygems_version: 2.4.8
247
+ rubygems_version: 2.5.1
270
248
  signing_key:
271
249
  specification_version: 4
272
250
  summary: Sensu plugins for jenkins
checksums.yaml.gz.sig DELETED
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
@@ -1 +0,0 @@
1
- i�ܛ�*LJC�G=�f&1�#7L?ܨ�V6:g���%4�������#��R3��Bo�EJ��0������h�xG����F�RT�;�F^"��-�yKC�\v�8�@��X�=)$�>�I���[�/c]�Ty��