Today I'll be showing you how to setup CI for your project in less than 2 minutes with Metroline, an open source, self hosted CI. I'll be using Gitea for this tutorial but you could use Gitlab or Github.
Install Metroline (1 minute)
Create a Gitea OAuth app and copy your Client ID and Client Secret
Copy this docker-compose.yml
and:
- set METROLINE_GITEA_CLIENT_ID
to your Gitea client ID
- set METROLINE_GITEA_CLIENT_SECRET
to your Gitea client secret
- set METROLINE_GITEA_URL
to the URL of your Gitea server
- change 192.168.43.36
with your IP
- set METROLINE_JWT_SECRET
with a random secret obtained from openssl rand 32 -hex
- set METROLINE_RUNNER_SECRET
with a random secret obtained from openssl rand 32 -hex
Now, run docker-compose up -d
and browse to http://<your-ip>:3000
. Click Sign in. You'll see the list of your repos. Click Setup on your favorite project, and you're all set !
Add CI config file and run first pipeline (30 seconds)
At the root of your project, add a .metroline.yml
file with this content:
version: '1'
image: node:12-alpine
jobs:
install:
script:
- npm ci
test:
script:
- npm test
dependencies:
- install
Commit, push, and you Metroline starts building your commit immediately.
Pipeline statuses are reported to Gitea as they change. You'll be able to see it next to the commit, and clicking the commit status will open the pipeline in Metroline.
Conclusion
I've demonstrated the very basics here, but you can configure parallel jobs, secrets, conditionally execute jobs based on the branch or status of upstream jobs, you can also define pipeline environment, and more.
Also remember that this will work with Github and Gitlab, so I recommend you checkout the installation instructions for your favorite Git server.
Hope you find this useful !
Follow us on Twitter @metrolineio to stay tuned, and share Metroline around you so we can grow our community !
Top comments (0)