Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

services.gitlab-runner.services.<name>.preBuildScript not usable for container runners #214323

Open
zagy opened this issue Feb 3, 2023 · 1 comment

Comments

@zagy
Copy link
Contributor

zagy commented Feb 3, 2023

The option services.gitlab-runner.services.<name>.preBuildScript is defined as null or path.

The option defines the commands to be executed before the build itself, not a path to a script. From the gitlab-runner docs:

pre_build_script: Commands to be executed on the runner before executing the build. To insert multiple commands, use a (triple-quoted) multi-line string or \n character.

The problem becomes clear when the build is run in a container (e.g. docker): the commands are run inside the container which has no access to the nix store where the preBuildScript is written to. The error is e.g.

/bin/bash: line 129: /nix/store/13is9j57jrc177rb9268lyaaigmsq2bx-gitlab-runner-docker-dind-pre-build: No such file or directory

FTR: A workaround is registrationFlags = [ "--pre-build-script 'my; commands; go ; here'" ];.

@zimbatm @bachp @globin

@mvnetbiz
Copy link
Contributor

mvnetbiz commented Feb 9, 2024

A path to a script should be valid as a "command." I think the problem is your script path is not available inside the container. You could try mounting the host's nix store in your runner service.

dockerVolumes = [
   "/nix/store:/nix/store:ro"
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants