Skip to content

fix(pre-commit): remove Docker requirement for ruff hooks - #20012

Merged
shirshanka merged 3 commits into
masterfrom
fix/pre-commit-ruff-no-docker
Sep 26, 2026
Merged

shirshanka merged 3 commits into
masterfrom
fix/pre-commit-ruff-no-docker

Conversation

@shirshanka

@shirshanka shirshanka commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Ruff pre-commit hooks previously used language: docker_image, requiring Docker for every commit/push. When Docker is unavailable or has storage issues (e.g. ENOSPC/corrupted containerd), commits and pushes are completely blocked.
  • Added a wrapper script (run_ruff.sh) that uses a local ruff install when available and falls back to the Docker image only when ruff is not on PATH.
  • Updated the generator (generate_pre_commit.py) and regenerated .pre-commit-config.yaml.

Test plan

  • pre-commit run ruff-check --files metadata-ingestion/src/datahub/cli/cli_utils.py passes with local ruff
  • pre-commit run ruff-format --files metadata-ingestion/src/datahub/cli/cli_utils.py --hook-stage pre-push passes with local ruff
  • Verify Docker fallback works when local ruff is not on PATH (e.g. PATH=/usr/bin bash .github/scripts/pre-commit/run_ruff.sh check metadata-ingestion/src/datahub/cli/cli_utils.py)

Summary by cubic

Removes the Docker requirement for the ruff pre-commit hooks so commits and pushes no longer fail when Docker is unavailable or misbehaving (e.g. ENOSPC or corrupted containerd state).

  • Adds run_ruff.sh, which runs a local ruff when it's on PATH and falls back to the pinned Docker image (ghcr.io/astral-sh/ruff:0.15.22) only when it isn't.
  • Warns when the local ruff version differs from the pinned 0.15.22.
  • The Docker fallback runs with the host uid/gid to avoid root-owned files and .ruff_cache on Linux.
  • Switches both ruff-check and ruff-format from language: docker_image to language: system and updates the generator and regenerated .pre-commit-config.yaml.
  • Prints install guidance for ruff or Docker when neither is found.

Written for commit 85dce51. Summary will update on new commits.

Review in cubic

The ruff pre-commit hooks used `language: docker_image` which required
Docker to be running for every commit and push. This blocks developers
when Docker is not available or has storage issues.

Switch to a wrapper script (run_ruff.sh) that prefers a local ruff
install and falls back to the Docker image only when ruff is not on
PATH. Both the generator and the generated .pre-commit-config.yaml
are updated.
@github-actions github-actions Bot added the devops PR or Issue related to DataHub backend & deployment label Sep 26, 2026
@cursor

cursor Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

PR Summary

Overview
Ruff pre-commit hooks no longer require Docker on every run. The generator now emits language: system hooks that invoke run_ruff.sh instead of the pinned ghcr.io/astral-sh/ruff:0.15.22 docker_image entries for ruff-check and ruff-format; .pre-commit-config.yaml is regenerated to match.

The new wrapper runs local ruff when it is on PATH (with a stderr warning if the version differs from 0.15.22), otherwise falls back to the same pinned image via docker run (host uid/gid, repo mounted at /src). If neither tool is available, it exits with install hints for ruff or Docker.

Reviewed by Cursor Bugbot for commit 85dce51. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit baa4e93. Configure here.

Comment thread .github/scripts/pre-commit/run_ruff.sh Outdated
Prevents root-owned files and .ruff_cache when the Docker fallback
rewrites files on Linux.
shift

if command -v ruff &>/dev/null; then
exec ruff "$subcmd" "$@"

@devashish2203 devashish2203 Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check the version of ruff also

@shirshanka
shirshanka enabled auto-merge (squash) September 26, 2026 18:02
@shirshanka
shirshanka merged commit e9eaf1b into master Sep 26, 2026
44 of 45 checks passed
@shirshanka
shirshanka deleted the fix/pre-commit-ruff-no-docker branch September 26, 2026 18:06

This branch was successfully deployed

No deployments
Preview — 85dce51c Deployed Sep 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops PR or Issue related to DataHub backend & deployment pending-submitter-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants