nixosTests.gitlab: add minimal test for gitlab-container-registry

(cherry picked from commit cd7583a7d9)
This commit is contained in:
Leona Maroni
2025-03-14 16:44:34 +01:00
committed by Yaya
parent 4c8bce7994
commit 1684051e55

View File

@@ -42,6 +42,10 @@ in
environment.systemPackages = with pkgs; [ git ];
networking.hosts."127.0.0.1" = [
"registry.localhost"
"pages.localhost"
];
virtualisation.memorySize = 6144;
virtualisation.cores = 4;
virtualisation.useNixStoreImage = true;
@@ -59,6 +63,12 @@ in
localhost = {
locations."/".proxyPass = "http://unix:/run/gitlab/gitlab-workhorse.socket";
};
"pages.localhost" = {
locations."/".proxyPass = "http://localhost:8090";
};
"registry.localhost" = {
locations."/".proxyPass = "http://localhost:4567";
};
};
};
@@ -78,7 +88,7 @@ in
smtp.enable = true;
pages = {
enable = true;
settings.pages-domain = "localhost";
settings.pages-domain = "pages.localhost";
};
extraConfig = {
incoming_email = {
@@ -98,6 +108,14 @@ in
jwsFile = pkgs.runCommand "oidcKeyBase" { } "${pkgs.openssl}/bin/openssl genrsa 2048 > $out";
};
registry = {
enable = true;
certFile = "/var/lib/gitlab/registry_auth_cert";
keyFile = "/var/lib/gitlab/registry_auth_key";
externalAddress = "registry.localhost";
externalPort = 443;
};
# reduce memory usage
sidekiq.concurrency = 1;
puma.workers = 2;
@@ -210,6 +228,7 @@ in
gitlab.wait_for_unit("gitlab-sidekiq.service")
gitlab.wait_for_file("${nodes.gitlab.services.gitlab.statePath}/tmp/sockets/gitlab.socket")
gitlab.wait_until_succeeds("curl -sSf http://gitlab/users/sign_in")
gitlab.wait_for_unit("docker-registry.service")
'';
# The actual test of GitLab. Only push data to GitLab if
@@ -447,6 +466,10 @@ in
"""
)
gitlab.succeed("test -s /tmp/archive.tar.bz2")
''
+ ''
with subtest("Test docker registry http is available"):
gitlab.succeed("curl -sSf http://registry.localhost")
'';
in