You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.6 KiB
Bash
52 lines
1.6 KiB
Bash
5 years ago
|
#!/usr/bin/env bash
|
||
|
# vim:ts=4:sts=4:sw=4:et
|
||
|
#
|
||
|
# Author: Hari Sekhon
|
||
|
# Date: 2020-04-15 17:29:40 +0100 (Wed, 15 Apr 2020)
|
||
|
#
|
||
2 years ago
|
# https://github.com/HariSekhon/DevOps-Bash-tools
|
||
5 years ago
|
#
|
||
|
# License: see accompanying Hari Sekhon LICENSE file
|
||
|
#
|
||
|
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
|
||
|
#
|
||
2 years ago
|
# https://www.linkedin.com/in/HariSekhon
|
||
5 years ago
|
#
|
||
|
|
||
|
set -euo pipefail
|
||
|
[ -n "${DEBUG:-}" ] && set -x
|
||
|
srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
|
|
||
1 year ago
|
# shellcheck disable=SC1090,SC1091
|
||
5 years ago
|
. "$srcdir/lib/utils.sh"
|
||
|
|
||
5 years ago
|
# used by usage() in lib/utils.sh
|
||
|
# shellcheck disable=SC2034
|
||
|
usage_args="<project_id> [<curl_options>]"
|
||
|
|
||
5 years ago
|
# used by usage() in lib/utils.sh
|
||
|
# shellcheck disable=SC2034
|
||
|
usage_description="Returns recent Shippable build results for a given project
|
||
|
|
||
|
Specify the project ID as the first argument or have \$SHIPPABLE_PROJECT_ID environment variable defined
|
||
|
|
||
5 years ago
|
This works for free accounts whereas the adjacent shippable_builds.sh requires a paid account
|
||
|
|
||
|
This is the same API endpoints that shields.io uses for it's badges
|
||
|
|
||
|
The statusCode field returned has integers that correspond to statuses
|
||
|
|
||
|
http://docs.shippable.com/ci/build_status/
|
||
|
"
|
||
5 years ago
|
|
||
|
SHIPPABLE_PROJECT_ID="${1:-${SHIPPABLE_PROJECT_ID:-}}"
|
||
|
|
||
|
check_env_defined SHIPPABLE_PROJECT_ID
|
||
|
|
||
5 years ago
|
help_usage "$@"
|
||
5 years ago
|
|
||
|
# this will enforce a $SHIPPABLE_TOKEN which isn't necessary as this is a public endpoint
|
||
|
#"$srcdir/shippable_api.sh" "/projects/$SHIPPABLE_PROJECT_ID/branchRunStatus" "$@"
|
||
|
curl -sSH 'Accept: application/json' "https://api.shippable.com/projects/$SHIPPABLE_PROJECT_ID/branchRunStatus" "$@"
|
||
|
#jq -r "$jq_query"
|