Corp/ops/deploy/eusrr-deploy-ssh

12 lines
318 B
Bash
Executable File

#!/usr/bin/env bash
set -Eeuo pipefail
readonly requested_command="${SSH_ORIGINAL_COMMAND:-}"
if [[ ${requested_command} =~ ^deploy[[:space:]]([0-9a-f]{40})$ ]]; then
exec sudo -n /usr/local/sbin/eusrr-deploy "${BASH_REMATCH[1]}"
fi
echo "Only 'deploy <40-character lowercase commit SHA>' is allowed." >&2
exit 2