uhhh pretty sure it works
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good

This commit is contained in:
adam 2024-12-18 19:47:33 -05:00
parent 41045a0973
commit 51b87b720b

View File

@ -153,7 +153,7 @@ pipeline {
git commit -m \"set up for database\"
cp appsettings.sample.json appsettings.json
sed -i "s/\\"DBConnectionString\\":\\"[^\\"]*\\"/\\"DBConnectionString\\":\\"\${databaseString}\\"/g" appsettings.json
sed -i "s/\\"DBConnectionString\\" *: *\\"[^\\"]*\\"/\\"DBConnectionString\\":\\"\${databaseString}\\"/" appsettings.json
"""
@ -179,7 +179,9 @@ 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)')
@ -194,8 +196,7 @@ pipeline {
"password": "",
"privateKeySource": {
"stapler-class": "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey\$DirectEntryPrivateKeySource",
"privateKey": "\$privatekeycontent
",
"privateKey": "\$privatekeycontent",
},
"description": "${servicename}",
"stapler-class": "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey"
@ -272,12 +273,9 @@ pipeline {
stage("initial service setup"){
steps{
sh """#!/bin/bash
pushd ${servicename}
scp -i \"${servicename}-ssh\" appsettings.json ${servicename}@${targetHost}:dist/appsettings.json
popd
"""
ssh -i "${servicename}-ssh" -tt ${servicename}@${targetHost} "mkdir -p ~/dist"
scp -i "${servicename}-ssh" ${servicename}/appsettings.json ${servicename}@${targetHost}:~/dist/appsettings.json
sh """#!/bin/bash
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