Some of our Github projects need to be also stored in Launchpad, as some of our systems only have access to Launchpad repositories.
Initally we were converting these projects manually at regular intervals, but this quickly became too cumbersome.
To manage this we created a simple web-service project to synchronise Git projects to Bazaar. This script basically automates the techniques described in our previous article to pull down the Github repository, convert it to Bazaar and push it up to Launchpad at a specified location.
Here’s a guide to setting up our
bzr-sync project on a server somewhere to sync Github to Launchpad.
Install necessary system dependencies:
First off, you’ll have to make sure you set up a user on whichever server is to run this service which has read access to your Github projects and write access to your Launchpad projects:
Then you should clone the project and install dependencies. We placed it at
/srv/bzr-sync but you can put it anywhere:
We should serve this over HTTPS, so our
auth_token will remain secret. This means you’ll need a SSL certificate keyfile and certfile. You should get one from a certificate authority, but for testing you could just generate a self-signed-certificate.
Put your certificate files somewhere accessible (like
/srv/bzr-sync/certs/), and then test out running your server with
You should now be able to synchronise a Github repository with Launchpad by pointing your browser at:
You should be able to see the progress of the conversion as command-line output from the above
Rather than running the server directly, we can setup an upstart job to manage running the process. This way the bzr-sync service will restart if the server restarts.
Here’s an example of an upstart job, which we placed at
You can now start the bzr-sync server as a service:
And output will be logged to
Now to use this sync server to automatically synchronise your Github projects to Launchpad, you simply need to add a post-commit webhook to ping a URL of the form:
In your repository settings, select “Webhooks and Services”, then “Add webhook”, and enter the following information:
NB: Notice the
Disable SSL verification button. By default, the hook will only work if your server has a valid certificate. If you are testing with a self-signed one then you’ll need to disable this SSL verification.
Now whenever you commit to your Github repository, Github should ping the URL, and the server should synchronise your repository into Launchpad.
Interested in running Ubuntu Desktop in your organisation?
Over the past year, we’ve been working hard to bring you the next release of Vanilla framework: version 2.0, our most stable release to date. Since our last significant release, v1.8.0 back in July last year, we’ve been working hard to…
This was a fairly busy two weeks for the Web & design team at Canonical. Here are some of the highlights of our completed work. Web Web is the squad that develop and maintain most of the brochure websites across the Canonical.…
It was another busy iteration for the web and design team, trying to get a lot of work wrapped up before we head off to Lyon, France for our 19.10 Roadmap cycle kick-off.