theoretically works, BUT:
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good
how do I add a room *to a space*? how do I give control of a room to someone else?
This commit is contained in:
parent
ca3d31de38
commit
159a0027ff
@ -5,8 +5,8 @@ pipeline {
|
|||||||
string(name: 'videodesc', description: "video description")
|
string(name: 'videodesc', description: "video description")
|
||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
GITEATOKEN = credentials('d0e86441-2157-405f-8539-a9a9010c6ecf')
|
JENKINSONGITEA=credentials('d0e86441-2157-405f-8539-a9a9010c6ecf')
|
||||||
JENKINSMATRIX=credentials('040b63d1-2f14-4692-badb-114bddd7c5a5')
|
JENKINSONMATRIXTOKEN=credentials('17d18fd7-29eb-4957-9532-ce42aaa9b4ec')
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
@ -24,11 +24,12 @@ pipeline {
|
|||||||
}
|
}
|
||||||
stage("create gitea project"){
|
stage("create gitea project"){
|
||||||
steps{
|
steps{
|
||||||
sh """
|
script{
|
||||||
|
env.giteaCreateEvent=sh(returnStdout: true, script: """
|
||||||
curl -X 'POST' \
|
curl -X 'POST' \
|
||||||
'https://gitea.arg.rip/api/v1/repos/beefhavers/_videotemplate/generate' \
|
'https://gitea.arg.rip/api/v1/repos/beefhavers/_videotemplate/generate' \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H 'Authorization: token ${env.GITEATOKEN}' \
|
-H 'Authorization: token ${env.JENKINSONGITEA}' \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{
|
-d '{
|
||||||
"description": "${videodesc}",
|
"description": "${videodesc}",
|
||||||
@ -42,16 +43,21 @@ pipeline {
|
|||||||
"topics": true,
|
"topics": true,
|
||||||
"webhooks": true
|
"webhooks": true
|
||||||
}'
|
}'
|
||||||
"""
|
""").trim()
|
||||||
|
if (!env.giteaCreateEvent?.trim()) {
|
||||||
|
error "couldn't make gitea repo, apparently"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage("create matrix room"){
|
stage("create matrix room"){
|
||||||
steps{
|
steps{
|
||||||
env.roomId=sh(returnStdout: true, script: """
|
script{
|
||||||
|
env.roomcreationevent=sh(returnStdout: true, script: """
|
||||||
curl -X 'POST' \
|
curl -X 'POST' \
|
||||||
'https://greyn.club:8448/_matrix/client/v3/createRoom' \
|
'https://greyn.club:8448/_matrix/client/v3/createRoom' \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H 'Authorization: Bearer ${JENKINSMATRIX}}' \
|
-H 'Authorization: Bearer ${JENKINSONMATRIXTOKEN}' \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{
|
-d '{
|
||||||
"creation_content": {
|
"creation_content": {
|
||||||
@ -61,9 +67,19 @@ pipeline {
|
|||||||
"preset": "public_chat",
|
"preset": "public_chat",
|
||||||
"invite": ["@adam:greyn.club", "@gitea:greyn.club"],
|
"invite": ["@adam:greyn.club", "@gitea:greyn.club"],
|
||||||
"topic": "[link to gitea project]"
|
"topic": "[link to gitea project]"
|
||||||
}' | jq .room_id
|
}'
|
||||||
"""
|
"""
|
||||||
).trim()
|
).trim()
|
||||||
|
if (!env.roomcreationevent?.trim()) {
|
||||||
|
error "couldn't make matrix room, apparently"
|
||||||
|
}
|
||||||
|
echo "roomcreationevent:"
|
||||||
|
echo env.roomcreationevent
|
||||||
|
env.room_id = sh(returnStdout: true, script: "${env.roomcreationevent} | jq .room_id").trim()
|
||||||
|
if(!env.room_id?.trim()){
|
||||||
|
error "couldn't make matrix room, apparently"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage("link gitea webhook"){
|
stage("link gitea webhook"){
|
||||||
@ -71,14 +87,14 @@ pipeline {
|
|||||||
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' \
|
||||||
-H 'authorization: token ${env.GITEATOKEN}' \
|
-H 'authorization: token ${env.JENKINSONGITEA}' \
|
||||||
>reporesponse.json
|
>reporesponse.json
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sh """
|
sh """
|
||||||
curl -X 'PATCH' 'https://gitea.arg.rip/api/v1/repos/beefhavers/${videoname}/hooks' \
|
curl -X 'PATCH' 'https://gitea.arg.rip/api/v1/repos/beefhavers/${videoname}/hooks' \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H 'authorization: token ${env.GITEATOKEN}' \
|
-H 'authorization: token ${env.JENKINSONGITEA}' \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{
|
-d '{
|
||||||
"active": true,
|
"active": true,
|
||||||
@ -86,7 +102,7 @@ pipeline {
|
|||||||
"branch_filter": "*",
|
"branch_filter": "*",
|
||||||
"config": {
|
"config": {
|
||||||
"content_type": "json",
|
"content_type": "json",
|
||||||
"url": "https://greyn.club:8448/_matrix/client/r0/rooms/\$(echo ${env.roomId} | sed 's/!/%21/')/send/m.room.message"
|
"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)
|
"events": \$(cat reporesponse.json | jq .[0].events)
|
||||||
}'
|
}'
|
||||||
|
Loading…
Reference in New Issue
Block a user