gitlab-ci

gitlab-ci

If this post is online, my new gitlab-ci pipeline is working. With podman instead of docker.

Here I collect some of the settings/commands from setup (not complete, without guarantee)

install gitlab runner:

curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash
sudo apt install gitlab-runner

then register it:

gitlab-runner register --url <GITLAB_URL> --token <GITLAB_RUNNER_TOKEN>

create the GITLAB_RUNNER_TOKEN at <GITLAB_URL>/admin/runners/new

configure the runner: edit /etc/gitlab-runner/config.toml:

[[runners]]
  [runners.docker]
    host = "unix:///run/user/996/podman/podman.sock"

Then enable the podman socket on the host

systemctl --user enable --now podman.socket

uid mapping:

usermod --add-subuids 100000 165536 gitlab-runner

the tricky part was the deployment, but the docs were helpful

in my gitlab-ci.yml I added:

before_script:
  - mkdir -p ~/.ssh
  - chmod 700 ~/.ssh
  - eval $(ssh-agent -s)
  - ssh-add "$SSH_PRIVATE_KEY"
  - cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts
  - chmod 644 ~/.ssh/known_hosts

and the page can be deployed with rsync