diff --git a/scripts/beefhaving_video.groovy b/scripts/beefhaving_video.groovy index 8572b3f..c55076e 100644 --- a/scripts/beefhaving_video.groovy +++ b/scripts/beefhaving_video.groovy @@ -111,6 +111,30 @@ pipeline { } } } + stage("tweak Jenkinsfile"){ + steps{ + withCredentials([sshUserPrivateKey(credentialsId: 'f42347e9-e3b5-44af-a1af-c5e7b9775fee', keyFileVariable: 'PK')]) { + sh """#!/bin/bash + #mkdir -p ~/.ssh + ssh-keyscan -t ed25519 gitea.arg.rip >> ~/.ssh/known_hosts + #cat ~/.ssh/known_hosts + #shit doesn't work. ssh in, git clone, get your shit set up for keys. + git -c core.sshCommand="ssh -i '$PK'\" clone ssh://git@gitea.arg.rip:8022/beefhavers/${videoname}.git + """ + script { + sh """#!/bin/bash + pushd ${videoname} + + sed -i 's/MATRIX_ROOMID="todo"/MATRIX_ROOMID="${env.room_id}"/' Jenkinsfile + + git add . + git commit -m "matrix room configured in jenkinsfile" + git -c core.sshCommand="ssh -i '${PK}'\" push + """ + } + } + } + } stage("link gitea webhook"){ steps{ sh """ @@ -139,8 +163,17 @@ pipeline { cat request.json """ + + //delete old + sh """ + curl -X 'DELETE' "https://gitea.arg.rip/api/v1/repos/beefhavers/${videoname}/hooks/\$(cat matrixhook.json | jq .[0].id)" \ + -H 'accept: application/json' \ + -H 'authorization: token ${env.JENKINSONGITEA}' \ + """ + + //make a new one sh """ - curl -X 'PATCH' "https://gitea.arg.rip/api/v1/repos/beefhavers/${videoname}/hooks/\$(cat matrixhook.json | jq .[0].id)" \ + curl -X 'POST' "https://gitea.arg.rip/api/v1/repos/beefhavers/${videoname}/hooks" \ -H 'accept: application/json' \ -H 'authorization: token ${env.JENKINSONGITEA}' \ -H 'Content-Type: application/json' \