Skip to main content

GitLab Jira Integration

Python Version License: MIT PyPI Version

Automate Jira issue and subtask creation from GitLab CI/CD pipelines with dynamic content population from versioned files.

✨ Features

  • Template-based issue and subtask creation in Jira
  • Version-aware content population from files
  • Test mode for safe validation of issue creation
  • CI/CD ready with comprehensive environment variable support
  • Detailed reporting of all operations in test mode

🚀 Quick Start

Installation

pip install gitlab-jira-integration

Basic Usage

# Run in production mode
gitlab-jira-integration

# Run in test mode (no changes made, generates report)
export TEST_MODE=true
gitlab-jira-integration

📋 Configuration

Environment Variables

Variable Required Description
JIRA_URL URL of your Jira instance
JIRA_USER Jira username or email
JIRA_TOKEN Jira API token
GITLAB_TOKEN GitLab personal access token
VERSION Version to use for file lookups
VERSION_PATH Base directory for version files (default: ./versions)
TEST_MODE Set to true to enable test mode (default: false)
CI_PROJECT_ID Auto GitLab project ID
CI_COMMIT_REF_NAME Auto Git branch/tag name
CI_COMMIT_SHA Auto Git commit SHA

Configuration File

Create a .gitlab-jira-integration.yml file in your project root:

issue_types:
  RA: Release Automation
  Task: Task

templates:
  - name: release_task
    project: GMA
    issue_type: RA
    summary: "Atualizacao da aplicacao +Capital - {{ version }}"
    description: |
      h2. Atualizacao da aplicacao +Capital - {{ version }}

      *Release notes:*
      {{ release_notes_url }}
    custom_fields:
      customfield_10092: "{{ application_id }}"  # Application
      customfield_10093: "{{ environment_id }}"  # Environment
    subtasks:
      - name: "Deploy Frontend"
        summary: "[{{ version }}] Deploy Frontend"
        description: "Deploy the frontend application"
        issue_type: Task
        require_file: true
      - name: "Run Migrations"
        summary: "[{{ version }}] Run Database Migrations"
        description: "Execute database migrations"
        issue_type: Task
        require_file: false

🔍 How It Works

  1. Issue Creation: Creates a main Jira issue using the specified template
  2. File Lookup: For each subtask with require_file: true:
    • Looks in VERSION_PATH/VERSION/ for files matching the subtask name
    • Case-insensitive matching (e.g., "Deploy Frontend" matches "deploy_frontend.md")
  3. Subtask Creation: Creates subtasks, injecting file content when available
  4. Test Mode: When enabled:
    • No actual API calls to Jira/GitLab
    • Generates jira_integration_report.md with all operations

Example Report

# GitLab-Jira Integration Report

**Test Mode**: ✅ Enabled  
**Generated at**: 2025-07-28T14:30:45.123456

## Create Issue Operations

### Operation 1 - 2025-07-28T14:30:45.123456
```json
{
  "project": "GMA",
  "summary": "Atualizacao da aplicacao +Capital - v1.2.3",
  "description": "h2. Atualizacao da aplicacao - v1.2.3\n\n*Release notes:*\nhttps://jira.example.com/release/1.2.3",
  "issue_type": "Release Automation"
}

Create Subtask Operations

Operation 1 - 2025-07-28T14:30:45.234567

{
  "parent_issue_key": "GMA-123",
  "name": "Deploy Frontend",
  "summary": "[v1.2.3] Deploy Frontend",
  "file_found": true,
  "file_content": "Steps to deploy frontend..."
}

🛠️ Development

Installation from Source

git clone https://github.com/alairjt/gitlab-jira-integration.git
cd gitlab-jira-integration
pip install -e .

Running Tests

pip install -e ".[test]"
pytest

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📧 Contact

Alair Junior - @alairjt - alairjt@gmail.com

Release files for gitlab-jira-integration 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitlab-jira-integration 0.3.0
File Size Uploaded
gitlab_jira_integration-0.3.0.tar.gz 14.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gitlab-jira-integration 0.3.0
File Interpreter ABI Platform
gitlab_jira_integration-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.7 kB

Release files / gitlab_jira_integration-0.3.0.tar.gz

Download URL gitlab_jira_integration-0.3.0.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4b07f29704defc9147890bb17e87a401e33cbb149476d6ceef8ae3c20927e4a1
BLAKE2b-256 checksum
How to use checksums
ec565ee49d3d9bacb5bebd2e813e448a7c97fa2c038c5fda8297a3803afb194c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release files / gitlab_jira_integration-0.3.0-py3-none-any.whl

Download URL gitlab_jira_integration-0.3.0-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4301ab3ac170cdcf20db2c2c1c31bae43b825bffafc27c9f047a3b0d2d342831
BLAKE2b-256 checksum
How to use checksums
5b92e00b56dc7e9b8ec9065b9ef7148e82b7c7115e90d03ae19bb2b5f9a110fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page