============================= Mirror OpenDev Repo to GitHub ============================= This section describes the steps to create a Zuul job to sync an OpenDev repository to a GitHub repository. .. contents:: :local: :depth: 1 ---------------------------------------------------- Create Zuul job to sync OpenDev repository to GitHub ---------------------------------------------------- #. Prepare GitHub repository. #. Create a new repository under github.com/starlingx. If possible, use the same repository name as original OpenDev repository. #. Grant 'write' permission to the starlingx-github user. Zuul will use the starlingx-github user to sync the repository. #. Generate an SSH key. Zuul is needed to generate an SSH key. Refer to the `Zuul Quick-Start `_ for Zuul installation instructions. From a server that has the Zuul tool installed, run the following command, where is the name of the repository. The SSH key is at the end of the output after : tag. .. code-block:: yaml zuul/tools/encrypt_secret.py --infile ./starlingx.github@gmail.com --strip --tenant \ openstack https://zuul.opendev.org starlingx/ writing RSA key Public key length: 4096 bits (512 bytes) Max plaintext length per chunk: 470 bytes Input plaintext length: 3246 bytes Number of chunks: 7 - secret: name: data: : #. Add a new job to Zuul. Create a new job in .zuul.yaml in the root directory of the repository. The new job should look like the example below. Make sure to replace with the actual repository name. Replace with the actual SSH key generated in the previous step. .. code-block:: yaml - job: name: stx--upload-git-mirror parent: upload-git-mirror description: Mirrors opendev.org/starlingx/ to github.com/starlingx/ vars: git_mirror_repository: starlingx/ secrets: - name: git_mirror_credentials secret: stx--github-secret pass-to-parent: true - secret: name: stx--github-secret data: user: git host: github.com # yamllint disable-line rule:line-length host_key: github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== ssh_key: #. Set the new job as a Zuul post job. Add the job (named stx--upload-git-mirror) to the post job section of the .zuul.yaml file. If there isn't an existing post job, create a new post job section. The .zuul.yaml post job section should look like the example below. Make sure is replaced with the actual repository name. Example .zuul.yaml post job section: .. code-block:: yaml - project: post: jobs: stx--upload-git-mirror ---------------- Example Zuul job ---------------- An example of adding a Zuul job to sync a repository from opendev.org/starlingx to github.com/starlingx can be found at: https://opendev.org/starlingx/config/commit/5df1f3a89a6e1ef699fc6030a18902faf45daf88