diff --git a/scripts/install-worker-controller.sh b/scripts/install-worker-controller.sh index 891929f7..54cb9ac0 100755 --- a/scripts/install-worker-controller.sh +++ b/scripts/install-worker-controller.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -Eeuo pipefail set +x +export PYTHONDONTWRITEBYTECODE=1 repo_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) mode= diff --git a/scripts/test-install-worker-controller.sh b/scripts/test-install-worker-controller.sh index f8ac5ed9..4f78b10e 100755 --- a/scripts/test-install-worker-controller.sh +++ b/scripts/test-install-worker-controller.sh @@ -211,6 +211,7 @@ for dockerfile in "$repo_root/controller/Dockerfile" "$repo_root/runner/Dockerfi grep -Fq "LABEL org.opencontainers.image.revision=\"\${CI_FLEET_COMMIT}\"" "$dockerfile" || fail "managed image lacks engine provenance label: $dockerfile" done grep -Fq ' user: "0:0"' "$repo_root/deploy/compose.yaml" || fail 'controller cannot read the required root-owned mode-0600 GitHub App PEM' +grep -Fq 'export PYTHONDONTWRITEBYTECODE=1' "$repo_root/scripts/install-worker-controller.sh" || fail 'managed validation may write Python bytecode into the immutable manager release' grep -Fq "CI_FLEET_COMMIT: \${CI_FLEET_COMMIT:-unknown}" "$repo_root/deploy/compose.yaml" || fail 'runner build lacks engine provenance argument' config_repo=$tmp/config-repo git init -q "$config_repo" @@ -318,6 +319,7 @@ mv "$host_config.missing" "$host_config" second=$(expect_success "$installer" --install "${base_args[@]}" --ref "$ref_one") grep -Fq 'NO_CHANGE' <<<"$second" || fail 'idempotent rerun changed the host' expect_success "$installer" --check "${base_args[@]}" --ref "$ref_one" >/dev/null +[[ ! -d "$root/opt/ci-fleet/manager/releases/$engine_ref/templates/config-repository/scripts/__pycache__" ]] || fail 'manager validation wrote Python bytecode into the immutable release' python3 - "$install_state" <<'PY' import json import sys