Unknown macro: {next_previous_links}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 23 Next »

  1. Download Gitblit from http://gitblit.com/  

  2. Upload the zip file to the relevant machine.

  3. Unzip and open the configuration guide data/gitblit.properties.

  4. Set the server.httpPort and server.httpsPort ports to any suitable available ports and make sure that they are open to outside access.
    Example: 
    server.httpPort = 8280 and server.httpsPort = 8443 (or suitable available ports).

    The properties server.httpBindInterface and server.httpsBindInterface should be empty.

  5. 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

  6. Create a repository.
  7. 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.

  8. 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, the
    pull 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.

  1. Open data/gitblit.properties and add the following:

    groovy.scriptsFolder = <path_to_folder_with_script>

    This folder should contain groovy script with the .groovy extension.

  2. Add the script name to groovy.postRecieveScripts.
    This will add scripts common to all repositories.

    groovy.postRecieveScripts = <name_of_script>


  3. 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 Edit Repository menu, click Hook Scripts.

    • Select 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

      ArgumentDescription
      -k
      Allows insecure SSL connections and transfers.
      -X
      Specifies a custom request method which in this case is POST
      -dThe 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


  • No labels