porcelli / bc-git-integration-push

13 stars 20 forks source link

Business Central post-commit Git Hooks Integration

This is a sample project that shows how to setup Business Central to automatically push every content change to GitHub.

New Integrations:

New Features

How to build

Clone this repository and build it locally, for this you need Git, Maven and JDK 8.

$ git clone https://github.com/porcelli/bc-git-integration-push.git
$ cd bc-git-integration-push
$ mvn clean install
$ mkdir -p $APP_SERVER_HOME/hooks/ && cp target/git-push-2.1-SNAPSHOT.jar $APP_SERVER_HOME/hooks/

How to setup

The application uses a configuration file .gitremote that is located under the user home directory, if you don’t want to start from scratch, you can start running the jar file for the first time after the setup above or just as java -jar git-push-2.1-SNAPSHOT.jar, the application will generate a template configuration file in $HOME/.gitremote that you can follow and modify.

Example “.gitremote”

#This is an auto generated template empty property file
provider=GIT_HUB
login=
password=
token=
remoteGitUrl=https://api.github.com/
useSSH=false
ignore=.*demo.*, test.*
githubOrg=OrgName
gitlabGroup=Group/subgroup
bitbucketTeam=TeamName

Parameters:

Note:

Enabling and Running

Create a post-commit hook template for Business Central and, finally, start the Business Central with the org.uberfire.nio.git.hooks properly set.

$ cd $APP_SERVER_HOME
$ echo "#\!/bin/bash\njava -jar $APP_SERVER_HOME/hooks/git-push-2.1-SNAPSHOT.jar" > hooks/post-commit
$ chmod 755 hooks/post-commit
$ ./bin/standalone.sh -c standalone-full.xml -Dorg.uberfire.nio.git.hooks=$APP_SERVER_HOME/hooks/

Important note: remember to replace $APP_SERVER_HOME by the real path of your application server home, in my case: $HOME/jboss-eap-7.2/.

Contributors

Spacial thank you for AlyIbrahim for all valuable enhancements.

License

This code is released under Apache 2 License.

Check LICENSE file for more information.