From abbff95371aef2a0efd0473748bb6719cc77a2bb Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 9 Jan 2025 17:28:34 -0500 Subject: [PATCH] progress but still doesn't link webhook --- scripts/beefhaving_video.groovy | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/scripts/beefhaving_video.groovy b/scripts/beefhaving_video.groovy index cc5004a..b7e71cd 100644 --- a/scripts/beefhaving_video.groovy +++ b/scripts/beefhaving_video.groovy @@ -112,29 +112,38 @@ pipeline { } stage("link gitea webhook"){ steps{ - error "this doesn't work, idk why" sh """ curl -X 'GET' 'https://gitea.arg.rip/api/v1/repos/beefhavers/${videoname}/hooks' \ -H 'accept: application/json' \ -H 'authorization: token ${env.JENKINSONGITEA}' \ >reporesponse.json + + cat reporesponse.json """ sh """ - curl -X 'PATCH' 'https://gitea.arg.rip/api/v1/repos/beefhavers/${videoname}/hooks' \ - -H 'accept: application/json' \ - -H 'authorization: token ${env.JENKINSONGITEA}' \ - -H 'Content-Type: application/json' \ - -d '{ + echo '{ "active": true, "authorization_header": "Bearer ${env.GITEAONMATRIXTOKEN}", "branch_filter": "*", "config": { - "content_type": "json", - "url": "https://greyn.club:8448/_matrix/client/r0/rooms/\$(echo ${env.room_id} | sed 's/!/%21/')/send/m.room.message" - }, - "events": \$(cat reporesponse.json | jq .[0].events) - }' + "content_type": "json",' >request.json + echo "\\"url\\": \\"https://greyn.club:8448/_matrix/client/r0/rooms/\$(echo ${env.room_id} | sed 's/!/%21/')/send/m.room.message\\"" >>request.json + echo "}," >>request.json + echo "\\"events\\": \$(cat reporesponse.json | jq .[0].events)" >>request.json + echo '}' >>request.json + + cat request.json + """ + sh """ + curl -X 'PATCH' "https://gitea.arg.rip/api/v1/repos/beefhavers/${videoname}/hooks/\$(cat reporesponse.json | jq .[0].id)" \ + -H 'accept: application/json' \ + -H 'authorization: token ${env.JENKINSONGITEA}' \ + -H 'Content-Type: application/json' \ + -d @request.json + + rm request.json + rm reporesponse.json """ } }