@@ -33,8 +33,11 @@ MACAddress={guest_mac}
3333[Network]
3434Address={client_ip}/30
3535Gateway={host_ip}
36+ DNS=1.1.1.1
3637"# ;
3738
39+ const RESOLV_CONF : & str = "nameserver 1.1.1.1\n options use-vc\n " ;
40+
3841/// Inject runner.service, eth.network, and service symlink into a mounted rootfs.
3942#[ instrument( skip( network) , fields( mount_point = %mount_point, runner_name, role) ) ]
4043pub fn inject_config (
@@ -47,6 +50,7 @@ pub fn inject_config(
4750) -> Result < ( ) > {
4851 inject_runner_service ( mount_point, github_org, github_token, runner_name, labels) ?;
4952 inject_network_config ( mount_point, network) ?;
53+ inject_resolv_conf ( mount_point) ?;
5054 enable_runner_service ( mount_point) ?;
5155 Ok ( ( ) )
5256}
@@ -94,6 +98,14 @@ fn inject_network_config(mount_point: &Utf8Path, network: &NetworkAllocation) ->
9498 Ok ( ( ) )
9599}
96100
101+ fn inject_resolv_conf ( mount_point : & Utf8Path ) -> Result < ( ) > {
102+ let resolv_path = mount_point. join ( "etc/resolv.conf" ) ;
103+ fs:: write ( & resolv_path, RESOLV_CONF )
104+ . with_context ( || format ! ( "failed to write {}" , resolv_path) ) ?;
105+ info ! ( path = %resolv_path, "injected resolv.conf" ) ;
106+ Ok ( ( ) )
107+ }
108+
97109fn enable_runner_service ( mount_point : & Utf8Path ) -> Result < ( ) > {
98110 let wants_dir = mount_point. join ( "etc/systemd/system/multi-user.target.wants" ) ;
99111 fs:: create_dir_all ( & wants_dir) . with_context ( || format ! ( "failed to create {}" , wants_dir) ) ?;
0 commit comments