From 18e8736a93b252465ca537e978c5b0b8a3219751 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 26 Mar 2021 15:39:42 +0200 Subject: Add buildos.{build,bootstrap,interactive}_timeout. cmdline variables --- buildos | 53 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/buildos b/buildos index a52a5e7..4bb44b9 100755 --- a/buildos +++ b/buildos @@ -287,21 +287,37 @@ function print () tu="$(toolchain_value "$tp" toolchain_url)" tt="$(toolchain_value "$tp" toolchain_trust)" - echo "$tn.nice: $tc" - echo "$tn.bridge: $tb" - echo "$tn.instances: $ti" - echo "$tn.interactive: $ta" - echo "$tn.toolchain_url: $tu" - echo "$tn.toolchain_trust: $tt" + tbt="$(toolchain_value "$tp" build_timeout)" + tst="$(toolchain_value "$tp" bootstrap_timeout)" + tat="$(toolchain_value "$tp" interactive_timeout)" + + echo "$tn.nice: $tc" + echo "$tn.bridge: $tb" + echo "$tn.instances: $ti" + echo "$tn.interactive: $ta" + echo "$tn.toolchain_url: $tu" + echo "$tn.toolchain_trust: $tt" + + if [ -n "$tbt" ]; then + echo "$tn.build_timeout: $tbt" + fi + + if [ -n "$tst" ]; then + echo "$tn.bootstrap_timeout: $tst" + fi + + if [ -n "$tat" ]; then + echo "$tn.interactive_timeout: $tat" + fi n="${tp}controller_url[@]" for i in "${!n}"; do - echo "$tn.controller_url: $i" + echo "$tn.controller_url: $i" done n="${tp}controller_trust[@]" for i in "${!n}"; do - echo "$tn.controller_trust: $i" + echo "$tn.controller_trust: $i" done echo @@ -814,6 +830,10 @@ function bbot_start () # local tv="$(toolchain_value "$tp" toolchain_fver)" local ts="$(toolchain_value "$tp" toolchain_file_csum)" + local tbt="$(toolchain_value "$tp" build_timeout)" + local tst="$(toolchain_value "$tp" bootstrap_timeout)" + local tat="$(toolchain_value "$tp" interactive_timeout)" + local id="/build/bots/$tn" mkdir -p "$id" @@ -889,6 +909,23 @@ function bbot_start () # -e "s#^ExecStart=[^ ]+(.*)#ExecStart=$id/bin/bbot-agent\1#" \ "$id/lib/systemd/system/bbot-agent@.service" + # Patch in build/bootstrap/interactive timeouts. + # + if [ -n "$tbt" ]; then + sed -i -r -e "s/^(Environment=BUILD_TIMEOUT)=.*/\1=$tbt/" \ + "$id/lib/systemd/system/bbot-agent@.service" + fi + + if [ -n "$tst" ]; then + sed -i -r -e "s/^(Environment=BOOTSTRAP_TIMEOUT)=.*/\1=$tst/" \ + "$id/lib/systemd/system/bbot-agent@.service" + fi + + if [ -n "$tat" ]; then + sed -i -r -e "s/^(Environment=INTERACTIVE_TIMEOUT)=.*/\1=$tat/" \ + "$id/lib/systemd/system/bbot-agent@.service" + fi + # Patch in the controller URLs. These can contain special characters # like `&` so we have to escape them. # -- cgit v1.1