Skip to content

Latest commit

 

History

History
62 lines (50 loc) · 3.77 KB

INTEGRATING_GIT_PROVIDERS.md

File metadata and controls

62 lines (50 loc) · 3.77 KB

GitHub Integration


GitHub Integration

1. Create GitHub token

Abstruse uses a personal access token to communicate with GitHub. We need to create one.
Login to GitHub and navigate to Setting/Developer settings/Personal access tokens
Generate Token Click on Generate new Token. We only need access to repo
Repo Access Click on Generate token and save the token
New Token

2. On Abstruse add GitHub provider

On Abstruse navigate to the provider's page. Click on the profile picture and select Providers
Providers Click on Add Provider
Add provider Select the GitHub provider and paste the access token to the field. Copy the generated secret that will be needed in the next step. Click Save.

3. Enable repository in Abstruse

Go to Abstruse and navigate to the Repositories page and turn on the repository
Repositories

4. Add GitHub webhook

To add a webhook, login to GitHub and navigate to repository and then Settings/Webhooks
Webhook Click on Add webhook
Under Payload URL add the URL to your Abstruse and attach the /webhooks path to it https://demo.abstruse.io/webhooks
Under Secret paste the secret from the previous step
Under Which events would you like to trigger this webhook? select Let me select individual events. and check Branch or tag creation, Branch or tag deletion, Pull requests and Pushes
Add Webhook Click Add webhook

5. Protect master branch

In order to protect the master branch with Abstruse, login to GitHub and navigate to the repository and then Settings/Branches
Branches Click on Add Role. Type in master as the branch and check Require status checks to pass before merging and Require branches to be up to date before merging. In search field type continuous-integration and click on continuous-integration.
Protect Branch NOTE: If the continuous-integration checkbox is not visible, we need to manually trigger a build. Go to Abstruse and go to repository settings by clicking on the repository and then settings:
Trigger Build add .abstruse.yml content from step 6. to config and click Trigger build. Repeat step 5.

6. Create PR

We are good to go. Here is a simple example on how to test everything. Create a PR with these two files in the root of the project:

Makefile:

test:
	@echo "testing..."
	
.PHONY: test

.abstruse.yml:

image: golang:1.15

matrix:
  - env: CMD=test

script:
  - if [[ "$CMD" ]]; then make $CMD; fi