lita-docker-hub 0.1.7 → 0.1.8
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 +8 -8
- data/lib/lita/handlers/docker_hub.rb +21 -13
- data/lib/lita/handlers/version.rb +1 -1
- data/templates/build.slack.erb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2E0MjE5NGIwMTNlZGI5ZGQwZmMyYWYxYzM5MWFlNmNhNzMwODhmNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZThkNDA3OWYzMmFhNDA2MWJmOTUwNTlhMzQxZjQ5OTlhZDI1Y2E2Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzBmMjIyNzI1NmNhN2Y1MDdmODkwNDRiMTZhYzc1NDBmZGJhZjVhYjk0NDhm
|
10
|
+
MmNjOGExY2UwODc1NDc4N2ZkZjM1M2M1MzkyYzRhMDFiNmEwMzMwNDdhMTFh
|
11
|
+
OTY0ZjRmNTY5MzZhODRiZjExZGMxY2I2M2YzOGU5OGIwNWY0NTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWQwNjkxNTM5MzA0NWJiYWYwMjJkNTY1YjcyN2Q0MWUyZGM0ZjlmZjg3ZWU5
|
14
|
+
ZjNhMzYxMDQ1MDNlZWI1YTM0ODhkMGM0ZmE4NDhhZGU5ODg3MWU2MmU1Nzky
|
15
|
+
Y2M1ZjAzMjU2ZDI0M2EwMzhlZjE2MTM0NzlkZjhkMDQ0YzI0MWE=
|
@@ -6,27 +6,35 @@ module Lita
|
|
6
6
|
http.post "/docker-hub/receive", :receive
|
7
7
|
|
8
8
|
def receive(request, response)
|
9
|
-
|
10
|
-
body = parse(request.body.read)
|
9
|
+
response.headers["Content-Type"] = "application/json"
|
11
10
|
|
11
|
+
body = parse(request.body.read)
|
12
12
|
repo_name = body.fetch("repository", {}).fetch("repo_name", nil)
|
13
13
|
repo_url = body.fetch("repository", {}).fetch("repo_url", nil)
|
14
|
-
tag = body.fetch("push_data", {}).fetch("tag", nil)
|
15
|
-
|
16
|
-
pushed_at = body.fetch("push_data", {}).fetch("pushed_at", Time.now)
|
17
|
-
build_time = time_interval(Time.at(pushed_at), Time.now)
|
14
|
+
tag = body.fetch("push_data", {}).fetch("tag", nil)
|
15
|
+
pushed_at = body.fetch("push_data", {}).fetch("pushed_at", nil)
|
18
16
|
|
19
|
-
|
17
|
+
if repo_name.present? && repo_url.present? && tag.present? && pushed_at.present?
|
18
|
+
build_time = time_interval(Time.at(pushed_at), Time.now)
|
20
19
|
|
21
|
-
|
22
|
-
|
20
|
+
target = Lita::Source.new(room: '#general') #Source.new(room: find_room_id_by_name(config.room))
|
21
|
+
message = render_template("build", repo_name: repo_name,
|
22
|
+
repo_url: repo_url,
|
23
|
+
tag: tag,
|
24
|
+
build_time: build_time)
|
25
|
+
Lita.logger.debug target.id + " " + target.name
|
26
|
+
Lita.logger.debug message
|
23
27
|
|
24
|
-
|
28
|
+
robot.send_message(target, message)
|
25
29
|
|
26
|
-
|
27
|
-
|
30
|
+
response.write("ok")
|
31
|
+
else
|
32
|
+
response.write("error")
|
33
|
+
end
|
28
34
|
rescue => error
|
29
35
|
Lita.logger.error error.message
|
36
|
+
|
37
|
+
response.write("error")
|
30
38
|
end
|
31
39
|
|
32
40
|
Lita.register_handler(self)
|
@@ -40,7 +48,7 @@ module Lita
|
|
40
48
|
def time_interval(start_time, end_time)
|
41
49
|
interval = (end_time - start_time).round
|
42
50
|
min, sec = interval.divmod(60)
|
43
|
-
"
|
51
|
+
"#{min} min and #{sec} sec"
|
44
52
|
end
|
45
53
|
|
46
54
|
def find_room_id_by_name(room_name)
|
data/templates/build.slack.erb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Docker Hub build of
|
1
|
+
*Docker Hub* build of <<%= repo_url %>|<%= repo_name %>@<%= tag %>> passed in <%= build_time %>
|