@@ -36,6 +36,53 @@ yq eval-all '. as $item ireduce ({}; . *+ $item)' "${__dir}/generated-assertoor-
3636mv " ${__dir} /generated-assertoor-config-final.yaml" " ${__dir} /generated-assertoor-config.yaml"
3737rm " ${__dir} /generated-assertoor-config-custom.yaml"
3838
39+ # Resolve container hostnames to IPs for running assertoor outside Docker
40+ # Kurtosis service hostnames need to be resolved via Docker network inspection
41+ DOCKER_NETWORK=" kt-${ENCLAVE_NAME} "
42+
43+ # Build a map of service hostnames to container IPs
44+ declare -A hostname_to_ip
45+
46+ echo " Building hostname to IP mapping from Docker network..."
47+ # Get all container info from the kurtosis network
48+ # Format: container_name -> IP
49+ while IFS= read -r line; do
50+ if [ -n " $line " ]; then
51+ container_name=$( echo " $line " | cut -d' |' -f1)
52+ container_ip=$( echo " $line " | cut -d' |' -f2 | cut -d' /' -f1)
53+ # Kurtosis container names are like: service--uuid
54+ # Remove the trailing --uuid to get the service name (hostname)
55+ service_name=$( echo " $container_name " | sed ' s/--[a-f0-9]*$//' )
56+ if [ -n " $service_name " ] && [ -n " $container_ip " ]; then
57+ hostname_to_ip[" $service_name " ]=" $container_ip "
58+ fi
59+ fi
60+ done < <( docker network inspect " $DOCKER_NETWORK " --format ' {{range $id, $container := .Containers}}{{$container.Name}}|{{$container.IPv4Address}}{{"\n"}}{{end}}' 2> /dev/null)
61+
62+ # Extract all hostnames from URLs in the config and resolve them
63+ echo " Resolving container hostnames to IPs..."
64+ config_content=$( cat " ${__dir} /generated-assertoor-config.yaml" )
65+
66+ # Get unique hostnames from http:// URLs (matches pattern http://hostname:port)
67+ hostnames=$( echo " $config_content " | grep -oE ' http://[a-zA-Z0-9_-]+:[0-9]+' | sed ' s|http://||' | cut -d' :' -f1 | sort -u)
68+
69+ for hostname in $hostnames ; do
70+ ip=" ${hostname_to_ip[$hostname]} "
71+ if [ -n " $ip " ]; then
72+ echo " $hostname -> $ip "
73+ config_content=$( echo " $config_content " | sed " s|http://${hostname} :|http://${ip} :|g" )
74+ else
75+ echo " WARNING: Could not resolve $hostname "
76+ fi
77+ done
78+
79+ echo " $config_content " > " ${__dir} /generated-assertoor-config.yaml"
80+
81+ if [ -f " ${__dir} /custom-ai-config.yaml" ]; then
82+ ai_config_file=" ${__dir} /custom-ai-config.yaml"
83+ cat " $ai_config_file " | envsubst >> " ${__dir} /generated-assertoor-config.yaml"
84+ fi
85+
3986cat << EOF
4087============================================================================================================
4188Assertoor config at ${__dir} /generated-assertoor-config.yaml
0 commit comments