janky 0.10.0 → 0.10.2

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
  SHA1:
3
- metadata.gz: 94b8fea3bd0280aeca3225b03fdbb053cafff29c
4
- data.tar.gz: dc463e3a7336dee276c255b4acf3af7ab1e9eb0e
3
+ metadata.gz: 9d531dd95f17c83f106364fc9bb3b56a83e7c84f
4
+ data.tar.gz: ea8e851492074c805a207ec0938a0eff692e9e7e
5
5
  SHA512:
6
- metadata.gz: b620403a1997196d491bcf52d110aacf372a088dba2df09d257e73aef7174083a9dc24273a468b670d7c07b20123aba863200e87b1f8b4dad893f6a6afb48935
7
- data.tar.gz: 1221e4ff33cbb85ee619bfc22a573542589f9309dbc2262e10b39b736f6857c431f5129532f6dd78cbe5ccad31bd1a7a65b555cb540ad7fcb67d8605409b5e4b
6
+ metadata.gz: 1c10a412e74e88045013e915ad1859a481e949a01da50c207d26302fe2651d9d1e748cf9bb81399a0296adde8befcb4e53b062b5f7a5445a00bd52ade2afa60f
7
+ data.tar.gz: c8ea975e0f9b6527c80b2b91b796b9ca72d4cc3ee82a7503c302839c6476cb9ee43fb688494a23d453b2f5071574e85a7e73d7f59adc1ba29f63a85f81bd87d4
data/CHANGES CHANGED
@@ -1,3 +1,15 @@
1
+ = 0.10.2 / 2013-10-02
2
+
3
+ * Revert AR deprecation warnings
4
+ * Revert previous configure jobs throwing error change
5
+
6
+ = 0.10.1 / 2013-09-20
7
+
8
+ * Refresh landing page every 5 seconds for updates
9
+ * Previously configured jobs reconfigure instead of throwing errors
10
+ * Add an API endpoint to get a json response full of build statuses
11
+ * Fixup stupid AR deprecation warnings
12
+
1
13
  = 0.10.0 / 2013-09-19
2
14
 
3
15
  * Upgrade sinatra_auth_github to work with latest octokit
data/README.md CHANGED
@@ -79,6 +79,9 @@ Janky requires access to a Jenkins server. Version **1.427** is
79
79
  recommended. Refer to the Jenkins [documentation][doc] for installation
80
80
  instructions and install the [Notification Plugin][np] version 1.4.
81
81
 
82
+ Remember to set the Jenkins URL in `http://your-jenkins-server.com/configure`.
83
+ Janky will still trigger builds but will not update the build status without this set.
84
+
82
85
  [doc]: https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins
83
86
  [np]: https://wiki.jenkins-ci.org/display/JENKINS/Notification+Plugin
84
87
 
@@ -134,6 +137,7 @@ Required settings:
134
137
  * `JANKY_BUILDER_DEFAULT`: The Jenkins server URL **with** a trailing slash.
135
138
  Example: `http://jenkins.example.com/`. For basic auth, include the
136
139
  credentials in the URL: `http://user:pass@jenkins.example.com/`.
140
+ Using GitHub OAuth with Jenkins is not supported by Janky.
137
141
  * `JANKY_CONFIG_DIR`: Directory where build config templates are stored.
138
142
  Typically set to `/app/config` on Heroku.
139
143
  * `JANKY_HUBOT_USER`: Login used to protect the Hubot API.
@@ -174,6 +178,10 @@ via the GitHub API:
174
178
 
175
179
  then set `JANKY_GITHUB_STATUS_TOKEN`.
176
180
 
181
+ `username` and `password` in the above example should be the same as the
182
+ values provided for `JANKY_GITHUB_USER` and `JANKY_GITHUB_PASSWORD`
183
+ respectively.
184
+
177
185
  ### Chat notifications
178
186
 
179
187
  #### Campfire
@@ -11,6 +11,10 @@ module Janky
11
11
  select(columns)
12
12
  end
13
13
 
14
+ scope :building, -> {
15
+ where("started_at IS NOT NULL AND completed_at IS NULL")
16
+ }
17
+
14
18
  # Transition the Build to the started state.
15
19
  #
16
20
  # id - the Fixnum ID used to find the build.
@@ -80,6 +80,26 @@ module Janky
80
80
  repos.join("\n")
81
81
  end
82
82
 
