Skip to main content

GitLab Jira Integration

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitlab_jira_integration-0.3.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitlab_jira_integration-0.3.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file gitlab_jira_integration-0.3.0.tar.gz.

File metadata

  • Download URL: gitlab_jira_integration-0.3.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for gitlab_jira_integration-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4b07f29704defc9147890bb17e87a401e33cbb149476d6ceef8ae3c20927e4a1
MD5 9f65c0b471c4bad2f89e73d0f5a2ec66
BLAKE2b-256 ec565ee49d3d9bacb5bebd2e813e448a7c97fa2c038c5fda8297a3803afb194c

See more details on using hashes here.

File details

Details for the file gitlab_jira_integration-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gitlab_jira_integration-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4301ab3ac170cdcf20db2c2c1c31bae43b825bffafc27c9f047a3b0d2d342831
MD5 75dfea31ebe5ccb26f03bc4b94320b1a
BLAKE2b-256 5b92e00b56dc7e9b8ec9065b9ef7148e82b7c7115e90d03ae19bb2b5f9a110fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page