mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-26 20:44:00 +00:00
## Summary
Fixes four high-severity Aikido findings in CI and the Dockerfile.
- **Workflow permissions:** `npm-publish.yml` and
`codex-update-lance-dependency.yml` now set `permissions: {}` at the
workflow level and grant permissions per job.
- `npm-publish`: only `publish` gets `id-token: write` (npm provenance).
Nothing in the workflow needed `contents: write`, so every job is now
read-only.
- `codex-update-lance-dependency`: keeps `contents: write`, because the
branch is pushed with the checkout token. It drops `pull-requests:
write` and `actions: read`, because all `gh` calls use `ROBOT_TOKEN`.
- **license-header-check:** replaces `curl .../master/install.sh | bash`
with `go install …@v1.5.0`. Go verifies the module against
sum.golang.org, so we don't maintain a hash ourselves. Go is
preinstalled on `ubuntu-latest`.
- **Dockerfile:** drops the rustup `curl | sh` along with
`build-essential`, `protoc`, and `git`, and runs as a non-root `lancedb`
user. `lancedb` installs from prebuilt `manylinux_2_28` wheels, and the
toolchain was only needed for the tantivy FTS support removed in #3282.
Alternatives considered for the Dockerfile, in case we want Rust in the
image:
- `COPY --from=rust:<ver>-slim-bookworm@sha256:…` to copy the toolchain
from the official image, pinned by digest.
- Download `rustup-init` from `static.rust-lang.org` and check it
against the published `.sha256`.
Neither seemed worth it for an image that only runs `pip install
lancedb`.
## Evidence
- In a clean Python 3.12 venv, `pip install --only-binary :all: lancedb`
installed 0.41.0, and building an FTS index and querying it worked.
Docker wasn't available, so the image itself wasn't built.
- Running `license-header-checker` v1.5.0 installed via `go install`
over `rust/` reports `license_ok: 258 files`.
- This PR runs both the `npm-publish` dry run and
`license-header-check`, because both workflows' path filters include
their own files.
## Merge Risk
**Door:** two-way; CI config and an example Dockerfile only.
**Blast Radius:** release automation. If `npm publish` or the Codex bump
job needs a permission I removed, it will fail on the next tag or
dispatch, and restoring that one permission fixes it.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
94 lines
3.3 KiB
YAML
94 lines
3.3 KiB
YAML
name: Codex Update Lance Dependency
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
tag:
|
|
description: "Tag name from Lance (e.g. `v7.2.0-beta.1`). If omitted, the newest release is resolved automatically — stable releases are preferred over pre-releases — and the run is skipped if it is not newer than the version currently pinned in Cargo.toml."
|
|
required: false
|
|
default: ""
|
|
type: string
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Tag name from Lance (e.g. `v7.2.0-beta.1`). Leave empty to resolve the newest release automatically — stable releases are preferred over pre-releases — and skip the run if it is not newer than the version currently pinned in Cargo.toml."
|
|
required: false
|
|
default: ""
|
|
type: string
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
update:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
# Pushes the branch with the checkout token. PR creation uses ROBOT_TOKEN.
|
|
contents: write
|
|
steps:
|
|
- name: Show inputs
|
|
run: |
|
|
echo "tag = ${{ inputs.tag || 'latest' }}"
|
|
|
|
- name: Checkout Repo LanceDB
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: true
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install Codex CLI
|
|
run: npm install -g @openai/codex
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
|
|
with:
|
|
toolchain: stable
|
|
components: clippy, rustfmt
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y protobuf-compiler libssl-dev
|
|
|
|
- name: Install cargo-info
|
|
run: cargo install cargo-info
|
|
|
|
- name: Install Python dependencies
|
|
run: python3 -m pip install --upgrade pip packaging
|
|
|
|
- name: Configure git user
|
|
run: |
|
|
git config user.name "lancedb automation"
|
|
git config user.email "robot@lancedb.com"
|
|
|
|
- name: Run Codex to update Lance dependency
|
|
env:
|
|
TAG: ${{ inputs.tag }}
|
|
GITHUB_TOKEN: ${{ secrets.ROBOT_TOKEN }}
|
|
GH_TOKEN: ${{ secrets.ROBOT_TOKEN }}
|
|
OPENAI_API_KEY: ${{ secrets.CODEX_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
TARGET_TAG="${TAG:-latest}"
|
|
|
|
cat <<EOF >/tmp/codex-prompt.txt
|
|
You are running inside the lancedb repository on a GitHub Actions runner.
|
|
|
|
Use \$lancedb-update-lance-dependency with target "${TARGET_TAG}".
|
|
|
|
Constraints:
|
|
- Use env "GH_TOKEN" for GitHub operations.
|
|
- Do not merge the pull request.
|
|
- Do not force-push.
|
|
- Do not create a duplicate pull request if an open PR already exists for the target Lance version.
|
|
- If any command fails, diagnose and fix the root cause instead of aborting.
|
|
- After creating the PR, display the PR URL, "git status --short", and a concise summary of the commands run and their results.
|
|
EOF
|
|
|
|
printenv OPENAI_API_KEY | codex login --with-api-key
|
|
codex --config shell_environment_policy.ignore_default_excludes=true exec --dangerously-bypass-approvals-and-sandbox "$(cat /tmp/codex-prompt.txt)"
|