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

Uploaded Python 3

File details

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

File metadata

  • Download URL: gitlab_jira_integration-0.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 c87d4d66bee88da0ceb04d060794916be2f830d228c510275be82caebd476ebf
MD5 0d910e1db911aaff7a3830dba078f8fb
BLAKE2b-256 8686988306f0a917e17ffb83fe9fb541b7813ebe2705dff5e4729c0833d3daff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gitlab_jira_integration-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f466d8c023d8535f4ab38549ce152fe25ecd0755ddb61f4324b943befda4eb9a
MD5 bd8b42faebd715b0d02cc2cf82854d80
BLAKE2b-256 4d67d2f09d4f51b63f8bee54eb8a5e61927150f3debb459e8473060207712ed2

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