Configuring a Git Server
Download Gitblit from http://gitblit.com/
Upload the zip file to the relevant machine.
Unzip and open the configuration guide
data/gitblit.properties
.Set the
server.httpPort
andserver.httpsPort
ports to any suitable available ports and make sure that they are open to outside access.
Example:
server.httpPort = 8280
andserver.httpsPort
= 8443 .
The propertiesserver.httpBindInterface
andserver.httpsBindInterface
should be empty.
Navigate to the parent directory and run the following command:
java -jar gitblit.jar --baseFolder data
Now you can access the gitblit server from
<machine ip>:<http port>
. For a complete setup guide go to http://gitblit.com/setup.html- Create a repository.
Add a user to the repository.
Click on the repository name to obtain the URL of the repository.
Example:
Git repo url: http://75.101.228.144:8080/git/s2-beta-test.git .
75.101.228.144 is the IP of the instance.
8080 is the http port
Currently only http external Git repository URLs are supported and the URL should not contain the username.
- Initialize the repository by cloning it into your local machine, add an initial commit and push it to the repository.
See the README.txt file for an example. If the repository is not cloned, thepull
commands will fail.
Adding a post commit hook
A post commit hook should be added to the Git repository to notify commit events to Stratos Controller. Gitblit supports groovy scripts for execution after an artifact is pushed to the repository.
Open
data/gitblit.properties
and addthe following:
groovy.scriptsFolder = <path_to_folder_with_script>
This folder should contain groovy script with the
.groovy
extension.Add the script name to
groovy.postRecieveScripts
.
This will add scripts common to all repositories.
groovy.postRecieveScripts = <name_of_script>
If you wish to add a repository specific scripts:
For more details go to http://gitblit.com/setup.html and see the Groovy Hook Scripts section .
Remove the entry from
groovy.postRecieveScripts
.On the E dit Repository menu, click Hook Scripts.
S elect the relevant script.
The script should contain a curl call with the repository URL to the repository notification service in Stratos Controller.
Sample script:
#!/usr/bin/env groovy def response = "curl -k -X POST https://75.101.228.144:9445/repo_notification -d payload={'repository':{'url':'http://75.101.228.144:8080/git/s2-beta-test.git'}}".execute().text println response
Argument Description
Argument Description -k
Allows insecure SSL connections and transfers. -X
Specifies a custom request method which in this case is POST -d The data to be sent with the request.
JSON format string which includes the repository URL.
Example:
payload={'repository':{'url':'http://75.101.228.144:8080/git/s2-beta-test.git'}}The following is the POST end point reference for the repository notification service
Example:
https://75.101.228.144:9445/repo_notification