2017 © Pedro Peláez
 

project gitlab-jira-integration

This is the advanced integrator GitLab CE(Community Edition) and Atlassian's JIRA.

image

lesstif/gitlab-jira-integration

This is the advanced integrator GitLab CE(Community Edition) and Atlassian's JIRA.

  • Friday, January 26, 2018
  • by lesstif
  • Repository
  • 10 Watchers
  • 67 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 21 Forks
  • 2 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

GitLab JIRA Integration

What is it?

Note

GitLab 8.3 now supported Advanced JIRA Integration in CE. see https://about.gitlab.com/2015/12/22/gitlab-8-3-released/, (*1)

GitLab-JIRA-Integration is a small PHP standalone app executed by gitlab web hooks and interact with JIRA using JIRA-REST API. If you have questions contact to me or open an issue on GitHub., (*2)

How it works.

How it works., (*3)

Requirements

  • PHP >= 5.5.9
  • Lumen framework >= 5.1
  • php-jira-rest-client
  • Atlassian JIRA 6 or above
  • Gitlab CE 6 or above

Installation

  1. Download and Install PHP Composer. sh curl -sS https://getcomposer.org/installer | php, (*4)

  2. clonning gitlab-jira-intergration project, (*5)

    $ git clone https://github.com/lesstif/gitlab-jira-integration.git
    
  3. Run the composer install command., (*6)

    $ composer install
    
  4. Now you need define your a Jira and Gitlab connection info into .env configuration., (*7)

    JIRA_HOST="https://your-jira.host.com"
    JIRA_USER="jira-username"
    JIRA_PASS="jira-password"
    GITLAB_HOST="https://your-gitlab.host.com"
    GITLAB_TOKEN="gitlab-private-token-for-api"
    

Tip: In the following steps, you will generate your private token for API. - login gitlab and click on Profile Settings - Click on Account - Here, You can find your private token. Private Token, (*8)

Next, copy config.integration.example.json to config.integration.json., (*9)

$ cp config.integration.example.json config.integration.json

Here is the default configuration, for interact with Jira., (*10)

{
    "accept.host": [
        "localhost",
        "your-gitlab-host-here"
    ],
    "transition": {
        "message": "[~%s] Issue %s with %s",
        "keywords": [
            [
                "Resolved",
                "[resolve|fix]"
            ],
            [
                "Closed",
                "[close]"
            ]
        ]
    },
    "referencing": {
        "message": "[~%s] mentioned this issue in %s"
    },
    "merging": {
        "message": "[~%s] COMMIT_MESSAGE with %s"
    }
}

transition

  • message : "[~%s] issue %s with %s" : Converted to "User Issue Resolved with Commit URL"
  • keywords: if commit message had second element(eg: resolve or fix),then issue status transition to first element.(eg : Resolved)

Usage

Run PHP standalone web server on the gitlab-jira integration server. (eg: my-host.com)., (*11)

php artisan serve --host 0.0.0.0 --port 9000

Configuration

gitlab web hook configuration

  • Choose > Project Settings -> Web Hooks.
  • Setting URL to your gitlab-jira integration's running Host. (eg: http://my-host.com:9000/gitlab/hook) gitlab configuration.

Tip: If you decide to change the hook receiving URI from the default, Open the app/Http/routes.php file in a text editor and find this line:, (*12)

$app->post('gitlab/hook',[
    'as' => 'hook', 'uses' => 'GitlabController@hookHandler'
]);

change to 'gitlab/hook' to desired the URI (eg: 'gitlab/my-hook-receiver'), (*13)

