Page MenuHomeSoftware Heritage

maintain an up-to-date mirror of forge.softwareheritage.org code on GitHub
Closed, MigratedEdits Locked

Description

We have a under-utilized GitHub account.

The main development of Software Heritage will remain on forge.softwareheritage.org for the foreseeable future, but we should nonetheless automatically maintain on GitHub a complete up-to-date mirror of our code, so that GitHub users can easily submit pull requests.
While dealing with pull requests when GitHub is not our main platform is somewhat painful, we really need to lower the bar for code contributions, and having a presence on GitHub might help in that respect.

@olasd: can you please briefly document here how the few repos we currently have on GitHub are currently automatically sync'd? That will make this task more actionable. TIA.

Event Timeline

zack added a project: Restricted Project.
zack moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.
This comment was removed by ardumont.

@ardumont We still need to set up mirrors for all the rest. :)

Here are the steps:

  1. Create a new repository on GitHub with the proper name
  2. Edit the repository settings on forge.softwareheritage.org : Manage repository > URIs
  3. Add URI
    • URI: git@github.com:SoftwareHeritage/repo.git
    • I/O type: Mirror
    • Display type: Hidden
  4. Set Credential to "K2: GitHub Mirror"
  5. Wait for magic to happen
  6. In the meantime, go to the repository settings on GitHub and disable issues/wiki/pages

One tidbit: K2 is currently set with push access to my account, which is "slightly" suboptimal. At first opportunity we should move to a so-called "deploy key" with push access.

WIP is P128 for referencing the doc pages in multiple api calls needed.

Here's an initial list of repos that should be synced:

all repos in the "to be synced" list are now tagged with the project "Sync to GitHub", see diffusion query

zack removed a project: Restricted Project.Feb 3 2017, 8:56 AM

This is now ready.

This is a dry-run demo (tested on some repositories with no dry-run and the mirror is, as expected, installed on github, and after some time finally mirrored).

 sh
for callsign in $(cat swh-sync-repo.txt | awk '{print $1}' |sed -e 's/^r//g'); do python3 -m swh.mirror.forge.sync --repo-callsign $callsign --credential-key-id 3 --dry-run; done
**dry run**
Repository https://forge.softwareheritage.org/diffusion/DCIDX/swh-indexer.git mirrored at git@github.com:SoftwareHeritage/swh-indexer.git.
**dry run**
Repository https://forge.softwareheritage.org/diffusion/DCORE/swh-core.git mirrored at git@github.com:SoftwareHeritage/swh-core.git.
**dry run**
...
**dry run**
Repository https://forge.softwareheritage.org/diffusion/DLDBASE/swh-loader-core.git mirrored at git@github.com:SoftwareHeritage/swh-loader-core.git.
**dry run**
Repository https://forge.softwareheritage.org/diffusion/DLDDEB/swh-loader-debian.git mirrored at git@github.com:SoftwareHeritage/swh-loader-debian.git.
**dry run**
Repository https://forge.softwareheritage.org/diffusion/DLDDIR/swh-loader-dir.git mirrored at git@github.com:SoftwareHeritage/swh-loader-dir.git.
...

The dry-run means that it only reads information on the forge without any writes.

Without dry-run, that will mirror the repository in github (using information retrieved from our forge for that mirror).
If a repository is already set as a github mirror, it stops.

For details on the configuration, see https://forge.softwareheritage.org/source/swh-mirror-forge/browse/master/README.md.

Status

All repositories have been mirrored to github.

Detail

Account @swhmirror created.
It's part of our organization as an owner (to have write access to mirrors).
It's in charge of pushing changes to github via our forge.

Note

  • Api Token (to use for triggering the script below is stored in our passwords store).
  • private key (stored in password store and in phabricator as id 3)
  • public key (referenced in swhmirror's github account and stored in our password store under the private key file just mentioned).
  • swhmirror has an swhmirror logo with 'swh mirror' as text (logo svg + png in annex-public).

Command triggered to sync mirrors:

python3 -m swh.mirror.forge.sync mirrors --credential-key-id 3 --query-repositories z1zwaVy_tEDt

z1zwaVy_tEDt is the id of the query to list 'sync to github' tagged repositories.

Source: swh-mirror-forge repository.

Awesome work, thanks!

A couple of minor followups:

  • i've removed the mirror of swh-mirror-forge itself from GitHub, as it shouldn't be there for now (and indeed it doesn't have the sync-to-github tag :-)). We can reconsider when we have generalized this for usage by others, right now it's just an internal tool of little use for others
  • i've changed (see rDMIRFOR93f3e6ff62da6ef5d0f3626aa7d9f3490692bc29) the repo description to make it clear that these repos are mirrors, in an attempt to minimize pull requests we will get via GitHub. The change, however, should be propagated to all the repos that have already been mirror, with a one shot use of the GitHub API. @ardumont: can you take care of that?

i've removed the mirror of swh-mirror-forge itself from GitHub, as it shouldn't be there for now (and indeed it doesn't have the sync-to-github tag :-)). We can reconsider when we have generalized this for usage by others, right now it's just an internal tool of little use for others

Sure, i used it as a test.

i've changed (see rDMIRFOR93f3e6ff62da6ef5d0f3626aa7d9f3490692bc29) the repo description to make it clear that these repos are mirrors, in an attempt to minimize pull requests we will get via GitHub.

Nice.

The change, however, should be propagated to all the repos that have already been mirror, with a one shot use of the GitHub API. @ardumont: can you take care of that?

Oh, yes, I forgot to mention that i already did yesterday ^^

The change, however, should be propagated to all the repos that have already been mirror, with a one shot use of the GitHub API. @ardumont: can you take care of that?

Oh, yes, I forgot to mention that i already did yesterday ^^

Well, no i did not. I misunderstood.
I was speaking about changing the credential in the first manually configured mirror (they were using either olasd or my key).
They have been migrated to use swhmirror's key. So now, we should only see swhmirror as an active pusher in SoftwareHeritage's event feed.

For the description change to reflect the github's mirror state of each swh's repository, every github mirror is now describing 'GitHub mirror of <repository-name>'.

Also, there was a hit and miss about swh-lister-github.

This has been fixed either in code (the cause of hit and miss) and in production (that is, swh-lister-github is now mirrored with the right description \o/).

For the description change to reflect the github's mirror state of each swh's repository, every github mirror is now describing 'GitHub mirror of <repository-name>'.

Awesome, thanks!