Chapter 12. Repository hooks
In Decision Central, you can use scripts, known as hooks, to configure the repository to trigger a specified action every time a particular event happens.
12.1. Configuring git hooks
Decision Central can automatically push changes to a remote repository using Git hooks. After you configure the post-commit hook, Decision Central automatically pushes your changes to the remote repository.
Currently only post-commit hooks are supported. Post-commit hooks are triggered after the commit process finishes.
Prerequisites
- Red Hat Decision Manager projects exist in an external Git repository.
- Credentials required for read access to that external Git repository are available.
Procedure
- Log in to Decision Central.
- Go to Menu → Projects.
- Select or create the space into which you want to import the projects.
-
Click
on the right side of the screen and select Import Project.
In the Import Project window, enter the URL (for example,
https://github.com/USERNAME/REPOSITORY_NAME.git) and credentials for the Git repository that contains the project that you want to import and click Import.The project is added to the Decision Central Git repository and is available in the created or default space.
ImportantUse the HTTPS or Git protocol instead of a SCP-style SSH URL. Decision Central does not support the basic SSH URL and an error appears if you use this URL.
In a terminal window, change to the created repository.
cd JBOSS_HOME/bin/.niogit/REPOSITORY_NAME.git
Create the
post-commitfile in theJBOSS_HOME/bin/.niogit/REPOSITORY_NAME.git/hooksdirectory, set the permissions torwxr—r--and add the following content:#!/bin/sh git push origin master
Make sure that the configuration was successful by creating a new guided rule in Decision Central:
- Go to Menu → Projects → Add Asset → Guided Rule.
- Fill in the required information in the displayed Create new Guided Rule window.
Click Ok.
Decision Central automatically pushes all changes to the remote repository.
You can also specify the org.uberfire.nio.git.hooks system property. Specify a directory with default hook files as the value for this property. This directory will be copied to the newly created Git repositories. See the following example of a standalone.xml file with this setting below:
<system-properties> <property name="org.uberfire.nio.git.hooks" value="/opt/jboss-as/git-hooks"> </property> ... </system-properties>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.