64 lines
1.6 KiB
Bash
Executable File
64 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright (C) 2026 Red Hat, Inc.
|
|
# Written by:
|
|
# Andrew John Hughes <gnu.andrew@redhat.com>
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
# License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# Retrieve the results of a gating test using the ID from the JSON
|
|
# retrieved by query_build_gating.sh
|
|
|
|
RESULT_ID=${1}
|
|
|
|
if test "${RESULT_ID}" = ""; then
|
|
echo "No ID specified.";
|
|
echo "${0} <RESULT_ID>";
|
|
exit 1;
|
|
fi
|
|
|
|
CURL=$(command -v curl)
|
|
JSON_TOOL=$(command -v jq)
|
|
|
|
if test "${CURL}" = ""; then
|
|
echo "curl not found";
|
|
exit 2;
|
|
fi
|
|
|
|
if test "${JSON_TOOL}" = ""; then
|
|
echo "jq not found";
|
|
exit 3;
|
|
fi
|
|
|
|
URL="https://resultsdb-api.engineering.redhat.com/api/v2.0/results/${RESULT_ID}"
|
|
JSON_OUT=$(mktemp --tmpdir out.XXXXXX.json)
|
|
|
|
CMD=("${CURL}" --silent --show-error "${URL}")
|
|
|
|
echo "${CMD[@]}"
|
|
|
|
if command "${CMD[@]}" > "${JSON_OUT}" ; then
|
|
"${JSON_TOOL}" < "${JSON_OUT}"
|
|
else
|
|
echo "Failed to obtain JSON";
|
|
exit 4;
|
|
fi
|
|
|
|
# Local Variables:
|
|
# compile-command: "shellcheck get_gating_results.sh"
|
|
# fill-column: 80
|
|
# indent-tabs-mode: nil
|
|
# sh-basic-offset: 4
|
|
# End:
|