Diffy Integration

Tugboat does not provide visualdiffs for pages behind authentication. If you need to generate visual diffs from pages that are protected behind a login screen, you can set up Diffy for your Tugboat Previews. Diffy is a third-party visual diffing tool.

Prerequisites

  1. You’ll need to set up the project in Diffy, and get the numeric project ID from Diffy.
  2. You’ll need a Diffy API key to communicate with Diffy.

Tugboat Repository Configuration

Create Tugboat environment variables to store your DIFFY_API_KEY and DIFFY_PROJECT_ID:

Example DIFFY_API_KEY and DIFFY_PROJECT_ID as Tugboat environment variables Example DIFFY_API_KEY and DIFFY_PROJECT_ID as Tugboat environment variables

Tugboat config.yml

With the envvars configured in your Tugboat repository, use this snippet in your configuration file to communicate with Diffy via a service that has PHP installed.

 1services:
 2  apache:
 3    commands:
 4      init:
 5        # The Diffy CLI tool requires PHP. If the service image does not have PHP
 6        # installed, do it here
 7        #- apt-get update
 8        #- apt-get install php-cli
 9
10        # Download the Diffy CLI tool, and authenticate. The latest version can be
11        # found at https://github.com/DiffyWebsite/diffy-cli/releases
12        - curl -L https://github.com/DiffyWebsite/diffy-cli/releases/download/0.1.33/diffy.phar -o /usr/local/bin/diffy
13        - chmod +x /usr/local/bin/diffy
14        - diffy auth:login ${DIFFY_API_KEY}
15
16        # Clean up after apt-get, if it was used
17        #- apt-get clean
18        #- rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
19
20      online:
21        # If you would like to compare this service with production
22        - diffy project:compare ${DIFFY_PROJECT_ID} prod custom --env2Url="${TUGBOAT_SERVICE_URL}"
23          --commit-sha=${TUGBOAT_PREVIEW_SHA}
24
25        # If you would like to compare this service with its base preview
26        - |
27          if [[ -n "$TUGBOAT_BASE_PREVIEW_URL" ]]; then
28            diffy project:compare $DIFFY_PROJECT_ID custom custom \
29              --env1Url=$TUGBOAT_BASE_PREVIEW_URL \
30              --env2Url=$TUGBOAT_SERVICE_URL \
31              --commit-sha=${TUGBOAT_PREVIEW_SHA}
32          fi