generates gitea project from template :)
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
jq is suffering shell-quoting issues.
This commit is contained in:
parent
7130f70aaf
commit
816bcff09d
@ -3,16 +3,17 @@ pipeline {
|
|||||||
parameters {
|
parameters {
|
||||||
string(name: 'servicename', description: "service name")
|
string(name: 'servicename', description: "service name")
|
||||||
string(name: 'svcdesc', description: "service description")
|
string(name: 'svcdesc', description: "service description")
|
||||||
string(name: 'targetHost', description: "system to live on", defaultValue: "alloces.lan")
|
string(name: 'targetHost', description: "system to live on", defaultValue: "moloryb.lan")
|
||||||
booleanParam(name: 'database', description: "service has a database", defaultValue: true)
|
booleanParam(name: 'database', description: "service has a database", defaultValue: true)
|
||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
pw_linuxserviceaccount=""
|
//pw_linuxserviceaccount=""
|
||||||
pw_productiondatabase=""
|
//pw_productiondatabase=""
|
||||||
pw_developmentdatabase=""
|
//pw_developmentdatabase=""
|
||||||
SUDOER=credentials('') //going to be set based on target host
|
//SUDOER=credentials('') //going to be set based on target host
|
||||||
SUDOERSSH=credentials('2c48e1a9-22b2-455c-9959-6b29e86d3fb5')
|
SUDOERSSH=credentials('2c48e1a9-22b2-455c-9959-6b29e86d3fb5')
|
||||||
JENKINS=credentials('68391381-e095-4b47-b956-d23055b0808e')
|
JENKINS=credentials('f1192e74-dfe0-402f-a189-703482d914fe')
|
||||||
|
GITEATOKEN = credentials('d0e86441-2157-405f-8539-a9a9010c6ecf')
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage("environment setup") {
|
stage("environment setup") {
|
||||||
@ -45,15 +46,12 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage("gitea project"){
|
stage("gitea project"){
|
||||||
environment {
|
|
||||||
GITEA = credentials('0bd7c8f5-046c-44b9-9c77-7a28a219ae31')
|
|
||||||
}
|
|
||||||
steps{
|
steps{
|
||||||
sh """
|
sh """
|
||||||
curl -X 'POST' \
|
curl -X 'POST' \
|
||||||
'https://gitea.arg.rip/api/v1/repos/greyn/_service-template/generate' \
|
'https://gitea.arg.rip/api/v1/repos/greyn/_template-service/generate' \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H 'Authorization: token $GITEA_PSW' \
|
-H 'Authorization: token ${env.GITEATOKEN}' \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{
|
-d '{
|
||||||
"description": "${svcdesc}",
|
"description": "${svcdesc}",
|
||||||
@ -72,19 +70,22 @@ pipeline {
|
|||||||
}
|
}
|
||||||
stage("jenkins pipeline"){
|
stage("jenkins pipeline"){
|
||||||
steps{
|
steps{
|
||||||
sh """
|
//the bad news is that it looks like it's not allowed to trigger just any old job remotely
|
||||||
curl -X POST -L --user ${env.JENKINS_USR}:${env.JENKINS_PSW} \
|
//the good news is that this seems to pick it up pretty reliably
|
||||||
alloces.lan:8080/job/gitea.arg.rip/build
|
//sh """
|
||||||
"""
|
// curl -X POST -L --user ${env.JENKINS_USR}:${env.JENKINS_PSW} \
|
||||||
|
// alloces.lan:8080/job/gitea.arg.rip/build
|
||||||
|
// """
|
||||||
|
|
||||||
timeout(time: 5, unit: 'MINUTES') {
|
timeout(time: 5, unit: 'MINUTES') {
|
||||||
sh """
|
sh """
|
||||||
strRes=""
|
strRes=""
|
||||||
while [ -z "$strRes" ];
|
while [ -z "\$strRes" ];
|
||||||
do
|
do
|
||||||
sleep 5;
|
sleep 5;
|
||||||
strRes=\$(curl -X GET -s -u ${env.JENKINS_USR}:${env.JENKINS_PSW} \
|
strRes=\$(curl -X GET -s -u ${env.JENKINS_USR}:'${env.JENKINS_PSW}' \
|
||||||
alloces.lan:8080/job/gitea.arg.rip/api/json | jq '.jobs.[] | select(.name=="${env.servicename}")')
|
alloces.lan:8080/job/gitea.arg.rip/api/json \
|
||||||
|
| jq ".jobs.[] | select(.name==\"${env.servicename}\")")
|
||||||
done
|
done
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@ -256,11 +257,10 @@ pipeline {
|
|||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
failure {
|
failure {
|
||||||
matrixSendMessage hostname: 'https://greyn.club:8448', accessTokenCredentialsId: '040b63d1-2f14-4692-badb-114bddd7c5a5', roomId: '!QmOCACetHdGDlNFsZP:greyn.club', body: '1-click service failed :('
|
matrixSendMessage https:true, hostname: 'greyn.club', port:8448, accessTokenCredentialsId: '040b63d1-2f14-4692-badb-114bddd7c5a5', roomId: '!QmOCACetHdGDlNFsZP:greyn.club', body: '1-click service failed :(', formattedBody: "1-click service <b>failed</b> :("
|
||||||
|
|
||||||
}
|
}
|
||||||
success {
|
success {
|
||||||
matrixSendMessage hostname: 'https://greyn.club:8448', accessTokenCredentialsId: '040b63d1-2f14-4692-badb-114bddd7c5a5', roomId: '!QmOCACetHdGDlNFsZP:greyn.club', body: '1-click service success! go pick up the credentials!'
|
matrixSendMessage https:true, hostname: 'greyn.club', port:8448, accessTokenCredentialsId: '040b63d1-2f14-4692-badb-114bddd7c5a5', roomId: '!QmOCACetHdGDlNFsZP:greyn.club', body: '1-click service success! go pick up the credentials!', formattedBody: '1-click service success! go pick up the credentials!'
|
||||||
//TODO: archiveArtifacts the password data, then store them somewhere
|
//TODO: archiveArtifacts the password data, then store them somewhere
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user