Skip to main content

Composer Auth & GitLab CI Runner

This blog post might be outdated!
This blog post was published more than one year ago and might be outdated!
· 2 min read
Stephan Hochdörfer
Head of IT Business Operations

In my recent attempt to migrate away from our Jenkins infrastructure to the new GitLab CI Runner infrastructure I ran into a problem: Since we want to use Docker images for the GitLab CI builds I struggled a bit on how pass the authentication information for Satis and GitLab into the docker images. Since the base images - basic PHP setup - should be used for our projects I did not want to share the access credentials in the different base images. Gitlab's secret variables sounded like a good idea but unfortunately they need to be defined for each and every project. Currently we have more than 250 projects in our GitLab instance, configuring secret variables for all the projects would have been a big pain.

By accident, I realized that it is possible to configure the volumes to mount in the runners configuration of the gitlab-ci-multi-runner. The current configuration looks like this:

volumes = ["/home/gitlab-runner/.composer:/root/.compooser:rw",
"/home/gitlab-runner/.ssh:/root/.ssh:rw"]

On the plus side this means that the Composer package cache is persisted on the host, which means that only new packages get downloaded which massivly speeds up the build process. In the next post I will give you some insights on how we trigger Statis rebuilds via GitLab.