#!/usr/bin/env bash

# Unfortunately, since Jenkins typically runs scripts in-container non-interactively, this
# profile is unlikely to fire on its own and will need to be sourced when desired.

# Start ssh-agent automatically if it is not already running. Then load our SSH identity.
if ! ps aux | grep -q [s]sh-agent; then
    if [ -f "${HOME}/.ssh/id_rsa" ]; then
        eval $(ssh-agent -s) > /dev/null
        ssh-add "${HOME}/.ssh/id_rsa" > /dev/null
    fi
fi
