-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
nixos/gitlab-runner: support multiple services #86561
Conversation
Yes, there is |
@misuzu Thanks for the fast response. I can't really add anything manually, as this is an automated setup. Will the remaining complex options like |
You can configure cache using
I can try adding other global options. |
@max-wittig please take a look at #86946 |
@misuzu I've tested it now with this MR, but I'm just getting the old gitlab-runner (12.4.1). Is there any way to specify the latest runner. I've seen the package option but I'm not sure how to bump something there. Should already be at |
12.4.1 is in 19.09. You can upgrade to 20.03 or unstable for newer version. |
@misuzu I just noticed that, but ran into another problem. Every 2nd deployment or so, the config.toml stays empty: gitlab-runner is happy with an empty config, but I'm not 😄 |
Please share your config. |
@misuzu Thanks for all the help! services.gitlab-runner = {
enable = true;
checkInterval = 15;
package = latestPkgs.gitlab-runner;
#concurrent = ${vars.concurrent};
services = {
docker-images = {
registrationFlags = [
"--cache-type"
"s3"
"--cache-shared"
"--cache-s3-server-address"
"s3.amazonaws.com"
"--cache-s3-access-key"
"${vars.s3_access_key}"
"--cache-s3-secret-key"
"${vars.s3_secret_key}"
"--cache-s3-bucket-name"
"some-aws-bucket"
"--cache-s3-bucket-location"
"eu-central-1"
"--docker-pull-policy"
"always"
];
registrationConfigFile = pkgs.writeText "gitlab-runner-nix-registration" ''
CI_SERVER_URL=https://gitlab-url/
REGISTRATION_TOKEN=${vars.token}
'';
#dockerAllowedImages = "vars.docker_whitelist}";
dockerImage = "some-registry.com:some-image:stable";
dockerVolumes = [
"/mnt/projects/sstate-cache:/home/projects/sstate-cache:rw"
];
executor = "docker";
maximumTimeout = 86400;
dockerDisableCache = true;
environmentVariables = {
CONCURRENCY_LEVEL = vars.concurrent;
};
#tagList = ["${vars.tags}"];
};
};
}; |
@max-wittig this config is working fine on my server. Please check the logs: |
Please share a full log: start |
Doesn't change anything, as it's the registration part that writes this empty config file that doesn't work, not the runner start part. |
That's exactly what i want to see, there is no logs from |
Ah I guess I had some registration parameter wrong. Can we implement some sort of error for this? Like fail the nixos switch if this happens? |
Maybe. I have to understand what happened to do that. |
I think the registration failed. I had this message: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/2862 |
@misuzu Thanks again for the great work you did here and sorry for my stupid questions 😉 |
@misuzu The registration error from the runner actually looks like this: |
Don't worry. Thanks for testing! |
I have updated pull request, now this should fail on activation. |
Ah nice! Thanks. One more thing. The name of the runner cannot be overriden currently, right? Could that be configurable, too? 😄 |
You can use something else instead of |
Ah I see. Thanks |
This should have been mentioned in the release notes. |
Motivation for this change
This is a rebase of #84139
A more declarative module for
gitlab-runner
with support for multiple services.Inspired by @arianvp's module.
Main changes:
DynamicUser
is used so no need for static user and group.nix
in docker via hostnix-daemon
.What is missing:
Global configuration could only be changed by editing. Fixed./var/lib/gitlab-runner/.gitlab-runner/config.toml
Please comment if you think that something else is missing or would be great to have.
Example config with four runner services:
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)