Run devbox with GitLab CI
gitlab-ci.yml defines a job that runs in devbox
on a GitLab Runner with the
Docker executor (opens in new tab).
- Images
- GHCR
ghcr.io/hambn/devbox - Docker Hub
docker.io/hambn/devbox
- GHCR
- Use case
- CI job with the full toolchain on GitLab
Prerequisites
- A GitLab project with a runner that uses the Docker executor, such as GitLab.com hosted Linux runners.
Set up
Add the devbox-check job to your project's .gitlab-ci.yml and replace the check
commands with your own. It runs in every pipeline.
The job runs ghcr.io/hambn/devbox:ubuntu-full. Replace the tag with @sha256:<digest> to pin one build.
Variables
None. Store secrets as masked CI/CD variables (opens in new tab) instead of in the file.
Workspace
The runner clones the project into $CI_PROJECT_DIR and runs the script as the image
user, sysadmin (UID 1000). The clone belongs to a different user, so the first script
line marks it as a Git safe directory.
Files
gitlab-ci.yml: a job that runs in the devbox full tier.
Limitations
- The runner pulls the image for each job unless its pull policy reuses a cached copy.
File contents
gitlab-ci.yml10 lines
# Add this job to your project's .gitlab-ci.yml and replace the check commands with your own.
devbox-check:
image: ghcr.io/hambn/devbox:ubuntu-full
timeout: 30m
script:
# The runner clones as a different user than sysadmin, so Git needs the path marked safe.
- git config --global --add safe.directory "$CI_PROJECT_DIR"
- go version
- node --version
- python3 --version