Issue
I have been testing the Jenkins "Poll Mail Trigger" plugin to trigger a project via email. To develop the project I need to download the attached file that is sent.
In the project settings, I enable the only download option that exists: "Download to a timestamped Directory".
Also, the only information regarding the download is this: "The Attachments field, allows you to determine what to do with email attachments. If attachments are downloaded, the pmt_attachmentsDirectory
variable with be set to the download directory."
Then, after doing several tests without configuring any directory for the download of the attached file -assuming that the download should have been automatic-, I proceeded to change the environment variables in the Jenkins configuration, I put the following:
- Name: pmt_attachmentsDirectory
- Value: *D: *
So, what I'm trying to do is save the file to my Drive D: \
The file is never downloaded to the specified disk, and just for verification, I am trying to move the file with the following Windows command:
move "% pmt_attachmentsDirectory%" "D: \ Users \ wrodriguez \ Downloads \ Test_Programs"
And finally it throws me the following output: "The system cannot find the specified file."
So, I am really lost here, can anybody help me with this issue? Is there another plugin on Jenkins that I can use to download an attatchment?
Thanks for your help.
Solution
I haven't worked on that plugin (or Jenkins) in 5 years, so forgive my rustiness.
Looking at the code, the plugin creates a timestamped folder, and saves any attachments there.
It then injects an environment variable named pmt_attachmentsDirectory
into the Jenkins job instance's environment variables - the value is the absolute path of folder (it's not configurable).
Troubleshooting:
- have you enabled saving Attachments in the Plugin options?
- check the job instance's environment variables - does it have
pmt_attachmentsDirectory
listed?- print the value of
pmt_attachmentsDirectory
- e.g.echo "%pmt_attachmentsDirectory%"
- what does it say? - does the directory exist?
- does the directory contain any files?
- print the value of
- does the "View Polling Log" have any errors?
- do the Jenkins logs have any errors?
Other notes:
"% pmt_attachmentsDirectory%"
- shouldn't have a space e.g. should be"%pmt_attachmentsDirectory%"
Answered By - Nick Grealy