I want to fetch project source code from GitLab, archive it and send it via email.
Jenkinsfile:
def gitlabRepo = 'http://repository.vrpconsulting.com/roman.skaskevich/koshcheck-copy.git'
deleteDir()
dir('koshcheck-copy') {
stage 'Fetch'
def curdir = pwd()
echo curdir
git url: "${gitlabRepo}", branch: 'master'
stage 'Archive'
zip archive: true, dir: './src', glob: '', zipFile: 'src.zip'
def savedZip = archive 'src.zip'
echo savedZip
stage 'Notify'
emailext (
to: 'roman.skaskevich@gmail.com',
subject: "ZIP",
body: "Attached zip must be there",
attachmentsPattern: 'src.zip'
)
}
I don't know if project archived successfully, but it isn't sent via email.
EDIT #1
Problem lay in that archive wasn't created. So I perform command which runs local 7zip for create archive: bat "\"C:\\Program Files (x86)\\7-Zip\\7z.exe\" a -tzip src.zip src"
.
Now remain the problem with sending this archive via email. Because job finished successfully, but returned:
Sending email to: roman.skaskevich@gmail.com
Error sending to the following VALID addresses: roman.skaskevich@gmail.com
I found this article in which suggests, that attachment is too large. But I decrease size of archive from 7MB to 250kB and have the same problem.
Thanks in advance!