So, I'm trying to evaluate Dagger in my company, and I'm struggling with getting a minimal gitlab job that runs as it does locally. I have seen the advanced Kubernetes setup, but getting my infra team to set stuff up like that would be easier if I could show how it works on a small scale. We use a Self-Hosted Gitlab instance, with the runners running via the Kubernetes executor on a GKE cluster. My issue seems to be that our pods are not privileged, so I need to somehow get the dagger engine connected to something that can be spun up within the Gitlab job. I know it would cause issues with caching, but that's for later. I've tried a bunch of things, no luck so far. First is the example from the docs, which fails, presumably due to the fact that the k8s executor we use is not privileged. Here are the errors:
1: starting engine
failed to list containers: exit status 1
1: starting engine [0.67s]
1: connect ERROR: new client: failed to run container: Failed to initialize: unable to resolve docker endpoint: open /certs/client/ca.pem: no such file or directory
: exit status 1
new client: failed to run container: Failed to initialize: unable to resolve docker endpoint: open /certs/client/ca.pem: no such file or directory
: exit status 1
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: command terminated with exit code 1
I then tried to use the rootless buildkit image, but similar issues came up: https://dille.name/blog/2020/06/01/using-buildkit-for-cloud-native-builds-in-gitlab/
Is there an example dagger gitlab ci config that works without root with the k8s executor? maybe like a dedicated dagger/dagger:engine image that does this stuff for you?
Thanks in advance!
After my talk about BuildKit at DockerCon Live 2020 I wanted to provide a detailed answer to a question from the audience. I was asked how to use BuildKit in GitLab CI and this post will explain this for running the BuildKit daemon as a service and using BuildKit daemonless in a job.