Join Wintertainment 2021 to share your stories, have fun, earn community badges, and more!

ccollab admin trigger ensure-review-started (for Git)

Applies to Collaborator 13.9, last modified on November 04, 2021

Description

Use the ensure-review-started trigger to ensure that a review for the specified changelist has been started. The trigger blocks the submit operation if there is no review for the changelist in Collaborator, and displays an error message telling that the changes need to be reviewed before submitting them to the Git repository.

Command Line Syntax

ccollab [global-options] admin trigger ensure-review-started [--review-id-regex <value>] <changelist-id>

Command Options

Option

Required?

Description

<changelist-id>

Yes

The changelist identifier.

--review-id-regex <value>

No

A regular expression that identifies the review ID in the commit comment.

Installation

To install this trigger, you will typically create an update hook. If you already have an update hook, you can add our tool wherever it is appropriate; otherwise you will need to create an executable hook as described in the Git documentation. The update hook should iterate over the commits being pushed and call this trigger for each one of them, and then exit with a non-zero exit code if any of the trigger invocations failed.

Example shell script:

#!/bin/sh

refname="$1"

oldrev="$2"

newrev="$3"

for commit in `git rev-list $oldrev..$newrev -- ''`

do

  /collab/install/ccollab --url <collabUrl> --user <collabUser> --password <collabPasswd> --scm git admin trigger ensure-review-started $commit

  exitcode=$(($exitcode + $?))

done

exit $exitcode

Note our use of "exit" to ensure that the hook script terminates with a non-zero exit code if our trigger rejects one of the commits.

See Also

ccollab admin trigger ensure-review-started
Git Integration

Highlight search results