Client-Server Deploy and Setup
Garfio light Client is distributed as a JAR. It is a standalone application that can be launched from Subversion (SVN) repositories hooks (pre-commit and post-commit). It is also ready for communicating with Garfio Server through SOAP messsages. Garfio server accomplishes two goals:
- Works as a web application to allow administrators to add, edit or remove data related to different issue trackers and repositories in the organization.
- Provides web services that will be consumed by Garfio light Client in every commit.
Hooks
Garfio is based on the possibility of executing pre-commit and post-commit hooks in SVN repositories. In the pre-commit phase, Garfio only parses the message for validation but no action is executed on the issue tracker. In case of error, Garfio will prevent the commit from being executed and will inform the error to the user.
Actions over the issue tracker will be executed in the post-commit phase, after parsing the message again for retrieving all the information.
Let's see two possible hooks for a SVN repository:
pre-commit phase
File: pre-commit
This file should be installed in the hooks directory inside the repository. It will call Garfio script with all the necessary parameters.
# [1] REPOS-PATH (the path to this repository) # [2] TXN-NAME (the name of the txn about to be committed) REPOS="$1" TXN="$2" #Directory where the Garfio scripts live path=/home/user/garfio/scripts #Repository name created in the Garfio web application repo=test # Make sure that the log message contains some text. SVNLOOK=/usr/bin/svnlook $SVNLOOK log -t "$TXN" "$REPOS" | \ grep "[a-zA-Z0-9]" > /dev/null || exit 1 $path/do-pre.sh "$REPOS" "$TXN" $repo
File: do-pre.sh
This script will execute Garfio light Client in dry-run mode, just to validate the message (no action is taking place in the issue tracker).
REPOS="$1" REV="$2" name="$3" author="`svnlook author -t $REV $REPOS`" #The Path where the garfio client's jar lives path=/home/user/garfio/target #Garfio client's jar garfio=$path/garfio-client-X.X.X-jar-with-dependencies.jar #Properties file where the username and password properties of the Garfio Service are. PROPERTIES=/home/user/garfio/config/garfio.properties #GarfioService url url=http://localhost:9090/services/GarfioService svnlook log -t $REV $REPOS | java -jar $garfio -Dtrue -U"$author" -L$url -R$name -P$PROPERTIES
post-commit phase
File: post-commit
This file should be installed in the hooks directory inside the repository. It will call Garfio post commit script.
# [1] REPOS-PATH (the path to this repository) # [2] REV (the number of the revision just committed) REPOS="$1" REV="$2" #Directory where the Garfio scripts live path=/home/user/garfio/scripts #Repository name created in the Garfio web application repo=test $path/do.sh "$REPOS" "$REV" $repo
File: do.sh
This script will execute Garfio light Client to perform all the required actions on the issue tracker.
REPOS="$1" REV="$2" name="$3" author="`svnlook author -r $REV $REPOS`" #The Path where the garfio client's jar lives path=/home/user/garfio/target #Garfio client's jar garfio=$path/garfio-client-X.X.X-jar-with-dependencies.jar #Properties file where the username and password properties of the Garfio Service are. PROPERTIES=/home/user/garfio/config/garfio.properties #GarfioService url url=http://localhost:9090/services/GarfioService LC_ALL=es_AR svnlook log -r $REV $REPOS | LC_ALL=es_AR java -jar $garfio -Dfalse -N$REV -U"$author" -L$url -R$name -P$PROPERTIES & #For remote debuging: #-Xdebug -Xmx100m -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4090,server=y,suspend=y
Server
For details about server setup and configuring, please see GarfioEnQuickStart .
