2017-12-28 20 views
0

Ich versuche, den Inhalt einiger bestimmter Protokolldateien im Nachrichtentext anzufügen, während die Ausführung eines Auftrags per E-Mail fehlgeschlagen ist.Anfügen von Protokolldateien in Benachrichtigungs-Mail im Jenkins-Pipeline-Workflow

stage("Checkout Fusion Source") { 
    parallel 'A': { 
     node('LinuxNode') { 
      try { 
       echo "Hello World(Linux)" 
      } catch (Exception e) { 
       mail body: 'Failed!', 
       subject: 'Job has failed in Linux!', 
       to: '[email protected]', 
       attachmentsPattern: '/path/to/log/file/log_linux.out' 
      } 
      mail body: 'Passed!', 
      subject: 'Job has passed in Linux!', 
      to: '[email protected]', 
      attachmentsPattern: '/path/to/log/file/log_linux.out' 
     } 
    }, 'B': { 
     node('AixNode') { 
      try { 
       echo "Hello World(AIX)" 
      } catch (Exception e) { 
       mail body: 'Failed!', 
       subject: 'Job has failed in AIX!', 
       to: '[email protected]', 
       attachmentsPattern: '/path/to/log/file/log_aix.out' 
      } 
      mail body: 'Passed!', 
      subject: 'Job has passed in AIX!', 
      to: '[email protected]', 
      attachmentsPattern: '/path/to/log/file/log_aix.out' 
     } 
    } 
} 

Diese attachmentsPattern hilft nicht für das gleiche. P.S. Meine Jenkins Version ist 2.46.3.

Antwort

0

installieren Sie die E-Mail-Erweiterung Plugin

und so etwas wie dies in Ihrer Pipeline Workflow versuchen.

emailext attachLog: true, Körper: "$ {currentBuild.result}: $ {BUILD_URL}", compressLog: true, replyTo: '[email protected]', Thema: „Build-Mitteilung: $ {JOB_NAME} -Build # $ {BUILD_NUMBER} $ {currentBuild.result} ", an: '[email protected]'