From 0138a6e12d6a7a93ebb29f47964873b0a01f2d10 Mon Sep 17 00:00:00 2001 From: deepend Date: Tue, 2 Jan 2024 20:55:37 +0000 Subject: [PATCH] Update githook.php --- githook.php | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/githook.php b/githook.php index 4f2cf83..de7affc 100644 --- a/githook.php +++ b/githook.php @@ -16,8 +16,6 @@ /* security */ $access_token = "secret"; -$ansible_lastrun = '/dev/shm/ansible-hook-last-run'; -$ansible_dropfile = '/dev/shm/run-ansible'; $www_lastrun = '/dev/shm/www-hook-last-run'; $www_dropfile = '/dev/shm/run-www'; $gopher_lastrun = '/dev/shm/gopher-hook-last-run'; @@ -51,24 +49,6 @@ if ( strcmp($remoteip, $allowedip) !== 0 ) exit(0); } -// Hook for ansible here -if ($data["repository"]["full_name"] == 'thunix/ansible') { - syslog(LOG_INFO, 'Ansible Webhook recieved.'); - // We limit runs to once per 5 minutes, so they don't try - // overlapping. Systemd shouldn't allow it, but we'll check - // anyways - if ( time () - filemtime ( $ansible_lastrun ) > $ratelimit ) { - touch ( $ansible_dropfile ); - touch ( $ansible_lastrun ); - echo "HTTP 200 - Ansible webhook recieved.\n"; - } - else { - http_response_code(429); - echo "HTTP 429 - Rate Limited.\n"; - exit(0); - } -} - // Hook for www repo here. Same rules apply, as above, for www. We // could probably make it able to run more frequently. Backend job is // just a git pull, and is quick.