Skip to content

Instantly share code, notes, and snippets.

@akash1810
Last active November 15, 2019 17:39
Show Gist options
  • Save akash1810/c681d57155f8e48e95214ca39a8f8cdf to your computer and use it in GitHub Desktop.
Save akash1810/c681d57155f8e48e95214ca39a8f8cdf to your computer and use it in GitHub Desktop.
Compare images between two Grid environments
#!/usr/bin/env bash
set -e
# Compare images between two Grid environments
# Assumes:
# - grid-cli installed `brew install guardian/devtools/grid-cli`
# - `test` and `prod` profiles configured `grid configuration:add`
# How it works:
# - Download image from PROD
# - Upload image to TEST
# - Compare media-api responses
IMAGE_ID=$1
echo '⏬ Downloading image from PROD️'
grid image:download ${IMAGE_ID} -d . -p prod
echo '⏫ Uploading image to TEST'
grid image:upload ${IMAGE_ID} -p test
echo '💾 Saving PROD api response'
grid image:get ${IMAGE_ID} -p prod > prod.json
echo '💾 Saving TEST api response'
grid image:get ${IMAGE_ID} -p test > test.json
echo 'Comparing...'
npx json-diff prod.json test.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment