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

14,070

Solution 1

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.

Solution 2

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.

Share:
14,070
4eyes
Author by

4eyes

Updated on July 02, 2022

Comments

  • 4eyes
    4eyes almost 2 years

    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?