Migrating Issue Dependencies and Assignments from Pagure.io to Fedora Forge
DRAFT DOCUMENTATION: This documentation is currently in draft form and may not be fully tested and correct. Please verify all procedures before use and report any issues or inaccuracies. |
Purpose
This document provides a comprehensive guide for using the assign_and_depend.py
script to restore issue dependencies and assignments after migrating a project from Pagure.io to Fedora Forge. The built-in migrator does not handle this critical metadata, making this script an essential post-migration step.
Scope
This guide applies to Fedora Project contributors who have migrated their projects from Pagure.io to Fedora Forge and need to restore:
-
Issue assignments (who is assigned to work on each issue)
-
Issue dependencies (which issues depend on other issues)
Prerequisites
-
Migrated Project: Your project must already be migrated from Pagure.io to Fedora Forge
-
Python Environment: Python 3.6 or later with pip installed
-
Required Dependencies: The following Python packages must be installed:
-
requests
- For making HTTP requests to Pagure API -
backoff
- For retry logic with exponential backoff -
click
- For command-line interface -
pyforgejo
- For interacting with Forgejo API
-
-
API Access:
-
Forgejo API key with write permissions to the target repository
-
Access to Pagure.io API (publicly accessible)
-
Installation
Installing Required Dependencies
It’s recommended to use a Python virtual environment to avoid conflicts with system packages. Create and activate a virtual environment, then install the required packages:
python -m venv migration-env
source migration-env/bin/activate
pip install requests backoff click pyforgejo
When you’re done with the migration, you can deactivate the virtual environment:
deactivate
Obtaining Required Information
Forgejo API Key
To obtain a Forgejo API key:
-
Log in to your Fedora Forge account
-
Navigate to your user settings (click your avatar in the top-right corner)
-
Go to "Applications" → "Generate New Token"
-
Give your token a descriptive name (e.g., "Migration Script")
-
Select the appropriate scopes:
-
repo
- Required for reading and writing repository data -
user
- Required for user-related operations
-
-
Click "Generate Token"
-
Copy the generated token and store it securely
Keep your API key secure and never commit it to version control. Consider using environment variables or a secure configuration file. |
Usage
Basic Command Structure
The script uses the following command structure:
python assign_and_depend.py \
--pagure-project "PAGURE_PROJECT_NAME" \
--forgejo-api-key "YOUR_API_KEY" \
--forgejo-project "FORGEJO_PROJECT_NAME"
Command-Line Options
-
--pagure-base-url
: Base URL for Pagure API (default:https://pagure.io/api/0
) -
--pagure-project
: Pagure project name, including namespace if applicable (required) -
--forgejo-base-url
: Base URL for Forgejo API (default:https://forge.fedoraproject.org/api/v1
) -
--forgejo-api-key
: Your Forgejo API key (required) -
--forgejo-project
: Forgejo project name in formatorganization/project
(required)
Example Usage
Example 1: Basic Migration
python assign_and_depend.py \
--pagure-project "fedora-infra/ansible" \
--forgejo-api-key "gitea_abc123def456..." \
--forgejo-project "infrastructure/fedora-infrastructure"
Example 2: Using Environment Variables
For security, you can use environment variables:
export FORGEJO_API_KEY="gitea_abc123def456..."
python assign_and_depend.py \
--pagure-project "fedora-infra/ansible" \
--forgejo-api-key "$FORGEJO_API_KEY" \
--forgejo-project "infrastructure/fedora-infrastructure"
Conclusion
The assign_and_depend.py
script is a critical tool for completing the migration from Pagure.io to Fedora Forge. While the built-in migrator handles the basic project structure, this script ensures that important metadata like issue assignments and dependencies are preserved.
Follow this guide carefully, test with small datasets first, and always verify your results. With proper preparation and execution, you can successfully restore all your project’s issue relationships on Fedora Forge.
Last updated in 2025.
Want to help? Learn how to contribute to Fedora Docs ›