83
+ # Get the lasts builds
84
+ get "/builds" do
85
+ limit = params["limit"]
86
+ building = params["building"]
87
+
88
+ builds = Build.unscoped
89
+ if building.blank? || building == 'false'
90
+ builds = builds.completed
91
+ else
92
+ builds = builds.building
93
+ end
94
+ builds = builds.limit(limit) unless limit.blank?
95
+
96
+ builds.map! do |build|
97
+ build_to_hash(build)
98
+ end
99
+
100
+ builds.to_json
101
+ end
102
+
83
103
  # Get the status of a repository's branch.
84
104
  get %r{\/([-_\.0-9a-zA-Z]+)\/([-_\+\.a-zA-z0-9\/]+)} do |repo_name, branch_name|
85
105
  limit = params["limit"]
@@ -87,18 +107,7 @@ module Janky
87
107
  repo = find_repo(repo_name)
88
108
  branch = repo.branch_for(branch_name)
89
109
  builds = branch.queued_builds.limit(limit).map do |build|
90
- { :sha1 => build.sha1,
91
- :repo => build.repo_name,
92
- :branch => build.branch_name,
93
- :user => build.user,
94
- :green => build.green?,
95
- :building => build.building?,
96
- :queued => build.queued?,
97
- :pending => build.pending?,
98
- :number => build.number,
99
- :status => (build.green? ? "was successful" : "failed"),
100
- :compare => build.compare,
101
- :duration => build.duration }
110
+ build_to_hash(build)
102
111
  end
103
112
 
104
113
  builds.to_json
@@ -117,11 +126,30 @@ ci set room janky development
117
126
  ci status
118
127
  ci status janky
119
128
  ci status janky/master
129
+ ci builds limit [building]
120
130
  EOS
121
131
  end
122
132
 
123
133
  get "/boomtown" do
124
134
  fail "BOOM (janky)"
125
135
  end
136
+
137
+ private
138
+
139
+ def build_to_hash(build)
140
+ { :sha1 => build.sha1,
141
+ :repo => build.repo_name,
142
+ :branch => build.branch_name,
143
+ :user => build.user,
144
+ :green => build.green?,
145
+ :building => build.building?,
146
+ :queued => build.queued?,
147
+ :pending => build.pending?,
148
+ :number => build.number,
149
+ :status => (build.green? ? "was successful" : "failed"),
150
+ :compare => build.compare,
151
+ :duration => build.duration,
152
+ :web_url => build.web_url }
153
+ end
126
154
  end
127
155
  end
@@ -1,3 +1,10 @@
1
1
  $(function(){
2
+ function refresh() {
3
+ $('.builds').load(location.pathname + ' .builds', function() {
4
+ $('.relatize').relatize()
5
+ })
6
+ }
7
+
8
+ setInterval(refresh, 5000)
2
9
  $('.relatize').relatize()
3
- })
10
+ })
@@ -1,3 +1,3 @@
1
1
  module Janky
2
- VERSION = "0.10.0"
2
+ VERSION = "0.10.2"
3
3
  end
@@ -262,6 +262,30 @@ class JankyTest < Test::Unit::TestCase
262
262
  assert_equal 2, payload.size
263
263
  end
264
264
 
265
+ test "hubot last 1 builds" do
266
+ 3.times do
267
+ gh_post_receive("github", "master")
268
+ Janky::Builder.start!
269
+ Janky::Builder.complete!
270
+ end
271
+
272
+ assert_equal 1, Yajl.load(hubot_last(limit: 1).body).size
273
+ end
274
+
275
+ test "hubot lasts completed" do
276
+ gh_post_receive("github", "master")
277
+ Janky::Builder.start!
278
+ Janky::Builder.complete!
279
+
280
+ assert_equal 1, Yajl.load(hubot_last.body).size
281
+ end
282
+
283
+ test "hubot lasts building" do
284
+ gh_post_receive("github", "master")
285
+ Janky::Builder.start!
286
+ assert_equal 1, Yajl.load(hubot_last(building: true).body).size
287
+ end
288
+
265
289
  test "hubot build" do
266
290
  gh_post_receive("github", "master")
267
291
  Janky::Builder.start!
@@ -110,6 +110,11 @@ class Test::Unit::TestCase
110
110
  end
111
111
  end
112
112
 
113
+ def hubot_last(options = {})
114
+ hubot_request "GET",
115
+ "/_hubot/builds?limit=#{options[:limit]}&building=#{options[:building]}"
116
+ end
117
+
113
118
  def hubot_latest_build_sha(repo, branch)
114
119
  response = hubot_status(repo, branch)
115
120
  Yajl.load(response.body).first["sha1"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: janky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Rozet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-20 00:00:00.000000000 Z
11
+ date: 2013-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -306,3 +306,4 @@ test_files:
306
306
  - test/default.xml.erb
307
307
  - test/janky_test.rb
308
308
  - test/test_helper.rb
309
+ has_rdoc: false