nixos/git: Fix Actions runner cache timeout
Job containers using actions/cache hung and timed out reaching the runner's built-in artifact cache server. With cache.host unset, act_runner announced the box's autodetected outbound address, which containers on podman0 can't route back to; even to the right address the host input chain (policy drop) dropped the connection, as only the forward chain was opened for the podman subnet. Pin cache.host to the podman bridge gateway and cache.port to a fixed value, and open that one port on podman0 in the input chain. Declare the podman subnet once in the box file and derive the gateway, the default_subnet and both firewall rules from it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,8 @@ in
|
|||||||
let
|
let
|
||||||
inherit (lib) mkMerge;
|
inherit (lib) mkMerge;
|
||||||
inherit (lib.my) networkdAssignment;
|
inherit (lib.my) networkdAssignment;
|
||||||
|
|
||||||
|
podmanSubnet = "10.88.0.0/16";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
@@ -158,7 +160,7 @@ in
|
|||||||
oci-containers = {
|
oci-containers = {
|
||||||
backend = "podman";
|
backend = "podman";
|
||||||
};
|
};
|
||||||
containers.containersConf.settings.network.default_subnet = "10.88.0.0/16";
|
containers.containersConf.settings.network.default_subnet = podmanSubnet;
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
@@ -195,7 +197,7 @@ in
|
|||||||
extraRules = ''
|
extraRules = ''
|
||||||
table inet filter {
|
table inet filter {
|
||||||
chain forward {
|
chain forward {
|
||||||
ip saddr 10.88.0.0/16 accept
|
ip saddr ${podmanSubnet} accept
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
{ lib, pkgs, config, ... }:
|
{ lib, pkgs, config, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib) mkForce;
|
inherit (lib) mkForce;
|
||||||
|
inherit (lib.my) net;
|
||||||
inherit (lib.my.c) pubDomain;
|
inherit (lib.my.c) pubDomain;
|
||||||
|
|
||||||
|
# The podman bridge gateway (first host of the default subnet); job
|
||||||
|
# containers reach the runner's artifact cache server here, through a single
|
||||||
|
# fixed port opened in the firewall below.
|
||||||
|
podmanGateway = net.cidr.host 1 config.virtualisation.containers.containersConf.settings.network.default_subnet;
|
||||||
|
cachePort = 34567;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = {
|
config = {
|
||||||
@@ -34,6 +41,11 @@ in
|
|||||||
cache = {
|
cache = {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
dir = "/var/cache/gitea-runner";
|
dir = "/var/cache/gitea-runner";
|
||||||
|
# Announce the podman bridge gateway rather than let act_runner
|
||||||
|
# autodetect the box's outbound address, which containers can't
|
||||||
|
# route back to.
|
||||||
|
host = podmanGateway;
|
||||||
|
port = cachePort;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -73,6 +85,15 @@ in
|
|||||||
group = "gitea-runner";
|
group = "gitea-runner";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Let job containers reach the runner's artifact cache server on the host.
|
||||||
|
firewall.extraRules = ''
|
||||||
|
table inet filter {
|
||||||
|
chain input {
|
||||||
|
iifname "podman0" tcp dport ${toString cachePort} accept
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user