Skip to content

Commit 58babac

Browse files
ci(kernel-e2e): route cargo through JFrog + audit cleanups
databricks-protected-runner-group blocks direct egress to index.crates.io, so the maturin build was failing with SSL EOF on the cargo metadata step. Extend setup-jfrog with an opt-in `configure-cargo` input that writes ~/.cargo/config.toml + credentials.toml against the JFrog db-cargo-remote proxy (recipe borrowed verbatim from databricks-odbc's setup-jfrog action) and forward it through setup-poetry so the kernel-e2e workflow can enable it without bypassing the wrapper. Bundled cleanups from a workflow audit: - Drop the redundant `Set up Python 3.10` step — setup-poetry runs actions/setup-python internally at the matching version. - Smoke-check now uses `$CONNECTOR_VENV_PY` (same interpreter we built the wheel with), so a wheel installed into the wrong venv would surface here rather than be masked by `poetry run python` re-resolving. - Post `Kernel E2E` check on the labelled-PR path as well as the merge-queue path; previously the PR would still show the synthetic-success check forever even after a real labelled run failed. - Add a comment to fetch-depth: 0 explaining why we keep it. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
1 parent dd0245d commit 58babac

3 files changed

Lines changed: 75 additions & 10 deletions

File tree

.github/actions/setup-jfrog/action.yml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
name: Setup JFrog OIDC
2-
description: Obtain a JFrog access token via GitHub OIDC and configure pip to use JFrog PyPI proxy
2+
description: Obtain a JFrog access token via GitHub OIDC and configure pip / cargo to use JFrog package proxies
3+
4+
inputs:
5+
configure-cargo:
6+
description: |
7+
Write ~/.cargo/config.toml + credentials.toml pointing at the
8+
Databricks JFrog Cargo proxy. Required for any job that runs
9+
`cargo` on `databricks-protected-runner-group`, where direct
10+
access to index.crates.io is blocked. Off by default because
11+
most jobs in this repo are Python-only.
12+
default: "false"
313

414
runs:
515
using: composite
@@ -30,3 +40,34 @@ runs:
3040
set -euo pipefail
3141
echo "PIP_INDEX_URL=https://gha-service-account:${JFROG_ACCESS_TOKEN}@databricks.jfrog.io/artifactory/api/pypi/db-pypi/simple" >> "$GITHUB_ENV"
3242
echo "pip configured to use JFrog registry"
43+
44+
- name: Configure Cargo
45+
if: inputs.configure-cargo == 'true'
46+
shell: bash
47+
# databricks-protected-runner-group blocks direct egress to
48+
# index.crates.io, so cargo must route through JFrog's
49+
# db-cargo-remote proxy. Mirrors the recipe used in
50+
# databricks-odbc's setup-jfrog action.
51+
#
52+
# Note: JFrog's Cargo proxy quarantines crates released within
53+
# the last 7 days. If a fresh dependency version isn't yet
54+
# mirrored, the build will fail until JFrog ingests it — bump
55+
# Cargo.lock to an older version or wait it out.
56+
run: |
57+
set -euo pipefail
58+
mkdir -p ~/.cargo
59+
cat > ~/.cargo/config.toml << 'EOF'
60+
[source.crates-io]
61+
replace-with = "jfrog"
62+
[source.jfrog]
63+
registry = "sparse+https://databricks.jfrog.io/artifactory/api/cargo/db-cargo-remote/index/"
64+
[registries.jfrog]
65+
index = "sparse+https://databricks.jfrog.io/artifactory/api/cargo/db-cargo-remote/index/"
66+
credential-provider = ["cargo:token"]
67+
EOF
68+
cat > ~/.cargo/credentials.toml << EOF
69+
[registries.jfrog]
70+
token = "Bearer ${JFROG_ACCESS_TOKEN}"
71+
EOF
72+
echo "CARGO_REGISTRIES_JFROG_TOKEN=Bearer ${JFROG_ACCESS_TOKEN}" >> "$GITHUB_ENV"
73+
echo "Cargo configured to use JFrog registry"

.github/actions/setup-poetry/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,21 @@ inputs:
1717
description: Extra suffix for the cache key to avoid collisions across job variants
1818
required: false
1919
default: ""
20+
configure-cargo:
21+
description: |
22+
Forwarded to setup-jfrog. Set to "true" for jobs that also need
23+
Cargo configured against the JFrog crates proxy (e.g. anything
24+
that builds a Rust extension via maturin).
25+
required: false
26+
default: "false"
2027

2128
runs:
2229
using: composite
2330
steps:
2431
- name: Setup JFrog
2532
uses: ./.github/actions/setup-jfrog
33+
with:
34+
configure-cargo: ${{ inputs.configure-cargo }}
2635

2736
- name: Set up python ${{ inputs.python-version }}
2837
id: setup-python

.github/workflows/kernel-e2e.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ jobs:
163163
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
164164
with:
165165
ref: ${{ steps.refs.outputs.head_sha }}
166+
# Full history so `git diff BASE_SHA HEAD_SHA` resolves both
167+
# commits regardless of how far base has diverged. The repo
168+
# is small enough that depth 0 costs only a few seconds.
166169
fetch-depth: 0
167170

168171
- name: Detect kernel-relevant changes
@@ -245,11 +248,10 @@ jobs:
245248
token: ${{ steps.app-token.outputs.token }}
246249
path: databricks-sql-kernel
247250

248-
- name: Set up Python 3.10
249-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
250-
with:
251-
python-version: "3.10"
252-
251+
# `setup-poetry` below runs `actions/setup-python` internally
252+
# with the matching version, so we don't repeat it here. We do
253+
# set up the Rust toolchain + cargo cache before maturin so they
254+
# are on PATH when the kernel build step runs.
253255
- name: Set up Rust toolchain
254256
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2
255257

@@ -266,12 +268,16 @@ jobs:
266268
sudo apt-get update
267269
sudo apt-get install -y libkrb5-dev
268270
269-
- name: Setup Poetry + connector deps
271+
- name: Setup Poetry + connector deps (and Cargo via JFrog)
270272
uses: ./.github/actions/setup-poetry
271273
with:
272274
python-version: "3.10"
273275
install-args: "--all-extras"
274276
cache-suffix: "kernel-e2e-"
277+
# databricks-protected-runner-group blocks index.crates.io;
278+
# route cargo through the JFrog db-cargo-remote proxy so
279+
# maturin's cargo invocation below can resolve deps.
280+
configure-cargo: "true"
275281

276282
- name: Install maturin into the connector venv
277283
# The connector's poetry venv is in-project (.venv at repo
@@ -298,14 +304,23 @@ jobs:
298304
run: $CONNECTOR_VENV_PY -m maturin develop --release
299305

300306
- name: Smoke-check kernel import
307+
# Use the same interpreter we built the wheel with, so a wheel
308+
# accidentally installed into the wrong venv would be visible
309+
# here rather than masked by `poetry run python` re-resolving.
301310
run: |
302-
poetry run python -c "import databricks_sql_kernel as k; assert k.__file__, 'kernel module has no __file__ — wheel install failed'; print('kernel ok:', k.__file__)"
311+
$CONNECTOR_VENV_PY -c "import databricks_sql_kernel as k; assert k.__file__, 'kernel module has no __file__ — wheel install failed'; print('kernel ok:', k.__file__)"
303312
304313
- name: Run kernel e2e tests
305314
run: poetry run pytest tests/e2e/test_kernel_backend.py -v
306315

316+
# Post a Kernel E2E check on both the labeled-PR and merge-queue
317+
# paths so the named check on the PR reflects the latest real
318+
# run (overwriting the synthetic-success check that
319+
# skip-kernel-e2e-pr posted on the initial open). Without this
320+
# the PR would still show synthetic-success even after a real
321+
# labeled run failed.
307322
- name: Post Kernel E2E check (success)
308-
if: success() && github.event_name == 'merge_group'
323+
if: success()
309324
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
310325
with:
311326
github-token: ${{ github.token }}
@@ -325,7 +340,7 @@ jobs:
325340
});
326341
327342
- name: Post Kernel E2E check (failure)
328-
if: failure() && github.event_name == 'merge_group'
343+
if: failure()
329344
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
330345
with:
331346
github-token: ${{ github.token }}

0 commit comments

Comments
 (0)