Publish over FTP on Jenkins Pipeline?

2,237 views
Skip to first unread message

Thiago Carvalho Davila

unread,
Jun 21, 2017, 2:26:21 PM6/21/17
to jenkins...@googlegroups.com
Hello,

I've been using this Publish Over FTP plugin for some time (https://github.com/jenkinsci/publish-over-ftp-plugin​). And I want to know if there is compatibility to doing that using jenkins pipeline for a declarative pipeline or does it has some other plugin with that feature.

Thanks in advance,

Thiago
-


"Esta mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), empresa pública federal regida pelo disposto na Lei Federal nº 5.615, é enviada exclusivamente a seu destinatário e pode conter informações confidenciais, protegidas por sigilo profissional. Sua utilização desautorizada é ilegal e sujeita o infrator às penas da lei. Se você a recebeu indevidamente, queira, por gentileza, reenviá-la ao emitente, esclarecendo o equívoco."

"This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO) -- a government company established under Brazilian law (5.615/70) -- is directed exclusively to its addressee and may contain confidential data, protected under professional secrecy rules. Its unauthorized use is illegal and may subject the transgressor to the law's penalties. If you're not the addressee, please send it back, elucidating the failure."

Slide

unread,
Jun 21, 2017, 3:25:06 PM6/21/17
to jenkins...@googlegroups.com
I know for sure that the Publish Over family of plugins don't support pipeline, they need to have some work done to support it.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e4f66e4d15b0018c595ddddccaf64f9d27f5dc90%40serpro.gov.br.
For more options, visit https://groups.google.com/d/optout.

Thiago Carvalho Davila

unread,
Jun 22, 2017, 7:23:57 AM6/22/17
to jenkins...@googlegroups.com
Any workaround or plugin that does FTP transfer in Jenkins Pipeline?

For more options, visit https://groups.google.com/d/optout.

Slide

unread,
Jun 22, 2017, 10:34:38 AM6/22/17
to jenkins...@googlegroups.com
You could write a shell script 

Thiago Carvalho Davila

unread,
Jun 22, 2017, 11:00:35 AM6/22/17
to jenkins...@googlegroups.com
I've thought about that, but I would need an input step to get the user and password. And I don't know how I could get the password without displaying it on the pipeline log.

For more options, visit https://groups.google.com/d/optout.

Slide

unread,
Jun 22, 2017, 12:58:07 PM6/22/17
to jenkins...@googlegroups.com

You could use the credentials steps to retrieve the username/password and keep it secure. I think it's withCredentials. I would check into that.


Baptiste Mathus

unread,
Jun 22, 2017, 2:45:34 PM6/22/17
to jenkins...@googlegroups.com

2017-06-22 18:57 GMT+02:00 Slide <slide...@gmail.com>:

You could use the credentials steps to retrieve the username/password and keep it secure. I think it's withCredentials. I would check into that.

On Thu, Jun 22, 2017, 08:00 Thiago Carvalho Davila <thiago...@serpro.gov.br> wrote:
I've thought about that, but I would need an input step to get the user and password. And I don't know how I could get the password without displaying it on the pipeline log.


Em 22/06/2017 11:34:13, Slide escreveu:
You could write a shell script 

On Thu, Jun 22, 2017 at 4:23 AM Thiago Carvalho Davila <thiago...@serpro.gov.br> wrote:
Any workaround or plugin that does FTP transfer in Jenkins Pipeline?


Em 21/06/2017 16:24:50, Slide escreveu:
I know for sure that the Publish Over family of plugins don't support pipeline, they need to have some work done to support it.

On Wed, Jun 21, 2017 at 11:26 AM Thiago Carvalho Davila <thiago...@serpro.gov.br> wrote:
Hello,

I've been using this Publish Over FTP plugin for some time (https://github.com/jenkinsci/publish-over-ftp-plugin​). And I want to know if there is compatibility to doing that using jenkins pipeline for a declarative pipeline or does it has some other plugin with that feature.

Thanks in advance,

Thiago
-


"Esta mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), empresa pública federal regida pelo disposto na Lei Federal nº 5.615, é enviada exclusivamente a seu destinatário e pode conter informações confidenciais, protegidas por sigilo profissional. Sua utilização desautorizada é ilegal e sujeita o infrator às penas da lei. Se você a recebeu indevidamente, queira, por gentileza, reenviá-la ao emitente, esclarecendo o equívoco."

"This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO) -- a government company established under Brazilian law (5.615/70) -- is directed exclusively to its addressee and may contain confidential data, protected under professional secrecy rules. Its unauthorized use is illegal and may subject the transgressor to the law's penalties. If you're not the addressee, please send it back, elucidating the failure."

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
-


