jenkinsgroovyemail-extjenkins-email-ext

Attach multiple files to Jenkins email


I want to attach these files as a zip archive:

enter image description here

And this is what I did:

emailext([
    attachLog: true, 
    subject: 'Hello World',
    recipientProviders: [developers(), requestor()],
    to: '$DEFAULT_RECIPIENTS',
    body: "hello world",
    compressLog: true,
    mimeType: 'text/html',
])

Unfortunately this is attaching the whole console.log (into a zip called build).

How can I fix this?


Solution

  • Use attachmentsPattern parameter instead of attachLog. You are giving Jenkins too much credit if you expect it to figure out that build folder contains files with .log extension and that's what you meant by "attachLog".