Coder Social home page Coder Social logo

jlleitschuh / gitlab-jira-integration Goto Github PK

View Code? Open in Web Editor NEW

This project forked from akraxx/gitlab-jira-integration

0.0 2.0 0.0 155 KB

WebService which intercept hook events from gitlab and use JIRA REST api to interact with issues.

License: MIT License

Java 100.00%

gitlab-jira-integration's Introduction

gitlab-jira-integration

Build Status Coverage Status License Maven Central Issue Stats

If you are using GitLab Community Edition and you want to fully integrate gitlab with JIRA (ie. comment issues), you can use this project. It's a standalone java service which provides endpoints to intercepts hook events from gitlab and use JIRA REST api to interacts with issues.

Requirements

  • A JVM (jdk 8)
  • An account on JIRA which can comment issues on projects
  • An account on gitlab to have a private_token (admin rights are not required)

How to use

  • Download the fatjar gitlab-jira-integration-application from maven central
  • Create a yaml file as follow and configure it
server:
  applicationConnectors:
    - type: http
      port: 9090

  adminConnectors:
    - type: http
      port: 9091

logging:
  appenders:
    - type: console
      logFormat: "%-5p [%d{ISO8601,UTC}] [%thread] [%c{5}] %m%n%rEx"
      
password: test-password

jira:
  username: gitlab
  password: gitlab
  url: http://localhost:8090

gitlab:
  private_token: N1bJ4n8-rbFAEf8Syrh2
  url: http://192.168.59.104:8080
  
  • Launch your JAR like this : java -jar gitlab-jira-integration-application.jar server properties.yml

If everything is ok you should have something like this in your console :

INFO  [2015-10-10 17:48:43,361] [main] [i.d.j.DropwizardResourceConfig] [hookId:-] : The following paths were found for the configured resources:

    POST    /hook (fr.mmarie.resources.HookResource)

INFO  [2015-10-10 17:48:43,365] [main] [o.e.j.s.h.ContextHandler] [hookId:-] : Started i.d.j.MutableServletContextHandler@43a0a32d{/,null,AVAILABLE}
INFO  [2015-10-10 17:48:43,371] [main] [i.d.s.AdminEnvironment] [hookId:-] : tasks = 

    POST    /tasks/log-level (io.dropwizard.servlets.tasks.LogConfigurationTask)
    POST    /tasks/gc (io.dropwizard.servlets.tasks.GarbageCollectionTask)

INFO  [2015-10-10 17:48:43,376] [main] [o.e.j.s.h.ContextHandler] [hookId:-] : Started i.d.j.MutableServletContextHandler@5aaaa446{/,null,AVAILABLE}
INFO  [2015-10-10 17:48:43,394] [main] [o.e.j.s.ServerConnector] [hookId:-] : Started application@794b435f{HTTP/1.1}{0.0.0.0:9090}
INFO  [2015-10-10 17:48:43,398] [main] [o.e.j.s.ServerConnector] [hookId:-] : Started admin@38f2e97e{HTTP/1.1}{0.0.0.0:9091}
INFO  [2015-10-10 17:48:43,399] [main] [o.e.j.s.Server] [hookId:-] : Started @3812ms

You need to generate a token to authenticate your hook, format of the token is : [service:pwd] encoded in Base64, where service is any value you want to identify your gitlab hook, and password is the one defined in the YAML configuration file.

  • Add a new WebHook service in gitlab settings to : http://[IP/HOSTNAME]:9090/hook?token=[see above]

  • Commit messages with a JIRA issue prefixed by # will be mentionnd in issue comments. (For example : #TESTGIT-1)

Transitions

Since version 0.5.0 it's possible to perfom transition on JIRA issues (ie Close, Fix...) :

To do that, you need to add this part to your configuration :

jira:
  # Username, pwd...
  transitions:
    - name: Closed
      # Case insensitive
      keywords:
        - closed
        - closes
        - close
        - fixed
        - fixes
        - fix

Example of commit messages working with previous configuration :

Test Closes #TESGITLAB-3

Hello World FIX #TESGITLAB-15

This message will close both issues :

Hello World FIX #TESGITLAB-25 and Close #TESGITLAB-47

To edit your transitions in JIRA, take a look at the jira documentation

The change will be also commented in the jira issue activity to notify in which commit the issue has been closed (or any other transition)

Note : The default resolution will be taken, it only manage transition

Dependencies

gitlab-jira-integration's People

Contributors

akraxx avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.