How to Install GitLab CI on NetBSD
In this tutorial, we will cover the step-by-step process of installing GitLab CI on NetBSD.
Prerequisites
Before we begin, make sure you have the following prerequisites:
- NetBSD server with root access
- Git installed on the server
- Docker installed on the server
Step 1: Install GitLab CI
SSH into your NetBSD server as root.
Install GitLab CI by running the following command:
# pkg_add gitlab-runner
It will install GitLab CI Runner on your NetBSD server.
Step 2: Register GitLab CI Runner
Navigate to your GitLab instance and create a new project.
Click on the "Settings" cog in the top right corner and select "CI/CD".
Under "Runners", click "Set up a specific Runner manually".
Copy the URL and registration token.
SSH back into your NetBSD server and run the following command to register your runner:
$ gitlab-runner register
Follow the prompts and paste the URL and registration token when prompted.
Choose a descriptive name for your runner and select the tags associated with it.
Once registered, the runner will be ready to use.
Step 3: Configure GitLab CI Runner
- Navigate to your NetBSD server and open the GitLab Runner configuration file by running the following command:
$ vi /usr/pkg/etc/gitlab-runner/config.toml
- Edit the file to match the following example configuration:
concurrent = 1
check_interval = 0
[[runners]]
name = "netbsd-runner"
url = "https://gitlab.example.com/"
token = "xxxxxxxxxxxxxxxxxxxxx"
executor = "docker"
environment = ["DOCKER_TLS_CERTDIR=", "DOCKER_CERT_PATH="]
[runners.docker]
tls_verify = false
image = "docker:stable"
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
extra_hosts = ["gitlab.example.com:192.168.1.1"]
shm_size = 0
Note: Replace the name, url, and token values with your GitLab instance details.
- Save the file and exit.
Step 4: Test GitLab CI Runner
- Navigate to your GitLab project and create a simple
.gitlab-ci.ymlfile with the following contents:
stages:
- test
test:
stage: test
script:
- echo "Hello, NetBSD!"
Commit the file to the project's master branch.
Navigate back to your NetBSD server and start the GitLab Runner by running the following command:
$ gitlab-runner start
Verify the runner successfully picks up the job by checking the GitLab CI/CD pipeline.
The pipeline should be successful and display the output
Hello, NetBSD!.
Congratulations! You have successfully installed GitLab CI on NetBSD and used it to run a basic pipeline.