Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Harden the python-runner clone in CI (#85534)

Chris Vandoodewaard133f8dad608a
diff --git a/.github/actions/setup-python-runner/action.yml b/.github/actions/setup-python-runner/action.yml
index 304d160cd48..9a2e3d18df0 100644
--- a/.github/actions/setup-python-runner/action.yml
+++ b/.github/actions/setup-python-runner/action.yml
@@ -7,8 +7,30 @@ inputs:
runs:
using: composite
steps:
+ - name: Checkout metabase/python-runner-container
+ uses: actions/checkout@v7
+ with:
+ repository: metabase/python-runner-container
+ path: python-runner
+ token: ${{ inputs.metabase-automation-token }}
+ persist-credentials: false
+
- name: Setup python-runner
- run: ./.github/scripts/setup-python-runner.sh
+ id: setup
+ run: |
+ echo "Starting python-runner..."
+ cd python-runner
+ make run-ci 1> ../python-runner.out.log 2> ../python-runner.err.log
+ make logs 1>> ../python-runner.out.log 2>> ../python-runner.err.log &
+ shell: bash
+
+ - name: Print python-runner logs
+ if: ${{ failure() && steps.setup.outcome == 'failure' }}
+ run: |
+ echo "::group::python-runner stdout"
+ cat python-runner.out.log || true
+ echo "::endgroup::"
+ echo "::group::python-runner stderr"
+ cat python-runner.err.log || true
+ echo "::endgroup::"
shell: bash
- env:
- METABASE_AUTOMATION_USER_TOKEN: ${{ inputs.metabase-automation-token }}
diff --git a/.github/scripts/setup-python-runner.sh b/.github/scripts/setup-python-runner.sh
deleted file mode 100755
index 52ca501cdb4..00000000000
--- a/.github/scripts/setup-python-runner.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-set -e
-
-# Parse command line arguments
-SKIP_START=false
-
-while [[ $# -gt 0 ]]; do
- case $1 in
- --skip-start)
- SKIP_START=true
- shift
- ;;
- *)
- echo "Unknown option: $1"
- echo "Usage: $0 [--skip-start]"
- exit 1
- ;;
- esac
-done
-
-echo "Cloning python-runner repository..."
-# Send the token as a header: git keeps it on the same-host redirect, but drops credentials embedded in the URL.
-AUTH_HEADER="Authorization: Basic $(printf 'x-access-token:%s' "$METABASE_AUTOMATION_USER_TOKEN" | base64 -w0)"
-git -c http.extraHeader="$AUTH_HEADER" clone --depth 1 https://github.com/metabase/python-runner-container.git python-runner
-
-if [ "$SKIP_START" = false ]; then
- echo "Starting python-runner..."
- cd python-runner
- make run-ci 1> ../python-runner.out.log 2> ../python-runner.err.log
- make logs 1>> ../python-runner.out.log 2>> ../python-runner.err.log &
- cd ..
-fi
diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml
index 439a1003989..38857db3e7b 100644
--- a/.github/workflows/e2e-test.yml
+++ b/.github/workflows/e2e-test.yml
@@ -94,9 +94,9 @@ jobs:
- name: Setup python-runner
if: ${{ inputs.name == 'python' }}
- env:
- METABASE_AUTOMATION_USER_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- run: ./.github/scripts/setup-python-runner.sh
+ uses: ./.github/actions/setup-python-runner
+ with:
+ metabase-automation-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: Prepare Docker containers
uses: ./.github/actions/e2e-prepare-containers