Giter Site home page Giter Site logo

voismart / git-jira-hook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thescom/git-jira-hook

0.0 3.0 0.0 337 KB

Scripts to make Jira (bug database) and git (source control) work together via SOAP

License: GNU General Public License v3.0

Python 100.00%

git-jira-hook's Introduction

Copyright (c) 2012-2014 Max Oberberger ([email protected])

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.


Status

Build Status

Table of Contents

  1. Introduction

  2. System Requirements

  3. Installation

  4. Using git-jira-hook

  5. Credits

  6. References

  7. Notes

  8. Introduction =============== The JIRA SOAP API ist not developed any more. It will be deprecated beginning with JIRA 5.x. Therefore I switched my git-hook from SOAP to REST. This repository includes the first version of the git hook for jira REST API. The main hook was moved to a new repo (git-jira-hook-REST) on github.

1.1 Get git and Jira to work in Harmony

If you are using git [1] for source control and Jira [2] for bug tracking, then the git-jira-hook script might be useful to you.

Once you have the script setup in your environment, every time you make a git commit, a comment is automatically posted to an open issue in Jira.

This script will also "enforce" that for every git commit, you have at least one Jira issue that you are referencing.

This way you have a paper trail of the history behind each and every git commit.

This is particularly useful for corporate git repositories.

1.2 Example use

In order to specify which issue (or issues) you want the commit message to get tracked to in Jira, you place magic text markers such as:

"NNN"

anywhere in your commit message, where "NNN" is the name of an open Jira issue.

For example, say you have typed in the following commit message in your git repository.

Hey look! This is my first git-commit

Using the new and fresh git-jira-hook

SW-189, HW-278 

The following things will happen:

In your Jira bug database, for projects named "TST", "HW" and "FW" in Jira, for issue numbers "SW-189", "HW-278", and "FW-702", the following comments will be added:

commit 424daa955f5c8a17aab9d524071f65f1999769a9
Author: Max Oberberger <[email protected]>
Date: Tue Aug 21 17:12:39 2012 +0200

Hey look! This is my first git-commit

Using the new and fresh git-jira-hook

SW-189, HW-278

1.3 Wait! there's more

If your git repository is exposed using gitweb [3], an hyperlink linking to the exact commit will also be embedded in the Jira issue comment that was added. This enables anyone to examine your git commit simply by clicking on the hyperlink.

  1. System Requirements ======================
  • Python 2.x and python modules: SOAPpy, ConfigParser. I have tested with Python 2.5.2.
  • git version 1.6.x.y (I have tested with 1.6.0.4).
  • Linux or some other similar Unix flavor (I have tested with Ubuntu 12.03 LTS).
  • Python 2.x and python modules: jira-python (available at Bitbucket: https://bitbucket.org/bspeakmon/jira-python) I have tested with Python 2.7.4.
  • A Jira installation with Remote APIs enabled.
  • OPTIONAL, but Highly recommended: gitweb [4] which has been setup with "upstream" git repositories.
  1. Installation =============== Here is a typical example of how this hook may be used.

In a corporate setting where git is used, there is typically an "upstream" or "public" repository. And then developers have their "private" repositories. For their day-to-day work, the developers use their private repositories. Periodically, they (either directly, or via gatekeepers) push changes from their private repository to the "upstream" one. Also, the "upstream" repository is typically a bare repository, and no actual commits are done here.

The hook is completely installed in the "upstream" repository. In my case I have a special "commit"-User. With this User it is easier to filter "commit"-emails from jira. Therefore you must insert a username and a password of the "commit"-User in the hook.

Whenever a commit is made in the upstream repository or a "git push" is done to it, the installed hook will kick in and validate the commit message, followed by update of the Jira issue.

3.1 Installation for "upstream" repository

  • Copy this script to upstream-repo-GIT-dir/hooks/{pre-receive|update|post-receive} and mark it executable

    Example:
     chmod +x git-jira-hook
     cp git-jira-hook upstream-project.git/hooks/pre-receive
     cp git-jira-hook upstream-project.git/hooks/update
     cp git-jira-hook upstream-project.git/hooks/post-receive
    

See the "Frequently Asked Questions" section to figure out what values to use for your "jira.url" and "gitweb.url"

  1. Using git-jira-hook ====================== When you are read to make a git commit, make sure that you have an appropriate open jira issue. There can be more than one open issues. Lets say this commit deals with Jira issues FOO-23 and BAR-42 and also marks FOO-56 as resolved.

Anywhere in your commit message, you must put the following strings (without the quotes): "FOO-23" "BAR-42"

And then, at a later time, when you do "git push" to push your changes upstream, the final validation and Jira issue update will be done.

  1. Credits ========== This script was inspired by the following:
  1. References ============= [1] Git, an source configuratiin management ("SCM") tool http://git-scm.com/

[2] Jira, a bug tracking system http://www.atlassian.com/software/jira

[3] Gitweb, a web based browser for git http://git.or.cz/gitwiki/Gitweb

  1. Notes =============

git-jira-hook's People

Contributors

chiemseesurfer avatar gb96 avatar

Watchers

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