Skip to content

Commit b443456

Browse files
anandgupta42claude
andcommitted
ci(e2e): review fixes — gtimeout fallback, setup-python interpreter, read-only token
- setup-resolve.sh: `with_timeout` falls back to Homebrew's `gtimeout` on macOS, so the cached-env check is bounded there too (cubic). - setup-resolve.sh: `find_real_python` honours `DBT_E2E_PYTHON`; the workflow sets it to the interpreter actions/setup-python installed, so the scenario venvs no longer build on the runner image's /usr/bin/python3 while the workflow believes it chose 3.11 (CodeRabbit). - ci.yml: the E2E job now runs pull-request code, so it gets `permissions: contents: read` and `persist-credentials: false`, matching the tracker-leaks job (CodeRabbit). Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent 3a4c993 commit b443456

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

‎.github/workflows/ci.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,14 +559,21 @@ jobs:
559559
if: github.event_name == 'push' || needs.changes.outputs.dbt-tools == 'true'
560560
runs-on: ubuntu-latest
561561
timeout-minutes: 10
562+
# Runs pull-request code (setup scripts, tests), so it gets the same
563+
# read-only token scope and no persisted credentials as tracker-leaks.
564+
permissions:
565+
contents: read
562566
steps:
563567
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
568+
with:
569+
persist-credentials: false
564570

565571
- uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2
566572
with:
567573
bun-version: "1.3.14"
568574

569575
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
576+
id: python
570577
with:
571578
python-version: "3.11"
572579

@@ -598,6 +605,10 @@ jobs:
598605
- name: Set up Python env scenarios
599606
run: ./test/e2e/setup-resolve.sh venv uv system
600607
working-directory: packages/dbt-tools
608+
env:
609+
# Build the scenario venvs on the interpreter setup-python installed,
610+
# not the image's /usr/bin/python3; setup-resolve.sh honours this.
611+
DBT_E2E_PYTHON: ${{ steps.python.outputs.python-path }}
601612

602613
- name: Run dbt-tools E2E tests
603614
run: bun run test:e2e

‎packages/dbt-tools/test/e2e/setup-resolve.sh‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ fail() { echo " ✗ $1 — $2"; }
4141
# `.done` marker alone therefore proves nothing; a cached environment counts
4242
# only if its dbt actually runs.
4343
with_timeout() {
44-
if has timeout; then timeout "$TIMEOUT" "$@"; else "$@"; fi
44+
# GNU timeout on Linux; Homebrew coreutils installs it as gtimeout on macOS.
45+
# Without either, the check still runs, just unbounded.
46+
if has timeout; then timeout "$TIMEOUT" "$@"
47+
elif has gtimeout; then gtimeout "$TIMEOUT" "$@"
48+
else "$@"; fi
4549
}
4650
env_ok() {
4751
[ -x "$1" ] && with_timeout "$1" --version >/dev/null 2>&1
@@ -58,6 +62,10 @@ cached_or_rebuild() {
5862

5963
# Find a real (non-shim) python3 for venv creation
6064
find_real_python() {
65+
# An explicit interpreter wins. CI sets DBT_E2E_PYTHON to the interpreter
66+
# actions/setup-python installed, so the venvs build on the Python the
67+
# workflow chose rather than whatever the runner image happens to ship.
68+
if [ -n "${DBT_E2E_PYTHON:-}" ] && [ -x "$DBT_E2E_PYTHON" ]; then echo "$DBT_E2E_PYTHON"; return; fi
6169
# Try pyenv's actual python first
6270
if has pyenv; then
6371
local p

0 commit comments

Comments
 (0)