Jenkins: Can't send zip archive via email

泄露秘密 提交于 2019-12-24 09:28:20

问题


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!

来源:https://stackoverflow.com/questions/47114227/jenkins-cant-send-zip-archive-via-email

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!