Batch gitlab webhook registration.

  1. modify 'url' field and save to hook.json, (*14)

    {
    "project_id": 5,
    "url": "https://localhost:9000/gitlab/hook/",
    "push_events": true,
    "issues_events": false,
    "merge_requests_events": true,
    "tag_push_events": true
    }
    
  2. modify url(ttp://my-host.com:9000/) to your url and running curl command, (*15)

    curl -X POST -d @hook.json http://my-host.com:9000/gitlab/projects/add-hook-all-projects
    
  3. login gitlab and goto Choose > Project Settings -> Web Hooks. Then confirm your web hook settings., (*16)

Checking Installation

  1. To get started, let's running a curl command on your command line., (*17)

    curl http://myhost.com:9000/gitlab/user/list
    

    You can see response json data including gitlab user list and created user list file to 'storage/app/users.json'. json { "1234": { "name": "KwangSeob Jeong", "username": "lesstif", "state": "active" } }, (*18)

Usage

Referencing JIRA isssues

  • git commit with JIRA Issue Key(eg. TEST-123 or test-123)
  • Gitlab-Jira-Integrator will automatically add a comment in specific JIRA Issue.

Resolving or Closing JIRA isssues

  • git commit with JIRA Issue Key and trigger keywords(eg. 'Closed TEST-123' or 'fix test-123')
  • Gitlab-Jira-Integrator will automatically add a comment and closing(or fixing) directly in specific JIRA Issue by using trigger keywords(setting in config.integration.json) in commit message.

Issue Time Tracking

not yet implemented., (*19)

License

Apache V2 License, (*20)

See Also

The Versions

26/01 2018

dev-master

9999999-dev

This is the advanced integrator GitLab CE(Community Edition) and Atlassian's JIRA.

  Sources   Download

Apache-2.0 Apache 2.0

The Requires

 

The Development Requires

jira gitlab gitlab-ce jira-gitlab jira-gitlab-inte

26/01 2018

dev-develop

dev-develop

This is the advanced integrator GitLab CE(Community Edition) and Atlassian's JIRA.

  Sources   Download

Apache-2.0 Apache 2.0

The Requires

 

The Development Requires

jira gitlab gitlab-ce jira-gitlab jira-gitlab-inte

27/08 2015

0.7.0

0.7.0.0

This is the advanced integrator GitLab CE(Community Edition) and Atlassian's JIRA.

  Sources   Download

Apache 2.0

The Requires

 

The Development Requires

jira gitlab gitlab-ce jira-gitlab jira-gitlab-inte

26/08 2015

0.6.3

0.6.3.0

This is the advanced integrator GitLab CE(Community Edition) and Atlassian's JIRA.

  Sources   Download

Apache 2.0

The Requires

 

The Development Requires

jira gitlab gitlab-ce jira-gitlab jira-gitlab-inte

20/07 2015

0.6.2

0.6.2.0

This is the advanced integrator GitLab CE(Community Edition) and Atlassian's JIRA.

  Sources   Download

Apache 2.0

The Requires

 

The Development Requires

jira gitlab gitlab-ce jira-gitlab jira-gitlab-inte

12/07 2015

0.6.1

0.6.1.0

This is the advanced integrator GitLab CE(Community Edition) and Atlassian's JIRA.

  Sources   Download

Apache 2.0

The Requires

 

The Development Requires

jira gitlab gitlab-ce jira-gitlab jira-gitlab-inte

12/07 2015

0.6

0.6.0.0

This is the advanced integrator GitLab CE(Community Edition) and Atlassian's JIRA.

  Sources   Download

Apache 2.0

The Requires

 

The Development Requires

jira gitlab gitlab-ce jira-gitlab jira-gitlab-inte

17/06 2015

0.5.1

0.5.1.0

This is the advanced integrator GitLab CE(Community Edition) and Atlassian's JIRA.

  Sources   Download

Apache 2.0

The Requires

 

The Development Requires

jira gitlab gitlab-ce jira-gitlab jira-gitlab-inte

17/06 2015

0.5

0.5.0.0

This is the advanced integrator GitLab CE(Community Edition) and Atlassian's JIRA.

  Sources   Download

Apache 2.0

The Requires

 

The Development Requires

jira gitlab gitlab-ce jira-gitlab jira-gitlab-inte