Kategorien
Allgemein

gitlab CI/CD pipeline

Can we run it on Mac OS ? The official guide is https://docs.gitlab.com/runner/install/osx.html#manual-installation-official

Note: it meaning a runner, opensource, written in go. It does not mean: the gitlab UI. To get gitlab itself running, use the operator pattern and install e.g. into a kind-playground cluster (docker images in Docker-Desktop forming a k8s cluster).

We can download the runner binary, make it executable, create a gitlab-runner user and run the runner under the new user.

Or, use brew, install it and run it as a service:

sudo curl --output /usr/local/bin/gitlab-runner "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-darwin-amd64"

# chmod
sudo chmod +x /usr/local/bin/gitlab-runner

gitlab-runner install
Runtime platform                                    arch=amd64 os=darwin pid=14218 revision=456e3482 version=15.10.0
luftichris:~ christianhofig$ echo $?
0

gitlab-runner start
Runtime platform                                    arch=amd64 os=darwin pid=14236 revision=456e3482 version=15.10.0

# ps auxw
christianhofig   14238   0,0  0,3 34917200  26788   ??  S     3:59pm   0:00.18 /usr/local/bin/gitlab-runner run --working-directory /Users/christianhofig --config /Users/christianhofig/.gitlab-runner/config.toml --service gitlab-runner --syslog

luftichris:~ christianhofig$ cat ~/.gitlab-runner/config.toml
concurrent = 1
check_interval = 0
shutdown_timeout = 0

[session_server]
  session_timeout = 1800

## check launchd plist file
cat  ~/Library/LaunchAgents/gitlab-runner.plist
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<plist version='1.0'>
  <dict>
    <key>Label</key>
    <string>gitlab-runner</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/local/bin/gitlab-runner</string>

      <string>run</string>

      <string>--working-directory</string>

      <string>/Users/christianhofig</string>

      <string>--config</string>

      <string>/Users/christianhofig/.gitlab-runner/config.toml</string>
...

gitlab-runner list
Runtime platform                                    arch=amd64 os=darwin pid=16491 revision=456e3482 version=15.10.0
# see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/30844
WARNING: There might be a problem with your config
jsonschema: '/runners' does not validate with https://gitlab.com/gitlab-org/gitlab-runner/common/config#/$ref/properties/runners/type: expected array, but got null 
Listing configured runners                          ConfigFile=/Users/christianhofig/.gitlab-runner/config.toml


# start as service, check if service is running
gitlab-runner start
Runtime platform                                    arch=amd64 os=darwin pid=16737 revision=456e3482 version=15.10.0
luftichris:Library christianhofig$ gitlab-runner status
Runtime platform                                    arch=amd64 os=darwin pid=16743 revision=456e3482 version=15.10.0
gitlab-runner: Service is running

# or start in debug mode
gitlab-runner --debug run
...
Feeding runners to channel                          builds=0
Feeding runners to channel                          builds=0
Feeding runners to channel                          builds=0


# 2nd method
brew install gitlab-runner
brew services start gitlab-runner

# not started yet
brew services list | grep gitlab-runner
Name           Status     User           File
gitlab-runner  none

Now, install gitlab with the operator pattern or as a helm package.

# install as helm, see https://docs.gitlab.com/operator/installation.html
# this is newer https://docs.gitlab.com/charts/installation/deployment.html



helm repo add gitlab-operator https://gitlab.com/api/v4/projects/18899486/packages/helm/stable

helm repo update

helm install gitlab-operator gitlab-operator/gitlab-operator --create-namespace --namespace gitlab-system

By default, the Helm charts use the Enterprise Edition of GitLab. The Enterprise Edition is a free, open core version of GitLab with the option of upgrading to a paid tier to unlock additional features. If desired, you can instead use the Community Edition which is licensed under the MIT Expat license. (Quote end).

To be continued !