Creates a TeamCity BuildType (build pipeline) from a local JSON configuration file
Uses the adjacent teamcity_api.sh
See teamcity_api.sh for required connection settings and authentication
"
# used by usage() in lib/utils.sh
# shellcheck disable=SC2034
usage_args="<build.json>"
help_usage "$@"
min_args 1"$@"
build_file="$1"
if ! [ -f "$build_file"];then
die "ERROR: build file '$build_file' does not exit"
fi
if ! jq < "$build_file" > /dev/null;then
die "ERROR: build file '$build_file' is not valid json"
fi
# XXX: technically this could have a different project ID and project name, in which case this won't work, they're assumed to usually be the same - if this is the case you must create the Project by hand, this should error out on the last line with an error if you've created your project name and id to be different
# Update: unfortunately removing --fail causes curl to not error out properly, so other scripts that depend on this would not be notified of the failure, so only do this when debugging
#export CURL_OPTS="-sS" # this overrides teamcity_api.sh to not include --fail so we can get decent error messages here