lesstif / gitlab-jira-integration
This is the advanced integrator GitLab CE(Community Edition) and Atlassian's JIRA.
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 68
Watchers: 11
Forks: 23
Open Issues: 3
Type:project
Requires
- guzzlehttp/guzzle: ~6.0
- laravel/lumen: 5.1.*
- league/flysystem: ^1.0
- lesstif/php-jira-rest-client: ^1.4
Requires (Dev)
- fzaninotto/faker: ~1.0
- phpunit/phpunit: ~4.4
This package is auto-updated.
Last update: 2021-11-26 22:00:12 UTC
README
What is it?
- JIRA DVCS Connector Plugin does not support gitlab.
- GitLab Community Edition does not support Advanced JIRA Integration(EE only feature).
Note
GitLab 8.3 now supported Advanced JIRA Integration in CE. see https://about.gitlab.com/2015/12/22/gitlab-8-3-released/
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.
How it works.
Requirements
- PHP >= 5.5.9
- Lumen framework >= 5.1
- php-jira-rest-client
- Atlassian JIRA 6 or above
- Gitlab CE 6 or above
Installation
-
Download and Install PHP Composer.
curl -sS https://getcomposer.org/installer | php
-
clonning gitlab-jira-intergration project
$ git clone https://github.com/lesstif/gitlab-jira-integration.git
-
Run the composer install command.
$ composer install
-
Now you need define your a Jira and Gitlab connection info into
.env
configuration.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.
Next, copy config.integration.example.json to config.integration.json
.
$ cp config.integration.example.json config.integration.json
Here is the default configuration, for interact with Jira.
{ "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).
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)
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:
$app->post('gitlab/hook',[ 'as' => 'hook', 'uses' => 'GitlabController@hookHandler' ]);
change to 'gitlab/hook' to desired the URI (eg: 'gitlab/my-hook-receiver')
Batch gitlab webhook registration.
-
modify 'url' field and save to hook.json
{ "project_id": 5, "url": "https://localhost:9000/gitlab/hook/", "push_events": true, "issues_events": false, "merge_requests_events": true, "tag_push_events": true }
-
modify url(ttp://my-host.com:9000/) to your url and running curl command
curl -X POST -d @hook.json http://my-host.com:9000/gitlab/projects/add-hook-all-projects
-
login gitlab and goto Choose > Project Settings -> Web Hooks. Then confirm your web hook settings.
Checking Installation
-
To get started, let's running a curl command on your command line.
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" } }
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.
License
Apache V2 License