Skip to content

Commit

Permalink
issue #5 Добавил вывод ошибки
Browse files Browse the repository at this point in the history
  • Loading branch information
irvis committed Oct 3, 2016
1 parent ff0a0c5 commit 0d1b933
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include vars.mk

IMAGE = kubikvest/xodos
CONTAINER = kubikvest_webhook
TAG = 1.0.1
TAG = 1.0.2
PORT = -p 8301:80
DOCKER_RM = false

Expand Down
Binary file modified build/rootfs.tar.gz
Binary file not shown.
14 changes: 11 additions & 3 deletions src/app/webhook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,28 @@ ngx.status = ngx.HTTP_OK
ngx.say("200 HTTP_OK")
ngx.eof()

os.execute("cd /tmp; git clone " .. data.repository.clone_url .. "; cd /tmp/" .. data.repository.name .. "; make deploy -I ../; cd /;rm -rf /tmp/" .. data.repository.name)
local color = "#a63636"
local msg = "fail"

local result = os.execute("cd /tmp; git clone " .. data.repository.clone_url .. "; cd /tmp/" .. data.repository.name .. "; make deploy -I ../; cd /;rm -rf /tmp/" .. data.repository.name)

if result == 0 then
color = "#36a64f"
msg = "success"
end

local jsonErrorParse, data = pcall(json.encode,{
username = "Xodos",
icon_emoji = ":xodos:",
attachments = {
{
color = "#36a64f",
color = color,
author_name = data.pull_request.user.login,
title = "Показать правки",
title_link = data.pull_request.html_url,
text = data.pull_request.title,
fields = {
{ title = "Deployment success" },
{ title = "Deployment " .. msg },
}
},
},
Expand Down

0 comments on commit 0d1b933

Please sign in to comment.