Jenkins, Kerberos and curl

Want to use curl to talk to a kerberos enabled jenkins?

set -o errexit -o errtrace -o nounset -o pipefail

cleanup() {
	[ -n "${COOKIES-}" ] && unlink "${COOKIES}"

trap cleanup EXIT

export COOKIES=$( mktemp )


curl -c "$COOKIES" --negotiate -u : https://$HOST/login -I

export CURL="curl -b $COOKIES -c $COOKIES"
export URL="https://$HOST"
echo "I: spawing shell with session cookie for '$HOST'"
echo 'I: cookie jar available via $CURL: '$CURL
echo 'I: hostname via $URL: '$URL