简体   繁体   中英

Jenkins Email-Ext Plugin No Longer Attaching File

In the past couple days our pipeline has no longer been attaching a results file from one of our pipelines. We did do a Jenkins version update and tried downgrading to no avail. Tracking in the mail system is showing that there is no attachment upon being sent. Below is what is being used:

pipeline {
    agent any

    stages {
        stage('Verify version') {
            steps {
                withCredentials([usernamePassword(credentialsId: '7a8e77b6-d081-4ed7-9bb5-32e3f5bd0b4b', passwordVariable: 'srvPassword', usernameVariable: 'srvUser')]) {
                    powershell '''
                        Set-Location (Join-Path -Path $env:SystemDrive -ChildPath 'Scripts')
                        .\\AutomatedTasks.ps1 `
                        -Pass $env:srvPassword `
                        -User $env:srvUser `
                        -Verbose
                    '''
                }
            }
        }
    }
    post {
        success {
            emailext attachmentsPattern: '**/TaskOuput.csv', body:"${currentBuild.currentResult}: ${BUILD_URL}", from: 'automation@test.com', subject: "Build Notification ${JOB_NAME}-Build# ${BUILD_NUMBER} ${currentBuild.currentResult}", to: 'itdepartment@test.com'
        }
    }
}

I have also tried attchmentsPattern without the leading **/ and had the same result. Any ideas on where to go from here?

After talking to some more of my team it looks like the downgrade we did didn't fix anything and since it wasn't mission critical we continued with the latest version.

The solution was actually really simple in the end. What changed was that in the prior Jenkins version the pipeline would create two workspace directories. One was names AutomatedTask the other was AutomatedTask@2. Originally, the Email-Ext module would pull from AutomatedTask@2, but with the most recent update it was pulling from the other workspace. Once we changed where to output the file the issue was resolved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM