not sure what's wrong with auth token to link webhook, but everything else works
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good

This commit is contained in:
adam 2025-01-02 17:11:10 -05:00
parent 159a0027ff
commit f109faa5db

View File

@ -7,6 +7,7 @@ pipeline {
environment { environment {
JENKINSONGITEA=credentials('d0e86441-2157-405f-8539-a9a9010c6ecf') JENKINSONGITEA=credentials('d0e86441-2157-405f-8539-a9a9010c6ecf')
JENKINSONMATRIXTOKEN=credentials('17d18fd7-29eb-4957-9532-ce42aaa9b4ec') JENKINSONMATRIXTOKEN=credentials('17d18fd7-29eb-4957-9532-ce42aaa9b4ec')
GITEAONMATRIXTOKEN=credentials('10bc888a-cb19-456e-b793-f85ee465d58e')
} }
stages { stages {
@ -75,15 +76,43 @@ pipeline {
} }
echo "roomcreationevent:" echo "roomcreationevent:"
echo env.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()){ if(!env.room_id?.trim()){
error "couldn't make matrix room, apparently" 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"){ stage("link gitea webhook"){
steps{ steps{
error "this doesn't work, idk why"
sh """ sh """
curl -X 'GET' 'https://gitea.arg.rip/api/v1/repos/beefhavers/${videoname}/hooks' \ curl -X 'GET' 'https://gitea.arg.rip/api/v1/repos/beefhavers/${videoname}/hooks' \
-H 'accept: application/json' \ -H 'accept: application/json' \
@ -98,7 +127,7 @@ pipeline {
-H 'Content-Type: application/json' \ -H 'Content-Type: application/json' \
-d '{ -d '{
"active": true, "active": true,
"authorization_header": \$(cat reporesponse.json | jq .[0].authorization_header), "authorization_header": "Bearer ${env.GITEAONMATRIXTOKEN}",
"branch_filter": "*", "branch_filter": "*",
"config": { "config": {
"content_type": "json", "content_type": "json",