Warning
Hubcast is still in development. Easy installation instructions using PyPI and production containers coming soon.
Hubcast may be configured using environment variables.
A full set of the current environment variables are shown below.
For development instances of hubcast it is suggested you save these environment
variables in a .env file or similar and source it before execution.
#------------------------------------------------------------------------
# Git Repository Settings
#------------------------------------------------------------------------
# Path for a local Git repository used as an intermediate sync.
export HC_GIT_REPO_PATH=""
# Remote GitHub Repository.
export HC_GH_REPO=""
# Remote GitLab Repository.
export HC_GL_REPO=""
#------------------------------------------------------------------------
# GitHub Settings
#------------------------------------------------------------------------
# Name of the GitHub check to be displayed for GitLab Ci Runs.
export HC_GH_CHECK_NAME=""
# GitHub App Webhook Secret.
export HC_GH_SECRET=""
# Path to GitHub App's private key. Used for generating tokens.
export HC_GH_PRIVATE_KEY_PATH=""
# GitHub User to act on the behalf of.
export HC_GH_REQUESTER=""
# GitHub App Identifier. (Numerical ID.)
export HC_GH_APP_IDENTIFIER=
#------------------------------------------------------------------------
# GitLab Settings
#------------------------------------------------------------------------
# Authentication token for interacting with GitLab.
export HC_GL_ACCESS_TOKEN=""
# GitLab Webhook Secret.
export HC_GL_SECRET=""
# GitLab User to act on the behalf of.
export HC_GL_REQUESTER=""
#------------------------------------------------------------------------
# Account Map Settings
#------------------------------------------------------------------------
export HC_ACCOUNT_MAP_PATH="users.yml"
#------------------------------------------------------------------------
# General Bot Settings
#------------------------------------------------------------------------
# Port for hubcast to listen on.
export HC_PORT=3000
If you don't already have a GitHub repository you'd like to mirror, you'll need to create a new repository. (When setting up Hubcast for the first time it may be a good idea to test it first on a test repository.)
Tip
If you're setting up a local instance of Hubcast to develop on we recommend setting up a hubcast-test repository to test out your changes before submitting a PR. To create a test repository click here.
To create a GitHub App you'll need a callback url and a webhook secret.
If you're deploying Hubcast in production, this callback url be an https link to your infrastructure. If you're deploying for development, we recommend using smee.io to forward webhooks to your local environment.
To see more about contributing to Hubcast check out our contributing guide here.
Your webhook secret should be a shared complex string allowing you to verify webhooks came from GitHub. To generate a complex secret you can run,
$ openssl rand -base64 24With a callback url and secret handy follow GitHub's Registering a GitHub App guide to create your app installation.
We should now be able to fill in the following environment variables in Hubcast's configuration with the values retrieved from GitHub's setup.
#------------------------------------------------------------------------
# GitHub Settings
#------------------------------------------------------------------------
# Name of the GitHub check to be displayed for GitLab Ci Runs.
export HC_GH_CHECK_NAME=""
# GitHub App Webhook Secret.
export HC_GH_SECRET=""
# Path to GitHub App's private key you downloaded from GitHub.
# Used for generating tokens.
export HC_GH_PRIVATE_KEY_PATH=""
# GitHub User to act on the behalf of.
export HC_GH_REQUESTER=""
# GitHub App Identifier. (Numerical ID Shown on GitHub App Config Page.)
export HC_GH_APP_IDENTIFIER=
If you don't already have a GitLab repository you'd like to mirror into, we'll need to create one at this point.
Tip
If you're setting up a local instance of Hubcast to develop on we recommend setting up a hubcast-test repository to test out your changes before submitting a PR. To create a test repository on GitLab.com click here.
Once we've setup a new blank repository in GitLab we can configure it with a webhook. This webhook will notify Hubcast of in-progress, completed, and failed CI jobs so those statuses may be passed back to the GitHub Repository.
Before configuring the webhook in GitLab we'll need to have our callback url handy and generate another webhoook secret.
$ openssl rand -base64 24One you've got those two values you can follow GitLab's instructions in the Webhooks docs.
Tip
Make sure to set the webhook to trigger on both job events and pipeline events.
Finally to access the GitLab API we'll need to create Project Access Token inside the repository by following the instructions here.
Tip
To ensure Hubcast can operate successfully you'll need to give the following permissions to the project access token,
read_apiread_repositorywrite_repository
After creating the GitLab repository, webhook, and access token we can now fill out the remainder of the Hubcast GitLab config.
#------------------------------------------------------------------------
# GitLab Settings
#------------------------------------------------------------------------
# Authentication token for interacting with GitLab.
export HC_GL_ACCESS_TOKEN=""
# GitLab Webhook Secret.
export HC_GL_SECRET=""
# GitLab User to act on the behalf of.
export HC_GL_REQUESTER=""Lastly we'll need to create a simple account map to map GitHub to GitLab users.
#------------------------------------------------------------------------
# Account Map Settings
#------------------------------------------------------------------------
export HC_ACCOUNT_MAP_PATH="users.yml"Users:
github_user1: gitlab_user1
github_user2: gitlab_user2
...At this point we should now be able to launch our instance of hubcast and have it begin mirroring events from GitHub to GitLab.
$ source .env
$ python -m hubcast