"Esta mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), empresa pública federal regida pelo disposto na Lei Federal nº 5.615, é enviada exclusivamente a seu destinatário e pode conter informações confidenciais, protegidas por sigilo profissional. Sua utilização desautorizada é ilegal e sujeita o infrator às penas da lei. Se você a recebeu indevidamente, queira, por gentileza, reenviá-la ao emitente, esclarecendo o equívoco."

"This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO) -- a government company established under Brazilian law (5.615/70) -- is directed exclusively to its addressee and may contain confidential data, protected under professional secrecy rules. Its unauthorized use is illegal and may subject the transgressor to the law's penalties. If you're not the addressee, please send it back, elucidating the failure."

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

-


"Esta mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), empresa pública federal regida pelo disposto na Lei Federal nº 5.615, é enviada exclusivamente a seu destinatário e pode conter informações confidenciais, protegidas por sigilo profissional. Sua utilização desautorizada é ilegal e sujeita o infrator às penas da lei. Se você a recebeu indevidamente, queira, por gentileza, reenviá-la ao emitente, esclarecendo o equívoco."

"This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO) -- a government company established under Brazilian law (5.615/70) -- is directed exclusively to its addressee and may contain confidential data, protected under professional secrecy rules. Its unauthorized use is illegal and may subject the transgressor to the law's penalties. If you're not the addressee, please send it back, elucidating the failure."

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVcAL7GUceGDpH1S7AN628KpJnfaFfhC14e5Sc%2BYsDmWzQ%40mail.gmail.com.

Thiago Carvalho Davila

unread,
Jun 27, 2017, 7:54:12 AM6/27/17
to jenkins...@googlegroups.com
I have a jenkins master with linux and windows slaves. Also have a shell script for recursive FTP files upload. But that doesn't work on windows ​slaves.

Does anybody have a platform independent way of doing that? Maybe a Python script or something alike. If so, will withCredentials work passing the user and password as arguments the same way?
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS7Cq0e7esoCwmJgQieGwK%2B4HTPXJEnjX3850xUOVG%3D%2BUA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Baptiste Mathus

unread,
Jul 2, 2017, 9:50:34 AM7/2/17
to jenkins...@googlegroups.com
withCredentials will just define env variables. So then it's a matter of your script being able to handle the cross platform aspects, of scripting, of FTP, and accessing env vars.


-


"Esta mensagem do SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), empresa pública federal regida pelo disposto na Lei Federal nº 5.615, é enviada exclusivamente a seu destinatário e pode conter informações confidenciais, protegidas por sigilo profissional. Sua utilização desautorizada é ilegal e sujeita o infrator às penas da lei. Se você a recebeu indevidamente, queira, por gentileza, reenviá-la ao emitente, esclarecendo o equívoco."

"This message from SERVIÇO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO) -- a government company established under Brazilian law (5.615/70) -- is directed exclusively to its addressee and may contain confidential data, protected under professional secrecy rules. Its unauthorized use is illegal and may subject the transgressor to the law's penalties. If you're not the addressee, please send it back, elucidating the failure."

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

colourmeamused

unread,
Jul 2, 2017, 3:05:49 PM7/2/17
to Jenkins Users, thiago...@serpro.gov.br
A few ideas you can pick from based on what works best for you:

1) Create a global function for FTP upload, which just runs a shell command to upload to FTP. Then just call it in your pipeline e.g.
uploadToDefaultFTP('filePath')

2) Use declarative pipelines with FTP credentials set at the global or stage level (better) using the credentials function (example here) instead of withCredentials. Cleaner syntax. Plus, I often write my global functions to expect standard environment variables. e.g. your uploadToDefaultFTP function from 1) can be defined to expect FTP_USER and FTP_PASS environment variables. Then you only need to pass the file path on each call.

3) Run the Windows step in a separate pipeline stage and stash the files (See no. 10 here). Then in a separate stage that runs on your Linux master, unstash the files and run your shell script to upload the files. Transferring files between build nodes using stash/unstash works seamlessly but I am not sure how far you an push stash in terms of size and the performance. 

4) If your server supports uploading via a POST request, you can try the HTTPRequest pipeline step.

5) If you are porting your script, you could port to Jenkins pipeline native code rather than Python and use parallel to speed up things. This should work on both Linux and Windows.


I've thought about that, but I would need an input step to get the user and password. And I don't know how I could get the password without displaying it on the pipeline log.



6) There should be a way to mask specific params. But if it is just log output you care about, just use the returnStdout option in the sh step and don't assign the return value to anything.

Reply all
Reply to author
Forward
0 new messages