Compare commits
3 Commits
88419c8985
...
51b87b720b
Author | SHA1 | Date | |
---|---|---|---|
51b87b720b | |||
41045a0973 | |||
c3eda11c05 |
@ -128,20 +128,19 @@ pipeline {
|
||||
|
||||
pushd ${servicename}
|
||||
|
||||
databaseString="Host=${targetHost};Database=${servicename};Username=${servicename};Password=${env.pw_productiondatabase};IncludeErrorDetail=true;"
|
||||
|
||||
databasecredsid=\$(uuidgen)
|
||||
httpBasicAuth=\"http://${env.JENKINS_USR}:${env.JENKINS_PSW}@alloces.lan:8080/\"
|
||||
echo \"\${httpBasicAuth}\"
|
||||
urlGetData=\"crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\\":\\",//crumb)\"
|
||||
|
||||
CRUMB=\$(curl -s -c cookies.txt \"\${httpBasicAuth}\${urlGetData}\")
|
||||
echo "crumb anyway. \$CRUMB"
|
||||
curl -H \$CRUMB -X POST \"http://${env.JENKINS_USR}:${env.JENKINS_PSW}@alloces.lan:8080/job/gitea.arg.rip/job/${servicename}/credentials/store/folder/domain/_/createCredentials\" \
|
||||
--data-urlencode 'json={
|
||||
"": "0",
|
||||
"credentials": {
|
||||
"scope": "GLOBAL",
|
||||
"id": "'"\$databasecredsid"'",
|
||||
"secret": "Host=${targetHost};Database=${servicename};Username=${servicename};Password=${env.pw_productiondatabase};IncludeErrorDetail=true;",
|
||||
"secret": "\$databaseString",
|
||||
"description": "database connection string",
|
||||
"\$class": "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"
|
||||
}
|
||||
@ -152,6 +151,9 @@ pipeline {
|
||||
rm cookies.txt
|
||||
git add .
|
||||
git commit -m \"set up for database\"
|
||||
|
||||
cp appsettings.sample.json appsettings.json
|
||||
sed -i "s/\\"DBConnectionString\\" *: *\\"[^\\"]*\\"/\\"DBConnectionString\\":\\"\${databaseString}\\"/" appsettings.json
|
||||
"""
|
||||
|
||||
|
||||
@ -177,7 +179,10 @@ pipeline {
|
||||
certCredsId=\$(uuidgen)
|
||||
|
||||
ssh-keygen -t ed25519 -f "${servicename}-ssh" -N ""
|
||||
privatekeycontent=\$(cat ${servicename}-ssh)
|
||||
privatekeycontent=\$(cat ${servicename}-ssh)\$'\\n'
|
||||
privatekeycontent="\$privatekeycontent
|
||||
"
|
||||
echo "private key content: \$privatekeycontent hopefully newline isn't the issue."
|
||||
pubkeycontent=\$(cat ${servicename}-ssh.pub)
|
||||
CRUMB=\$(curl -s 'http://${env.JENKINS_USR}:${env.JENKINS_PSW}@alloces.lan:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)')
|
||||
echo \$CRUMB
|
||||
@ -268,6 +273,9 @@ pipeline {
|
||||
stage("initial service setup"){
|
||||
steps{
|
||||
sh """#!/bin/bash
|
||||
ssh -i "${servicename}-ssh" -tt ${servicename}@${targetHost} "mkdir -p ~/dist"
|
||||
scp -i "${servicename}-ssh" ${servicename}/appsettings.json ${servicename}@${targetHost}:~/dist/appsettings.json
|
||||
|
||||
ssh -i "${servicename}-ssh" -tt ${servicename}@${targetHost} "mkdir -p ~/.config/systemd/user/"
|
||||
scp -i "${servicename}-ssh" ${servicename}/${servicename}.service ${servicename}@${targetHost}:~/.config/systemd/user/${servicename}.service
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user