diff --git a/scripts/1clickservice.groovy b/scripts/1clickservice.groovy index 3ee9ab4..1924520 100644 --- a/scripts/1clickservice.groovy +++ b/scripts/1clickservice.groovy @@ -153,7 +153,8 @@ pipeline { "\$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 git add . @@ -218,13 +219,16 @@ pipeline { "\$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 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 """ } @@ -291,13 +295,15 @@ pipeline { } } } + /* post { 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 failed :(" } 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 } } + */ } \ No newline at end of file