changeset 267:a78f5986011f

discover bundled production runtimes Locate Bazel-packaged Copilot and Python binaries by stable suffix instead of hardcoding an external repository prefix. Co-authored-by: Copilot <[email protected]>
author MrJuneJune <me@mrjunejune.com>
date Fri, 07 Aug 2026 12:58:55 -0700
parents efaf4c63cc94
children f7b1188d5fb1
files mrjunejune/deploy.sh mrjunejune/production_entrypoint.sh mrjunejune/test/production_inference_bundle_test.sh
diffstat 3 files changed, 44 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mrjunejune/deploy.sh	Fri Aug 07 12:52:30 2026 -0700
+++ b/mrjunejune/deploy.sh	Fri Aug 07 12:58:55 2026 -0700
@@ -19,6 +19,24 @@
   "$staging/mrjunejune/production_entrypoint.sh" \
   "$staging/mrjunejune_server"
 
+copilot_cli="$(
+  sudo find -L "$staging" -type f \
+    -path '*/copilot_cli_linux_x86_64/copilot' -print -quit
+)"
+python_runtime="$(
+  sudo find -L "$staging" -type f \
+    -path '*/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/bin/python3' \
+    -print -quit
+)"
+if [[ -z "$copilot_cli" ]]; then
+  echo "Deployment bundle does not contain the Copilot CLI" >&2
+  exit 1
+fi
+if [[ -z "$python_runtime" ]]; then
+  echo "Deployment bundle does not contain the Python runtime" >&2
+  exit 1
+fi
+
 required_runtime=(
   "$staging/mrjunejune_server"
   "$staging/mrjunejune_server_binary"
@@ -27,8 +45,8 @@
   "$staging/mrjunejune/inference/copilot_sidecar.zip"
   "$staging/mrjunejune/inference/litellm_proxy.zip"
   "$staging/mrjunejune/inference/litellm_config.yaml"
-  "$staging/+http_archive+copilot_cli_linux_x86_64/copilot"
-  "$staging/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/bin/python3"
+  "$copilot_cli"
+  "$python_runtime"
 )
 for runtime_path in "${required_runtime[@]}"; do
   if [[ ! -e "$runtime_path" ]]; then
@@ -41,7 +59,8 @@
   "$staging/mrjunejune_server" \
   "$staging/mrjunejune/inference_stack.sh" \
   "$staging/mrjunejune/inference_sidecar_launcher.sh" \
-  "$staging/+http_archive+copilot_cli_linux_x86_64/copilot"
+  "$copilot_cli" \
+  "$python_runtime"
 sudo chown -R mrjunejune_server:zenbu_team "$staging"
 
 # Persistent database, config, and Copilot tokens stay outside the immutable
--- a/mrjunejune/production_entrypoint.sh	Fri Aug 07 12:52:30 2026 -0700
+++ b/mrjunejune/production_entrypoint.sh	Fri Aug 07 12:58:55 2026 -0700
@@ -4,11 +4,25 @@
 bundle_root="$(cd "$(dirname "$0")" && pwd)"
 cd "$bundle_root"
 
+copilot_cli="$(
+  find -L "$bundle_root" -type f \
+    -path '*/copilot_cli_linux_x86_64/copilot' -print -quit
+)"
+python_runtime="$(
+  find -L "$bundle_root" -type f \
+    -path '*/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/bin/python3' \
+    -print -quit
+)"
+if [[ -z "$copilot_cli" || -z "$python_runtime" ]]; then
+  echo "Production bundle is missing Copilot or Python runtime" >&2
+  exit 1
+fi
+
 exec "$bundle_root/mrjunejune/inference_stack.sh" \
   "$bundle_root/mrjunejune_server_binary" \
   "$bundle_root/mrjunejune/inference_sidecar_launcher.sh" \
   "$bundle_root/mrjunejune/inference/copilot_sidecar.zip" \
-  "$bundle_root/+http_archive+copilot_cli_linux_x86_64/copilot" \
+  "$copilot_cli" \
   "$bundle_root/mrjunejune/inference/litellm_proxy.zip" \
   "$bundle_root/mrjunejune/inference/litellm_config.yaml" \
-  "$bundle_root/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/bin/python3"
+  "$python_runtime"
--- a/mrjunejune/test/production_inference_bundle_test.sh	Fri Aug 07 12:52:30 2026 -0700
+++ b/mrjunejune/test/production_inference_bundle_test.sh	Fri Aug 07 12:58:55 2026 -0700
@@ -41,6 +41,12 @@
 entrypoint="$(find -L "$bundle" -type f -name production_entrypoint.sh -print -quit)"
 bash -n "$entrypoint"
 grep -q 'mrjunejune_server_binary' "$entrypoint"
+grep -q "copilot_cli_linux_x86_64/copilot" "$entrypoint"
+grep -q "rules_python++python+python_3_11_x86_64-unknown-linux-gnu/bin/python3" "$entrypoint"
+if grep -q '+http_archive+copilot_cli_linux_x86_64' "$entrypoint"; then
+  echo "Production entrypoint hardcodes one Bazel repository prefix" >&2
+  exit 1
+fi
 if grep -q 'MRJUNEJUNE_ALLOW_.*INFERENCE' "$entrypoint"; then
   echo "Production entrypoint must not override guest policy from .config" >&2
   exit 1