Windows – Cannot FTP from jenkins to remote windows server (using Publish Over FTP Plugin)

debianftpJenkinswindows

I have a filezilla server runnning on a remote windows 7 machine. I have a running jenkins master with a slave installed on debian 7.

If I ssh to the debian7 slave and do a ftp/put to the filezilla server I can upload a test.txt file just fine:

$ ftp myfileZillaFtp 21
Connected to myfileZillaFtp.
220-FileZilla Server version 0.9.41 beta
220-written by Tim Kosse (Tim.Kosse@gmx.de)
220 Please visit http://sourceforge.net/projects/filezilla/
Name (myfileZillaFtp:jenkins): admin
331 Password required for admin
Password:
230 Logged on
Remote system type is UNIX.
ftp> cd test
250 CWD successful. "/test" is current directory.
ftp> put test.txt
local: test.txt remote: test.txt
200 Port command successful
150 Opening data channel for file transfer.
226 Transfer OK
6364 bytes sent in 0.00 secs (24959.2 kB/s)
ftp> 

But if I run the same step in a Jenkins freestyle job where I have added a FTP publish step based on the instruction here:

https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+FTP+Plugin

I get:

FTP: Connecting from host [debian7-slave]
FTP: Connecting with configuration [myfileZillaFtp] ...
220-FileZilla Server version 0.9.41 beta
220-written by Tim Kosse (Tim.Kosse@gmx.de)
220 Please visit http://sourceforge.net/projects/filezilla/
FTP: Logging in, command printing disabled
FTP: Logged in, command printing enabled
CWD test
250 CWD successful. "/test" is current directory.
FTP: Remote root is not absolute, getting absolute directory from PWD
PWD
257 "/test" is current directory.
TYPE I
200 Type set to I
CWD /test
250 CWD successful. "/test" is current directory.
PASV
227 Entering Passive Mode (172,22,80,8,192,46)
FTP: Disconnecting configuration [myfileZillaFtp] ...
ERROR: Exception when publishing, exception message [Connection timed out]
Build step 'Send files over FTP' changed build result to UNSTABLE
Finished: UNSTABLE

Why does the ftp upload fail when running it through jenkins?

EDIT:

Most likely a bug in:
https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+FTP+Plugin

It works with this plugin:
http://wiki.hudson-ci.org/display/HUDSON/FTP-Publisher+Plugin

Any suggestions are still welcome though.

Best Answer

I experienced the same issue. I was able to get the transfer working by configuring the plugin to "Use active data mode". Also make sure you allow connections on port 21 from your Jenkins server.