Skip to main content

Automation with Acquia Cloud Hooks

 

Video demo

In this tutorial we set up automation of triggering "compare" job on Diffy after you do deployment to Acquia environment.

You can review this set up live recorded in 12 minutes.

 

Detailed instructions here


I have set up a demo site on Acquia for this.

Acquia dashboard

 

I do not have Prod environment, but will use Stage as my main site.

Important detail: is that I've set up Dev environment to listen master branch. So anytime I push code to master it will get deployed automatically. If you have different set up you might need to look at slightly different hooks according to the documentation.

 

Create a project

Next let's create a project in Diffy.

Diffy project configuration Acquia

As you can see, I am using only one breakpoint (to save time for video demo). But you can use more.

Make sure you have a good list of pages to scan.

As recommendation I also use option "Scroll page" under Advanced.

Test your set up by running Compare Environments job "Production VS Development"

Compare environments

If your environments are identical you should see report with zero changes.

 

Hooks integration

Next lets set up Acquia hooks integration.

For that we need to clone https://github.com/DiffyWebsite/diffy-acquia to your codebase.

We will need just hooks folder from the root of the repo. It should be placed to the root folder of your Acquia's codebase.

Now we need to provide configuration to the script. It can be done in script 

hooks/diffy/diffy_trigger_compare_job.php


You need to check the ID of your Diffy project. Look at the URL. In my case it is 642.

https://app.diffy.website/#/projects/642


Next you need to generate an API key. It will be used to authenticate at Diffy. You can find your keys under My Account menu.

Diffy Keys My Account

Copy key value

So at the top of the diffy_trigger_compare_job.php script you can provide these two credentials.

list($script, $site, $target_env, $source_branch, $deployed_tag, ) = $argv;

// Settings. Please provide your own here.
$api_key = '37d53e3d8e0ae4b88602e9d2b9b3bd44';
$project_id = 642;

// Choose what environments to compare.


Now you should be good to go. Simply commit "hooks" folder to your Acquia git repository.


Now whenever you push code to master branch it is deployed to Dev environment and it will be visually compared with Production (stage environment in our example).


Also, pay attention that I've added clearing caches job during the deployment. If you have more complex deployment procedure like running db updates, running migrations etc. -- remember to take care of them too.

 

Intentional CSS change

In the video I also did intentional CSS change to see that it got detected -- changed size of the block titles. Diffy caught it right:

Diffy Acquia results

Please let me know if you have any questions about this automation. I am more than happy to assist setting you up.