properly replace creds ids
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good

This commit is contained in:
adam 2024-12-07 00:25:43 -05:00
parent da1b6aaed8
commit 519990ba19

View File

@ -153,7 +153,8 @@ pipeline {
"\$class": "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl" "\$class": "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"
} }
}' }'
sed -i 's/productiondatabase_connectionString=creds/productiondatabase_connectionString=credentials('\$databasecredsid')/\' Jenkinsfile credsStr="productiondatabase_connectionString=credentials(\\"\$databasecredsid\\")"
sed -i "s/productiondatabase_connectionString=creds/\$credsStr/" Jenkinsfile
rm cookies.txt rm cookies.txt
git add . git add .
@ -218,13 +219,16 @@ pipeline {
"\$class": "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey" "\$class": "com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey"
} }
}' }'
privatekeycontent=
sed -i 's/linuxServiceAccount=creds/linuxServiceAccount=credentials('${env.usernameCredsId}')/' Jenkinsfile
sed -i 's/targetHost=string/targetHost="${targetHost}"/' Jenkinsfile
rm cookies.txt rm cookies.txt
pushd ${servicename} pushd ${servicename}
linuxServiceAccountStr="linuxServiceAccount=credentials(\\"\$usernameCredsId\\")"
sed -i "s/linuxServiceAccount=creds/\$linuxServiceAccountStr/" Jenkinsfile
sed -i 's/targetHost=string/targetHost="${targetHost}"/' Jenkinsfile
git add .
git commit -m "linux account, service host"
git -c core.sshCommand="ssh -i '${PK}'\" push git -c core.sshCommand="ssh -i '${PK}'\" push
""" """
} }
@ -291,13 +295,15 @@ pipeline {
} }
} }
} }
/*
post { post {
failure { failure {
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> :(" 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 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!' matrixSendMessage https:true, hostname: 'greyn.club', port:8448, accessTokenCredentialsId: '040b63d1-2f14-4692-badb-114bddd7c5a5', roomId: '!QmOCACetHdGDlNFsZP:greyn.club', body: "${servicename} ready to go on ${targetHost}. username: ${servicename}, password: ${env.pw_linuxserviceaccount}. if db, prod db pw: ${env.pw_productiondatabase} and dev pw: ${env.pw_developmentdatabase}"
//TODO: archiveArtifacts the password data, then store them somewhere //TODO: archiveArtifacts the password data, then store them somewhere
} }
} }
*/
} }