latest error:
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good

116: notice that -s won't happen until line 123
/var/lib/jenkins/workspace/meta/greyn dotnet service@tmp/durable-01f2ce1d/script.sh.copy: line 19: -s: command not found
This commit is contained in:
adam 2024-12-02 22:00:17 -05:00
parent aa42c24735
commit dd924662fb

View File

@ -103,38 +103,51 @@ pipeline {
script { //there's no "if" "step" so any "if" must be in a "script" step
if(database){
sh """#!/bin/bash
pushd ${servicename}
dbstartline=\$(sed -n '/---dbstart---/=' Jenkinsfile)
dbendline=\$(sed -n '/---dbend---/=' Jenkinsfile)
echo \"yes db\"
sed -i -e '\${dbstartline}d;\${dbendline}d;' Jenkinsfile
echo \"yes db. \${dbstartline} and \${dbendline}\"
sed -ie \"\${dbstartline}d;\${dbendline}d\" Jenkinsfile
echo "114"
databasecredsid=\$(uuidgen)
echo "116: notice that -s won't happen until line 123"
urlGetData=\"crumbIssuer/api/xml\\?xpath=concat\\(//crumbRequestField,\\":\\",//crumb\\)\"\"
echo "118"
echo \"\${urlGetData}\"
echo "120"
sleep 1
echo "122"
echo \"curl -s \"http://${env.JENKINS_USR}:\'${env.JENKINS_PSW}\'@alloces.lan:8080/\${urlGetData}\"
echo "123"
curl -s \"http://${env.JENKINS_USR}:\'${env.JENKINS_PSW}\'@alloces.lan:8080/\${urlGetData}\"
CRUMB=\$(curl -s \"http://${env.JENKINS_USR}:'${env.JENKINS_PSW}'@alloces.lan:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)\")
CRUMB=\$(curl -s \"http://${env.JENKINS_USR}:\'${env.JENKINS_PSW}\'@alloces.lan:8080/\${urlGetData}\")
echo \$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/greyn%20services/createCredentials' \
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/greyn%20services/createCredentials\" \
--data-urlencode 'json={
"": "0",
"credentials": {
"scope": "GLOBAL",
"id": "\$databasecredsid",
"secret": "Host=${targetHost};Database=${servicename};Username=${servicename};Password=${env.pw_productiondatabase};IncludeErrorDetail=true;",
"secret": "\"Host=${targetHost};Database=${servicename};Username=${servicename};Password=${env.pw_productiondatabase};IncludeErrorDetail=true;\"",
"description": "database connection string",
"\$class": "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"
}
}'
sed -i 's/productiondatabase_connectionString=creds/productiondatabase_connectionString=credentials('\$databasecredsid')/' Jenkinsfile
sed -ie 's/productiondatabase_connectionString=creds/productiondatabase_connectionString=credentials('\$databasecredsid')/\' Jenkinsfile
git add .
git commit -m "set up for database"
git commit -m \"set up for database\"
"""
}
else{
sh """#!/bin/bash
echo \"no db\"
pushd ${servicename}
sed -i -e '\${dbstartline},\${dbendline}d;' Jenkinsfile
sed -i '\${dbstartline},\${dbendline}d;' Jenkinsfile
git add .
git commit -m "stripped database lines"
"""