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_SERVER 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
CI_MERGE_REQUEST_IID Auto Merge request ID

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.2.1.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.2.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gitlab_jira_integration-0.2.1.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.2.1.tar.gz
Algorithm Hash digest
SHA256 0d46d4273032c256a69e72fd25e87810a4458ecb681e2a3068235931455bde2b
MD5 ac4229e42736d527459e4d063e40d3e2
BLAKE2b-256 efac793492c3a36273b44541dca8d43b523370c41fc4e626bcfd42a987f97073

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gitlab_jira_integration-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ce067d2a703ad40984e7507e833e85057279cbe76308f39e156a4b17ef0b9c8
MD5 c878fea78c399df0e5520c0a861a932a
BLAKE2b-256 4e29b1817f0e77d69af92d755cafad439b4e1b68b56f5c0c6685ab06f1d9bd6c

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