From f109faa5dbb71659db53ee79601c7bd213376c86 Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 2 Jan 2025 17:11:10 -0500 Subject: [PATCH] not sure what's wrong with auth token to link webhook, but everything else works --- scripts/beefhaving_video.groovy | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/scripts/beefhaving_video.groovy b/scripts/beefhaving_video.groovy index d22dbf9..cc5004a 100644 --- a/scripts/beefhaving_video.groovy +++ b/scripts/beefhaving_video.groovy @@ -7,6 +7,7 @@ pipeline { environment { JENKINSONGITEA=credentials('d0e86441-2157-405f-8539-a9a9010c6ecf') JENKINSONMATRIXTOKEN=credentials('17d18fd7-29eb-4957-9532-ce42aaa9b4ec') + GITEAONMATRIXTOKEN=credentials('10bc888a-cb19-456e-b793-f85ee465d58e') } stages { @@ -75,15 +76,43 @@ pipeline { } echo "roomcreationevent:" echo env.roomcreationevent - env.room_id = sh(returnStdout: true, script: "${env.roomcreationevent} | jq .room_id").trim() + def jsonObj = readJSON text: env.roomcreationevent + env.room_id =jsonObj.room_id if(!env.room_id?.trim()){ error "couldn't make matrix room, apparently" } + + env.spaceaddevent=sh(returnStdout: true, script: """ + curl -X 'PUT' 'https://greyn.club:8448/_matrix/client/r0/rooms/!xLgVvcqtVzquTkCQGx:greyn.club/state/m.space.child/${env.room_id}' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer ${JENKINSONMATRIXTOKEN}' \ + -H 'Content-Type: application/json' \ + -d '{ + "via": ["greyn.club"] + }' + """).trim() + echo "spaceaddevent:" + echo env.spaceaddevent + + env.elevatePrivsEvent=sh(returnStdout: true, script: """ + curl -X 'PUT' 'https://greyn.club:8448/_matrix/client/v3/rooms/${env.room_id}/state/m.room.power_levels' \ + -H 'accept: application/json' \ + -H 'Authorization: Bearer ${JENKINSONMATRIXTOKEN}' \ + -H 'Content-Type: application/json' \ + -d '{ + "users": { + "@adam:greyn.club": 100 + } + }' + """).trim() + echo "elevatePrivsEvent:" + echo env.elevatePrivsEvent } } } 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' \ @@ -98,7 +127,7 @@ pipeline { -H 'Content-Type: application/json' \ -d '{ "active": true, - "authorization_header": \$(cat reporesponse.json | jq .[0].authorization_header), + "authorization_header": "Bearer ${env.GITEAONMATRIXTOKEN}", "branch_filter": "*", "config": { "content_type": "json",