Compare commits

..

No commits in common. "519990ba19cc8df926b04bc80b6aef62757b025d" and "a672887719bf344634a5c5227d05dea69b7e3d04" have entirely different histories.

View File

@ -26,27 +26,6 @@ pipeline {
error("servicename cannot have spaces. try dashes.") error("servicename cannot have spaces. try dashes.")
} }
sh """#!/bin/bash
function testcmd(){
if ! command -v \$1 2>&1 >/dev/null
then
echo "this agent doesn't have \$1"
exit 1
fi
}
testcmd mktemp
testcmd curl
testcmd git
testcmd sed
testcmd ssh
testcmd ssh-keyscan
testcmd ssh-keygen
testcmd scp
testcmd jq
"""
switch (targetHost) { switch (targetHost) {
case "alloces.lan": case "alloces.lan":
SUDOER_USR = SUDOER_ALLOCES_USR SUDOER_USR = SUDOER_ALLOCES_USR
@ -153,8 +132,7 @@ pipeline {
"\$class": "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl" "\$class": "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"
} }
}' }'
credsStr="productiondatabase_connectionString=credentials(\\"\$databasecredsid\\")" sed -i 's/productiondatabase_connectionString=creds/productiondatabase_connectionString=credentials('\$databasecredsid')/\' Jenkinsfile
sed -i "s/productiondatabase_connectionString=creds/\$credsStr/" Jenkinsfile
rm cookies.txt rm cookies.txt
git add . git add .
@ -219,16 +197,13 @@ 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
""" """
} }
@ -295,15 +270,13 @@ 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: "${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}" 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!'
//TODO: archiveArtifacts the password data, then store them somewhere //TODO: archiveArtifacts the password data, then store them somewhere
} }
} }
*/
} }