rfd/0147-repo-mirror.md
This RFD outlines a method for continuously and automatically syncing a GitHub repository. This can be used to create private copies of a repository.
We currently face a few frictions that could be addressed through a more robust repository sync mechanism:
teleport-private mirror of teleport, used for security development, currently requires manual updates to sync.While addressing these immediate needs, the aim of this RFD is to establish a generic pattern for repository mirroring. Although this is a generic pattern, this is not flexible to the point of being suitable for syncing external forks. External forks face a couple issues with this strategy:
The core requirements of this solution are:
master (configurable) - This will serve as the repository's default branch. It will contain both the upstream history and any commits necessary for the synchronization process or other custom changes made to the mirror repository.sync/upstream-[UPSTREAM_BRANCH_NAME] - This branch will be an exact copy of the upstream branch. Should there be a need to create a PR in this repository, the history should be based on this branch, not on master.sync/rebase - This is the branch where custom changes will be committed. It will be rebased onto the upstream changes before being merged into master.The only protected branch will be sync/rebase. Other branches will allow force pushes to enable forceful synchronization based on the upstream state.
The implementation has two primary components:
sync/rebase branch. This workflow will handle the rebase operation and commit the results to the appropriate branches (described above).sync/rebase branch needs manual updates to avoid rebase conflicts. A simple example is that workflow automations not desired in the mirror repository might be removed in the sync/rebase branch. Any modifications to these workflows would then cause a conflict that can be resolved by simply removing the files. This logic can be changed to meet the specific needs of the repository.At a high level the action will execute the following steps:
sync/upstream-[UPSTREAM_BRANCH_NAME] to our mirror.sync/rebase branch onto the latest upstream changes, using the script for conflict resolutions when necessary and possible.The only custom changes required for teleport-private is the need to maintain multiple sync/upstream branches. Specifically, we will sync all release branches. This will be useful when producing backport PRs. Despite syncing multiple upstream branches, only the master branch will undergo rebasing (as generally documented above). The rebase is necessary only to incorporate changes related to GitHub Actions and Workflow automations required for syncing.
This tooling will leveraged to address gaps in our release branch scanning in the following manner:
teleport-sec_scan-1, teleport-sec_scan-2, teleport-sec_scan-3, and teleport-sec_scan-4. The 1 will refer to our latest release branch, determined by automation, with each subsequent repository covering a consecutively older version.Fixed and Reopened status changes.It is important to minimize manual intervention in maintaining this process. Therefore, automating the detection of the current release branch is essential. One challenge is that all repositories will be updated as soon as the next version is created. To ensure constant coverage of supported versions, we maintain a fourth repository.
teleport-private Developer ExperienceThe development experience within teleport-private will largely remain the same, with a few key highlights:
sync/upstream-[UPSTREAM_BRANCH_NAME] branches. Typically, you will use sync/upstream-master, but release branches will also be available for creating backport PRs.