#!/bin/sh
set -e
curl -s http://sensu.global.ssl.fastly.net/apt/pool/jessie/main/s/sensu/ | grep - | cut -d'>' -f2 | cut -d'_' -f2 | sort | tail -n1

#!/bin/sh
set -e
curl -s http://sensu.global.ssl.fastly.net/apt/pool/stretch/main/s/sensu/ | grep - | cut -d'>' -f2 | cut -d'_' -f2 | sort | tail -n1

Check for availability of packages for Stretch
Check for availability of packages for Stretch

Obviously, Jessie is no longer the base Debian system behind image ruby:2.4-stretch-slim, so check the right packages availability.