Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins: FTP / SSH deployment, including deletion and moving of files

I was wondering how to get my web-projects deployed using ftp and/or ssh.

We currently have a self-made deployment system which is able to handle this, but I want to switch to Jenkins.

I know there are publishing plugins and they work well when it comes to uploading build artifacts. But they can't delete or move files.

Do you have any hints, tipps or ideas regarding my problem?

like image 775
4eyes Avatar asked Nov 22 '11 10:11

4eyes


2 Answers

The Publish Over SSH plugin enables you to send commands using ssh to the remote server. This works very well, we also perform some moving/deleting files before deploying the new version, and had no problems whatsoever using this approach.

like image 57
pushy Avatar answered Nov 15 '22 06:11

pushy


The easiest way to handle deleting and moving items is by deleting everything on the server before you deploy a new release using one of the 'Publish over' extensions. I'd say that really is the only way to know the deployed version is the one you want. If you want more versioning-system style behavior you either need to use a versioning system or maybe rsync that will cover part of it.

If your demands are very specific you could develop your own convention to mark deletions and have them be performed by a separate script (like you would for database changes using Liquibase or something like that).

By the way: I would recommend not automatically updating your live sites after every build using the 'publish over ...' extension. In case we really want to have a live site automatically updated we rely on the Promoted Builds Plugin to keep it nearly fully-automated but add a little safety.

like image 35
Simon Groenewolt Avatar answered Nov 15 '22 05:11

Simon Groenewolt