summaryrefslogtreecommitdiff
path: root/hackers.git
diff options
context:
space:
mode:
authorParabola git <git@parabola.nu>2019-12-25 17:00:02 +0000
committerParabola git <git@parabola.nu>2019-12-25 17:00:02 +0000
commit95e87b80837c75ecd3aafdb4c17e640b294843dd (patch)
treeaf7c27450adb31fe71f7e4975a30627926cc5071 /hackers.git
Update from cron
Diffstat (limited to 'hackers.git')
-rw-r--r--hackers.git/HEAD1
-rw-r--r--hackers.git/config4
-rw-r--r--hackers.git/description1
-rwxr-xr-xhackers.git/hooks/post-receive18
-rwxr-xr-xhackers.git/hooks/update31
5 files changed, 55 insertions, 0 deletions
diff --git a/hackers.git/HEAD b/hackers.git/HEAD
new file mode 100644
index 0000000..cb089cd
--- /dev/null
+++ b/hackers.git/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/hackers.git/config b/hackers.git/config
new file mode 100644
index 0000000..07d359d
--- /dev/null
+++ b/hackers.git/config
@@ -0,0 +1,4 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = true
diff --git a/hackers.git/description b/hackers.git/description
new file mode 100644
index 0000000..9a0a402
--- /dev/null
+++ b/hackers.git/description
@@ -0,0 +1 @@
+Parabola Hackers SSH pubkeys
diff --git a/hackers.git/hooks/post-receive b/hackers.git/hooks/post-receive
new file mode 100755
index 0000000..47f5d24
--- /dev/null
+++ b/hackers.git/hooks/post-receive
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+set -e
+
+# Update the system checkout of hackers.git
+echo '==> Updating system checkout...'
+(
+ unset GIT_DIR
+ cd /var/lib/hackers-git
+ git pull
+)
+
+# tell nshd/postfix
+echo '==> Running /etc/parabola-hackers/hooks/'
+sudo run-parts --arg=/var/lib/hackers-git -- /etc/parabola-hackers/hooks
+
+# tell autobuilder
+echo '==> Updating libre/parabola-keyring ...'
+~autobuilder/.local/bin/autobuild libre/parabola-keyring
diff --git a/hackers.git/hooks/update b/hackers.git/hooks/update
new file mode 100755
index 0000000..ea1b054
--- /dev/null
+++ b/hackers.git/hooks/update
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+{
+ set -euE
+
+ [[ $# = 3 ]]
+ ref=$1
+ old=$2
+ new=$3
+
+ if [[ $ref != refs/heads/master ]]; then
+ exit 0
+ fi
+
+ unset GIT_DIR
+ dir=$(mktemp --tmpdir -d hackers-ci.XXXXXXXXXX)
+ trap "rm -rf -- $(printf %q "$dir")" EXIT
+ if ! { git clone -q ~git/hackers.git "$dir" && cd "$dir" && git checkout -q "$new"; }; then
+ echo '==> ERROR: Could not create temporary checkout'
+ exit 1
+ fi
+ echo -n '==> Running checks on YAML files pushed to master...'
+ if ! PARABOLA_HACKERS_YAMLDIR="$dir/users" /lib/parabola-hackers/meta-check &> check.log; then
+ echo ' [fail]'
+ cat check.log
+ echo '==> ERROR: You are attempting to push invalid YAML files to master.'
+ echo ' Please run `meta-check` before trying to push to master.'
+ exit 1
+ fi
+ echo ' [pass]'
+ exit 0
+}