How to attach files to Jenkins Pipeline notification
26,206
email-ext uses Ant File Syntax
As for example usage:
emailext attachmentsPattern: '**/report.html', body: 'Find attachments', subject: 'test', to: '[email protected]'
Author by
eran meiri
Updated on August 09, 2020Comments
-
eran meiri over 3 years
I am trying in a pipeline to attach files to my notification mails.
How can I do that? An example would be nice.
-
sirineBEJI almost 6 yearsattachementPattern does not accept all file path ?? for example ${workspace}/file.xml
-
chenchuk almost 5 yearsworks as expected. another thing that is important in this context, is another boolean key/value 'attachLog: true' . not to be confused (as i did...) - the boolean is only for sending the build log of jenkins itself, rather than 'attachmentsPattern' which allow to customize based on Ant patterns
-
Suraj Nerati over 4 yearsdef file_name = "file.txt" and calling
attachmentsPattern: "${file_name}"
. its unable to call that file. please suggest -
Khan about 3 yearsif there are two files then?
-
hakamairi about 3 yearsHi @Khan, would you be able to write a pattern that matches both of them?
-
Khan about 3 yearsFor example the all files in a folder reports, so can I do like
**/reports/*
-
hakamairi about 3 yearsThe first start should be doubled unless you can provide a full path (then it matches all report directories in your working directory tree). Then you need a star at the end to pick all the files in the matched directories. EDIT: yeah, just like you edited.
-
Yakir GIladi Edry almost 3 yearsAlso you can add specific more than one file: attachmentsPattern: 'report.html, test.html,....'