David Caro has uploaded a new change for review. Change subject: Added hook to add the external tracker ......................................................................
Added hook to add the external tracker Change-Id: Idd5ba49d8a253a1fbd1ec6cd0073f53b47f81342 Signed-off-by: David Caro <dcaro...@redhat.com> --- A hooks/bz/patchset-created.bz.2.add_tracker 1 file changed, 51 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/gerrit-admin refs/changes/12/15912/1 diff --git a/hooks/bz/patchset-created.bz.2.add_tracker b/hooks/bz/patchset-created.bz.2.add_tracker new file mode 100755 index 0000000..a8dd679 --- /dev/null +++ b/hooks/bz/patchset-created.bz.2.add_tracker @@ -0,0 +1,51 @@ +#!/bin/bash +############################################################################### +# Adds an external bug to each bugzilla +# +# Config: +# TRACKER_ID +# Numeric id of the external tracker to add the bugs in, as seen in the +# bugzilla submit form. +# 81 -> oVirt gerrit +# 82 -> RHEV gerrit +############################################################################### +source bz.sh +source gerrit.sh +source conf.sh + +add_tracker() +{ + local bug_id="${1?}" + # Get the bug url and it's flags + bz.login -b "$bug_id" "$bz_user" "$bz_password" + ## Update the tracker on the bz bug + local message="$(conf.t_get message)" + if ! bz.add_tracker "$bug_id" "${TRACKER_ID?}" "${change_url//*\/}"; then + ## raise a warning error + message+="\n* Tracker #$bug_id: FAILED" + echo "WARNING: Failed to update tracker on bug #$bug_id for gerrit id #${change_url//*\/}" + else + message+="\n* Tracker #$bug_id: OK" + echo "Tracker updated on bug #$bug_id for gerrit id #${change_url//*\/}" + fi + conf.t_put message "$message" + return 0 +} + + +############################################################################### +## MAIN +## Parse the parameters +gerrit.parse_params "$@" + +## Parse the configuration +conf.load + +bz_user="${BZ_USER?No BZ_USER in the config file}" +bz_password="${BZ_PASS?No BZ_PASS in the config file}" + +bug_ids=($(bz.get_bug_id $commit)) +for bug_id in "${bug_ids[@]}"; do + add_tracker "$bug_id" +done +exit 0 -- To view, visit http://gerrit.ovirt.org/15912 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idd5ba49d8a253a1fbd1ec6cd0073f53b47f81342 Gerrit-PatchSet: 1 Gerrit-Project: gerrit-admin Gerrit-Branch: master Gerrit-Owner: David Caro <dcaro...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches