Dosyalar
rocm-systems/docs/migration-process.md
T
2025-08-02 22:23:24 -04:00

9.3 KiB

Migration from Single Repo to super-repo

Introduction

This document outlines the process for migrating from a single library repository to this super-repo. It covers the necessary steps to ensure a smooth transition, including pre-conditions, conflict resolution, and changes to repository management.

Pre-conditions

To ensure consistency and maintainability during the migration, the following pre-conditions must be satisfied:

  1. Identify Next Repo to Migrate:

    • Please refer to the main README.md on the order of repositories being migrated.
    • This is usually discussed in advance in meetings with the technical leads of that project.
  2. Identify Branches and Pull Requests:

    • Determine branches and active pull requests that will be affected by the migration.
    • Typically, this is limited to the pull requests targeting develop and release-staging branches.
    • Any point-fixes for previous releases will not be migrated over.
  3. Pause Merges:

Migration Process

Step 1: Pull Request Management

  1. Automated Import of Pull Requests:

  2. Conflict Resolution:

    • For pull requests with merge conflicts, add a comment explaining the merge conflict and blocking issue preventing import.
    • Collaborate with contributors to import these PRs after the migration period, or the contributor can reopen the pull request themselves on the super-repo.
  3. NPI Development:

    • Repeat this import process for the super-repo on GitHub EMU for npi work.

Step 2: Issue and Comment Import

  1. Issue Import:

Step 3: Path-Based Commit History

  1. Use of Git Filter-Repo:

  2. command sequence example

Some steps are added to ensure you have latest checked out, in case you're copy-pasting and already have the repositories checked out beforehand.

python3 -m pip install --user git-filter-repo
git clone git@github.com:ROCm/hipBLAS-common.git
pushd hipBLAS-common
git checkout develop
git pull origin
git checkout -b filtered/hipblas-common
git filter-repo --path-rename '':'projects/hipblas-common/' --commit-callback "original_hash = commit.original_id.decode(); original_message = commit.message.decode(); new_message = f'{original_message}\\n\\n[ROCm/hipBLAS-common commit: {original_hash}]' if original_message.strip() else f'[ROCm/hipBLAS-common commit: {original_hash}]'; commit.message = new_message.encode()" --force
git remote add super-repo git@github.com:ROCm/rocm-systems.git
git push super-repo filtered/hipblas-common
popd
git clone git@github.com:ROCm/rocm-systems.git
git checkout develop
git pull origin
git branch backup/develop-hipblas-common
git checkout filtered/hipblas-common
git checkout -b preserved/hipblas-common
git merge origin/develop --allow-unrelated-histories
# Set merge commit message to "Import path-preserved history of hipblas-common into the super-repo."
git push --set-upstream origin preserved/hipblas-common
git checkout develop
git reset --hard preserved/hipblas-common
git push origin develop
# Double check contents. Make sure no stray developers merged PRs on either repo during this period. Manually pull in those PRs for these exceptional cases.
# Delete the temporary branches created in this sequence.

Step 4: CI/CD Triggers

  1. CI/CD Trigger Points:
    • Modify the existing CI/CD systems to be triggered off changes to this project in the super-repo.

Step 5: Repository Adjustments

  1. Default Branch Deprecation:

  2. Disable Dependabot Updates:

  3. Protection Rules:

    • Use branch protection to make the new default branch with the deprecation notice read-only.
    • Create a ruleset for the develop branch to also be restrictive, but allow the systems-assistant bot exceptions to push patches to the original repository.

Step 6: Source of Truth Declaration

  1. Update repos-config.json:

  2. Update the super-repo README.md:

Post-Migration Activities

  1. Re-enable synchronization jobs:

    • Re-enable any automated workflows that were paused.
  2. Communication:

    • Communicate to key stakeholders the successful completion of the migration.
    • Continue daily meetings and active written communications to offer support for any issues that arise.
  3. Automated Patching of Original Repos:

  4. Monitoring:

Conclusion

This migration process aims to assist the ROCm development teams transition from many repos to a super-repo by addressing the topics above. By following these outlined steps, we aim to maintain and improve the quality of our development workflow post-migration.