chain-build.sh: Fix posting summary to Bugzilla.

This commit is contained in:
Peter Oliver 2025-02-19 15:20:30 +00:00
commit 2765eae9d4

View file

@ -52,10 +52,21 @@ fi
function create_authorization_header_file {
local type="$1"
local filename="${tmp_dir}/${type}_authorization"
local auth_type
case "$type" in
bugzilla)
auth_type=Bearer
;;
distgit)
auth_type=token
;;
esac
if [[ ! -f "$filename" ]]; then
(
umask u=rwx,g=,o=
printf 'Authorization: token ' > "$filename"
printf 'Authorization: $auth_type ' > "$filename"
if ! crudini --get ~/.config/rpkg/fedpkg.conf "fedpkg.$type" token \
>> "$filename"
then
@ -187,8 +198,9 @@ done
# fedpkg chain-build --target="$side_tag" : $packages
# bodhi updates new --from-tag "$@" "$side_tag"
summary="Tree-sitter and dependent packages are being rebuilt. Completed
builds will appear at:
summary="Tree-sitter and dependent packages are being rebuilt for
$verrel in side tag $side_tag. Completed builds
will appear at:
https://koji.fedoraproject.org/koji/builds?inherited=0&tagID=${side_tag##*-}
There should be builds for each of:
@ -211,8 +223,9 @@ if [[ -n $bug ]]; then
curl \
--fail-with-body \
--header @"$tmp_dir/bugzilla_authorization" \
--json "{\"id\": \"$bug\", \"comment\": \"$summary\"}" \
"https://bugzilla.redhat.com//rest/bug/$bug/comment"
--variable "summary=$summary" \
--expand-json "{\"id\": \"$bug\", \"comment\": \"{{summary:json}}\"}" \
"https://bugzilla.redhat.com/rest/bug/$bug/comment"
fi
# Clean up.