Implement CI/CD Pipeline on FreeBSD
I have come up with another article about How to Implement CI/CD Pipeline on FreeBSD. CI/CD pipeline is one of the best practices where software development and DevOps team can implement it. Let’s see how we can Implement CI/CD Pipeline on FreeBSD on one of the Unix flavors – the FreeBSD system.
For the remote repository, we will be using GitLab. Hence, the GitLab-runner tool has to be installed in the host and it is a pipeline tool used in GitLab. If you don’t have any repositories in gitlab, create one at gitlab .
Once you create a repository, go to Settings -> CI/CD -> Runners . Copy the runner register URL & the registration token and keep it safe to use later.
Here are the steps to Implement CI/CD Pipeline on FreeBSD
Now it’s our turn to do some tricks in FreeBSD. Install the gitlab-runner package by using the below command and as usual before running this command make sure to update all packages if you want.
# pkg update # pkg install –y gitlab-runner
This package will also create a user and group ‘gitlab-runner’ and this binary will run under this user. Once it is installed, run the below command to enable the runner service during system boot.
# sysrc gitlab_runner_enable=yes
Then, this runner has to be registered for the repository created in GitLab. To do so, execute the below command and proceed with the steps
# service gitlab_runner register
Steps to register the repository created in GitLab
- Enter your GitLab instance URL as https://gitlab.com/
- Provide the registration token that you obtained before.
- Enter a description for your runner. Ex: freebsd-runner
- Enter tags for your runner. Ex: deploy,build (Note: The runner will execute only with the associated tag.)
- Enter any optional maintenance note for the runner.
- Enter the executor as ‘shell’ (can execute shell scripts using this executor)
Next, you will see a message that the runner is registered successfully.
One last step is to start the gitlab-runner service now,
# service gitlab_runner start
Now you see that your runner is successfully configured and running in the GitLab interface as referred below and make sure that you disable the shared runner for your project.
In order to list the available runners and configuration file location, run the below command
# service gitlab_runner list
As I mentioned a user has been created during package installation. So, this runner service will run as the daemon user ‘gitlab-runner’. If you face any permission issue during any job execution, then update the few details in the rc.d service file (/usr/local/etc/rc.d/gitlab_runner) and restart the service.
- : ${gitlab_runner_user:=”root”}
- : ${gitlab_runner_group:=”wheel”}
- : ${gitlab_runner_dir:=”/gitlab_runner”}
Note: gitlab_runner_dir is the home directory where the repo will get cloned and initialized.
Once you upload the .gitlab-ci.yml file to the repo, the pipeline will start automatically and the defined jobs in YAML file will get executed. Navigate to CI/CD -> Pipelines Implementations to view the status.
Your feedback about the article “How to Implement CI/CD Pipeline on FreeBSD?” is much appreciated. Send your feedback to support@assistanz.com