diff --git a/scripts/1clickservice.groovy b/scripts/1clickservice.groovy index f708467..6b7401a 100644 --- a/scripts/1clickservice.groovy +++ b/scripts/1clickservice.groovy @@ -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