diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2015-10-02 10:25:16 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-10-02 10:26:04 +0200 |
commit | 8af1bb617f41a9599108b52a123d1e3abadd3578 (patch) | |
tree | 4751dd680b31e40479629842db79ef73fcda015d /main/aports-build | |
parent | 01ff2802a0458fd612f6f8b2b9f5318f77a58c35 (diff) | |
download | aports-8af1bb617f41a9599108b52a123d1e3abadd3578.tar.bz2 aports-8af1bb617f41a9599108b52a123d1e3abadd3578.tar.xz |
main/aports-build: report build errors to mqtt via hook
Diffstat (limited to 'main/aports-build')
-rw-r--r-- | main/aports-build/APKBUILD | 20 | ||||
-rw-r--r-- | main/aports-build/report-build-errors.lua | 29 |
2 files changed, 43 insertions, 6 deletions
diff --git a/main/aports-build/APKBUILD b/main/aports-build/APKBUILD index d138bc1a92..03a54af657 100644 --- a/main/aports-build/APKBUILD +++ b/main/aports-build/APKBUILD @@ -1,12 +1,13 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=aports-build -pkgver=0.9 -pkgrel=6 +pkgver=1.0 +pkgrel=0 pkgdesc="MQTT based build-on-git-push scripts for Alpine Linux" url="http://alpinelinux.org" arch="noarch" license="GPL2" -depends="abuild>2.20.0 mosquitto-clients alpine-sdk mqtt-exec rsync lua-aports" +depends="abuild>2.20.0 mosquitto-clients alpine-sdk mqtt-exec rsync lua-aports + lua5.2-cjson" depends_dev="" makedepends="$depends_dev mosquitto-dev" install="$pkgname.pre-install" @@ -15,6 +16,7 @@ subpackages="" source="aports-build aports-build.initd mqtt-exec.aports-build.confd + report-build-errors.lua " _builddir= @@ -42,14 +44,20 @@ package() { install -Dm644 "$srcdir"/mqtt-exec.aports-build.confd \ "$pkgdir"/etc/conf.d/mqtt-exec.aports-build || return 1 + install -Dm644 "$srcdir"/report-build-errors.lua \ + "$pkgdir"/etc/buildrepo/plugins.d/report-build-errors.lua \ + || return 1 } md5sums="97aa48d5026684e77c4529c7622370a6 aports-build cb4807ea64c4368487786217db087bac aports-build.initd -c02d90b2bb0c48e416b707caa8766c50 mqtt-exec.aports-build.confd" +c02d90b2bb0c48e416b707caa8766c50 mqtt-exec.aports-build.confd +48c17c44513c6ed46041358101e7ac22 report-build-errors.lua" sha256sums="414adee6f0a5c83c8b37d995fee36a7a8787eaab7bdc986fd512977f3412e16c aports-build 3e2d551f72273f37290db342a153abd377397483677a684645d22df7b8a8592f aports-build.initd -7d2001688c3776ffb53c422dee424bcf0346ae20f3df5c6c2f4944022b19cb4d mqtt-exec.aports-build.confd" +7d2001688c3776ffb53c422dee424bcf0346ae20f3df5c6c2f4944022b19cb4d mqtt-exec.aports-build.confd +cf991d176fc555dc909c1cd0d3e817d5b567016c4a8a304860c37eeebe83b6ff report-build-errors.lua" sha512sums="5f30f736e31e04c7718ad5e44c02d8abf47c31baabd38c98bef8fe1e02444ceb49375151707e255c72a28e370c4e67d7a11f14555689b20a5a4e736cbe9c4fb4 aports-build 821035bda47152c341ec94bf960fa67e3377051826712ceb74f39103e6e422777b6e082231bfb87865653d2b93b7d3154cfc24abf65a52e3e66da69412dd7e41 aports-build.initd -93d26e2055dbb02e863bf76b64a549c100decec3fda612ce96ca1464e6d61befa9f57f202553a25cf323e67e266f532d19c7423ff070943a59b3973946d949fe mqtt-exec.aports-build.confd" +93d26e2055dbb02e863bf76b64a549c100decec3fda612ce96ca1464e6d61befa9f57f202553a25cf323e67e266f532d19c7423ff070943a59b3973946d949fe mqtt-exec.aports-build.confd +307bca323fd72433ba6200d61adab8fb0374833d68135a38c61b104a72f86761df7445cc3758a80c1786ebf154d946cd3982db0c442604b08161bfbe5b1c5448 report-build-errors.lua" diff --git a/main/aports-build/report-build-errors.lua b/main/aports-build/report-build-errors.lua new file mode 100644 index 0000000000..ee26b00979 --- /dev/null +++ b/main/aports-build/report-build-errors.lua @@ -0,0 +1,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 + |