Download files over FTP in a jenkins job? - jenkins

It seems that its only possible to upload files over FTP using:
https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+FTP+Plugin
But I need to download a file over FTP, I could write a groovy plugin for this but it seems strange that there is no plugin for this

Maybe the reason is that it is somewhat trivial to download a file during a build using a one-liner like:
curl -O ftp://server/path/to/file
The curl tool is available for just about any operating system.
If you only need to download one file over FTP and do not need to check out any other files, you could also use the URL SCM plugin.

There is now an SSH2Easy plugin available that supports sftp to/from remote systems. My company has moved to requiring use of sftp and won't allow ftp any longer.
This plugin, at the time of this reply, still needs some polishing, but it does work.

Related

I want to backup existing files in FTP every time before deploy, can this be done using Jenkins pipeline

I have a MVC web applications project we use FTP(Filezilla) to host. In Jenkins i know we have plugin to Deploy files to FTP but every time before that i want to backup existing files in FTP, can this be done using Jenkins pipeline. I am Sorry if I am not clear.
Yes, you should be able to use the Publish Over FTP plugin for this. You can use something like curl to download the files from the FTP.
curl -O ftp://server/path/to/file
Another option is SSH2 Easy plugin which allows FTP file upload/download.

How do I add external files to a Jenkins job?

I'm working with Jenkins to make a build of a Visual Studio C++ project I have in a git repository. However, although I don't upload them to github, my project needs SDL2's external libraries and DLL as well as some assets.
How can I add them to my jenkins job to generate a build of my project? I want to add the SDL2's libs and DLL as well as my assets folder and place them in the job workspace, in a way that won't make me upload the files everytime jenkins builds my project. But I haven't found anything that clears that for me.
Thanks!!
If your project needs assets (something like pixel art), this should probably be uploaded to GitHub along with your code. Another option is to uploaded assets to some other public/private repository that Jenkins can access.
As for the SDL2 libraries and DLL, you are correct that this should not be uploaded to GitHub. Instead, I would recommend using something like Docker to package your C++ project with its dependencies. Manually installing them on the Jenkins server is also an option, but not ideal because you'll have to do this on any machine you want your code to run.
Hope that gives you somewhere to start!

Pointing Jenkins to Use Another Plugin Repository

Good afternoon,
As I understand Jenkins, if I need to install a plugin, it goes to Jenkins Plugins
The problem I have is Jenkins is installed on a closed network, it cannot access the internet. Is there a way I can download all of the plugins, place them on a web server on my local LAN, and have Jenkins reach out and download plugins as necessary? I could download everything and install one plugin at a time, but that seems a little tedious.
You could follow some or all of the instructions for setting up an artifactory mirror for the plugin repo.
It will need to be a http/https server and you will find that many plugins have a multitude of dependencies
The closed network problem:
You can take a cue from the Jenkins Docker install-plugins.sh approach ...
This script takes as input a list of plugins, and optionally versions (eg: $0 workflow-aggregator:2.6 pipeline-maven:3.6.5 job-dsl:1.70) and will download all the plugins and dependencies into a working directory.
Our approach is to create a file (under version control) and redirect that to the command line input (ie: install-plugins.sh $(< plugins.lst).
You can download from where you do have internet access and then place on your network, manually copying them to your ${JENKINS_HOME}/plugins directory and restart the instance.
The tedious list problem:
If you only specify top-level plugins (ie: what you need), every time you run the script, it will resolve the latest dependencies. Makes for a short list, but random dependencies if they get updated at https://updates.jenkins.io. You can use a two-step approach to address this. Use the short-list to download the required plugins and dependencies. Store the generated explicit list for future reference or repeatability.

Is it possible to merge changes on server using Jenkins

I am looking for a way to merge full local directory to a remote server using jenkins. It is easy to use some FTP plugin to delete while remote directory and re-upload all the files, but i would like to only upload new/changed files and remove the deleted files.
Is it possible to do that using jenkins? Maybe some other automation tool?
On Unix or Linux you can run 'rsync' with the two directories as parameters -
either on the local or on the remote host.
Just make sure you are not in the middle of some other operation while 'rsync' runs.

Extract, zip and publish TFS source-controlled items to FTP server

I want to publish nightly builds + source code of a specific project on a tfs 2010 server (local network, inside the firewall) to a (local network, in the dmz) ftp server.
Build
Get latest version
Zip build and code
Copy to ftp server
Copying the files can use ftp protocol or copy to network share.
Can I do this easily with team-build, or do I need extra tools?
You can do this pretty easily using Team Foundation Build. There are even zip and ftp Activities that ship with VS and are ready to use.
If you want a tool to make it easyer then I would recommend Final Builder. This tool inegrates into Team Foundation Build with an Activity that runs after Build and Test that you can do pretty much anything in. It has FTP and Zip Activities ready for dragging and dropping.
If you have a more complicated as we had, like synchronize/cleanup a remote site via FTP, you can easily create your custom CodeActivity and do FTP via WebClient directly in C# code.

Resources