0

Trying to get jenkins to include the readme as an attachment with a pipeline

stage('email Alex!'){
      mail(
          body: 'your component is released',
          attachmentsPattern: '**/*.md',
          from: env.DEFAULT_REPLYTO,
          replyTo: env.DEFAULT_REPLYTO,
          subject: 'README',
          to: 'alexander.lovett@bt.com'
      )
  }

In this test the dir stucture is:

--currentDir
  |--Project
     |--README.md

I just get an email with the body and no attachment though :/ Does anyone know how to do this?

Alex
  • 587
  • 11
  • 31

1 Answers1

2

You should install this plugin :

https://wiki.jenkins.io/display/JENKINS/Email-ext+plugin

And replace your code with this :

stage('email Alex!'){
   emailext(
      body: 'your component is released',
      attachmentsPattern: '**/*.md',
      from: env.DEFAULT_REPLYTO,
      replyTo: env.DEFAULT_REPLYTO,
      subject: 'README',
      to: 'alexander.lovett@bt.com'
   )
}
Coldplayer
  • 41
  • 4
  • 1
    we have emailext installed but for some reason emailext command would not work :/, ended up using mailx command instead. – Alex Aug 16 '17 at 14:20