Guillaume Coré
2018-10-19 3c949d790ef14196a67abd094af3e13c3bf38196
Print ansible logs in Client VM Jenkins Pipeline
1 files modified
18 ■■■■■ changed files
tests/jenkins/ocp-clientvm.groovy 18 ●●●●● patch | view | raw | blame | history
tests/jenkins/ocp-clientvm.groovy
@@ -14,6 +14,9 @@
// SSH key
def ssh_creds = '15e1788b-ed3c-4b18-8115-574045f32ce4'
// Admin host ssh location is in a credential too
def ssh_admin_host = 'admin-host-na'
// state variables
def guid=''
def ssh_location = ''
@@ -228,6 +231,21 @@
                """
            }
            /* Print ansible logs */
            withCredentials([
                string(credentialsId: ssh_admin_host, variable: 'ssh_admin'),
                sshUserPrivateKey(
                    credentialsId: ssh_creds,
                    keyFileVariable: 'ssh_key',
                    usernameVariable: 'ssh_username')
            ]) {
                sh("""
                    ssh -o StrictHostKeyChecking=no -i ${ssh_key} ${ssh_admin} \
                    "cat deployer_logs/*${guid}*log" || true
                """.trim()
                )
            }
            withCredentials([usernameColonPassword(credentialsId: imap_creds, variable: 'credentials')]) {
                mail(
                    subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}) failed GUID=${guid}",