aboutsummaryrefslogtreecommitdiffstats
path: root/main/aports-build/report-build-errors.lua
blob: ee26b0097918bf29821bd3e3d92a3f0bf8cf134a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
local publish = require("mqtt.publish")
local json = require("cjson")

local hostname
local f = io.open("/proc/sys/kernel/hostname")
hostname = f:read()
f:close()

local urlprefix=("http://build.alpinelinux.org/buildlogs/%s"):format(hostname)

local m = {}

function m.postbuild(aport, success, repodest, arch, logfile)
	if not success then
		local topic = ("build/%s/errors"):format(hostname)
		local payload =	json.encode{
			pkgname = aport.pkgname,
			logurl = ("%s/%s/%s-%s-r%s.log"):format(
					urlprefix,
					(string.match(aport.dir,"[^/]+/[^/]+$")),
					aport.pkgname, aport.pkgver, aport.pkgrel),
			status = success
		}
		publish.single(topic, payload, nil, nil, "msg.alpinelinux.org")
	end
end

return m