The SSH private key must be in standard PEM format to be accepted by TeamCity (generated via 'ssh-keygen -m PEM') rather than new non-standard OpenSSH format
# defaults to the Root project because this is the best place to use external VCS connections and auth from, to prevent them being reset and broken by import from VCS which by default excludes secrets
project_id="${3:-_Root}"
url_path=""
if[ -n "${TEAMCITY_URL:-}"];then
url_base="${TEAMCITY_URL%%/}"
else
protocol="http"
if[ -n "${TEAMCITY_SSL:-}"];then
protocol="https"
fi
[ -n "${TEAMCITY_HOST:-}"]|| usage "neither \$TEAMCITY_URL nor \$TEAMCITY_HOST defined in environment"
host="$TEAMCITY_HOST"
port="${TEAMCITY_PORT:-8111}"
url_base="$protocol://$host:$port"
fi
teamcity_curl_auth(){
localurl_path="$1"
shift|| :
localcurl_opts=(-sS --fail --connect-timeout 5)
# use superuser token override to support teamcity.sh when token has already been created but we cannot get it's key value out of the API, so need to continue using superuser token
if[ -n "${TEAMCITY_SUPERUSER_TOKEN:-}"];then
# XXX: superuser token can only be used with blank user which cannot be used with curl_auth.sh