Restrict reproducible-build dirty check to dockerignore-allowed paths#67663
Conversation
Official airflow-core builds use a deny-by-default `.dockerignore` plus an explicit allowlist (`!path`) and run inside a docker container that sees only the allowlisted files. Inside the container, `git is_dirty()` flags every tracked-but-not-COPYed file as a deletion (~220 files, ~30k lines), and every clean-tag release ships with a misleading `git_version = .dev0+<SHA>.dirty` instead of `.release:<SHA>`. Restrict the dirty check to paths in the dockerignore allowlist (parsed at build time so it stays in sync) so a clean tag produces a `.release:<SHA>` git_version. Falls back to the previous global `is_dirty()` when `.dockerignore` is absent or unparseable.
a17beec to
7d201f7
Compare
|
@jscheffl You're right — this is build-tooling, not user-facing. I've dropped the newsfragment from this PR. Rather than just fixing it here, I'd prefer to update the expectation for everyone so agents stop adding these in the first place: opened #67982, which adds a golden rule to Drafted-by: Claude Code (Opus 4.8); reviewed by @potiuk before posting |
I thought the statement was clear before... but let's hoep the PR makes it clearrer. |
Summary
Restrict the reproducible-build
dirtycheck inairflow-core/hatch_build.pyto paths inside the docker build context(per
.dockerignore). Without this, official airflow-core releasesship with a misleading
git_version = .dev0+<SHA>.dirtyeven whenbuilt from a clean tag, because the deny-by-default
.dockerignoreexcludes ~220 tracked top-level files from
COPY . /opt/airflow,so
git is_dirty()inside the container reports them as deletions.Verified against 3.2.2rc3:
apache_airflow_corewheel'sairflow/git_version=.dev0+cde4885818be51a6cdcfdf9275e100bf070025de.dirty.release:<SHA>Test plan
apache-airflow-corewheel via docker onmainwith the fix —git_versionis now.release:<SHA>(no.dirtysuffix)modifying
airflow-core/README.md→ restricted check returnsTruemodifying
.asf.yaml→ restricted check returnsFalseprek run mypy-airflow-corepassesruff format/ruff checkcleanrepo.is_dirty()when.dockerignoreis missingor has no
!entries (preserves prior behavior in unusual contexts)Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.7) following the guidelines