Connect to a ChaosHub
This topic describes how to add and connect a custom ChaosHub.
Prerequisites for Adding a Custom ChaosHub
-
Make sure you have a Git repository for your custom ChaosHub, where you will store experiments and faults. The repository must include two folders:
experiments
andfaults
. Here's an example repo: -
Generate a personal access token from GitHub to access and sync your repository with Harness. The token must have at least the repo scope.
Add a Custom ChaosHub
- Interactive guide
- Step-by-step guide
-
In your Harness project, navigate to the Chaos > ChaosHubs, and then select + New ChaosHub.
-
Enter a Name for the hub and optionally add a Description and Tags.
-
Select Continue.
-
On the Git Connection screen, add a new Git connector to access and sync your repository with Harness.
-
In the ChaosHub Connector field. you'll see existing Git connectors listed under separate tabs for Project, Organization, and Account scopes.
-
Select New Connector, and then choose GitHub Connector.
-
In the Overview screen, enter a Name and optional description and tags, and then select Continue.
The Details screen is displayed.
-
In the Details screen, for URL Type, select Repository.
You can select Account if you want to create an account-scoped GitHub connector. This can be used for connecting multiple ChaosHubs from a single GitHub account.
-
For Connection Type, select HTTP.
-
In GitHub Repository URL, enter the URL of your custom ChaosHub repository.
If you selected Account for URL Type, fill out these fields instead:
-
In GitHub Account URL, enter the account URL for your custom ChaosHub repository.
-
In Test Repository, enter any repository name from your GitHub account to validate the connection.
-
-
Select Continue.
The Credentials screen appears.
-
-
On the Credentials screen, enter the Username (in plain text) for authenticating with your GitHub repository.
-
In Personal Access Token, select Create or Select a Secret.
This displays all the secrets in separate tabs for Project, Organization, and Account scopes.
-
Select New Secret Text.
-
In the Add new Encrypted Text screen, fill out the fields as follows:
-
Select Save, and then on the Credentials screen, select Continue.
This adds your GitHub repository connector and initializes the PAT for authentication.
-
In the Connect to provider screen, select Connect through Harness Platform, and then select Save and Continue.
This starts a connection test to validate that Harness can access the Git repository with the given configuration.
-
When the test is successful, select Finish.
The Git Connection screen appears.
-
In Hub Repository Branch, enter the repository branch in which the ChaosHub files are located.
-
Select Connect Hub, and then select Finish.
Your new custom ChaosHub appears on the ChaosHubs page.
To share your custom ChaosHub with another Harness project, add the hub to the other project by following the same procedure.
Next steps
You can add and launch experiments in your custom ChaosHub, or add YAML fault and experiment definitions directly in your ChaosHub GitHub repository, and then sync it with Harness. For more details, go to Manage ChaosHub.