Skip to content

Commit

Permalink
Add IRC notifications for failed builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Jul 3, 2022
1 parent 0faac73 commit da6a8e0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- checkout
- restore_cache:
key: leiningen-{{ checksum "project.clj" }}
- run: apt update -qq && apt install -y gnupg
- run: apt update -qq && apt install -y gnupg netcat-openbsd
- run:
name: Bootstrap leiningen-core
working_directory: ~/leiningen/leiningen-core
Expand All @@ -34,7 +34,7 @@ jobs:
- run:
name: Test lein-pprint
working_directory: lein-pprint
command: lein test
command: lein test || bin/notify
- save_cache:
paths:
- $HOME/.m2
Expand Down
4 changes: 2 additions & 2 deletions .woodpecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ pipeline:
build:
image: debian:stable-slim
commands:
- apt-get update -qq && apt-get install -y gnupg leiningen
- apt-get update -qq && apt-get install -y gnupg leiningen netcat-openbsd
- cd leiningen-core && lein bootstrap
- cd .. && bin/lein test
- cd .. && bin/lein test || bin/notify
18 changes: 18 additions & 0 deletions bin/notify
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

set -e

IRC_HOST_PORT=${IRC_HOST_PORT:-"irc.libera.chat 6667"}
IRC_CHANNEL=${IRC_CHANNEL:-"#leiningen"}

echo "Announcing failure on $IRC_HOST_PORT $IRC_CHANNEL"

LOG=$(git log --oneline -n 1 HEAD | head -n 1)

echo "NICK leiningen-build
USER leiningen-build 8 x : leiningen-build
JOIN $IRC_CHANNEL
PRIVMSG $IRC_CHANNEL :Build failure! $LOG
QUIT" | nc $IRC_HOST_PORT

exit 1 # don't mask the failure!

0 comments on commit da6a8e0

Please sign in to comment.