How to compare two builds before deploying in PHP?

Hi, I’m using gradle to build and deploy a PHP project.

Currently the deploy is peformed manually: someone connects using SSH, compares the currently deployed version with the new one, and updates the files as necessary.

I remind you that PHP deploys are very different than Java deploys, as they are done by connecting via SSH or FTP, and they consist in copy files and run some SSH commands.

I want to automatize this process with Gradle. Do you think its possible? I want to generate the script in Gradle and manage it through Jenkins.

Thanks you in advance, Juan Ignacio

Best regards

I don’t think there is anything that would prevent you from using SSH with Gradle. There is for example this plugin that should help you with that: http://gradle-ssh-plugin.github.io/

I think I will make a custom plugin and solve this case by executing following tasks:

  1. Generate the build in directory “A” 2. Retrieve current uploaded version, and put it on a directory “B” (ssh-plugin). I Will make some kind of intelligency to avoid downloading entire tree every time, by running first a command via SSH, retrieve last modification date of the entire tree, and add this information to a ‘upToDateWhen()’ on the task. 3. Compare directory A and B, and generate a directory C with files needed to be updated. This will be made by a custom plugin I think, as the ‘compare-gradle-builds’ plugin does not have this functionality, as far as I’ve read, as it generates an HTML output :S. 4. Upload files in directory C via ssh.

I’m new to gradle, I’m listening for suggestions!