Skip to content

Restrict reproducible-build dirty check to dockerignore-allowed paths#67663

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:fix-dirty-marker-via-dockerignore
Jun 4, 2026
Merged

Restrict reproducible-build dirty check to dockerignore-allowed paths#67663
potiuk merged 1 commit into
apache:mainfrom
potiuk:fix-dirty-marker-via-dockerignore

Conversation

@potiuk

@potiuk potiuk commented May 28, 2026

Copy link
Copy Markdown
Member

Summary

Restrict the reproducible-build dirty check in
airflow-core/hatch_build.py to paths inside the docker build context
(per .dockerignore). Without this, official airflow-core releases
ship with a misleading git_version = .dev0+<SHA>.dirty even when
built from a clean tag, because the deny-by-default .dockerignore
excludes ~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:

  • before fix: apache_airflow_core wheel's airflow/git_version =
    .dev0+cde4885818be51a6cdcfdf9275e100bf070025de.dirty
  • after fix: .release:<SHA>

Test plan

  • Built apache-airflow-core wheel via docker on main with the fix —
    git_version is now .release:<SHA> (no .dirty suffix)
  • Dirty detection still fires for genuine in-context changes:
    modifying airflow-core/README.md → restricted check returns True
  • Dockerignored-only changes no longer trip dirty:
    modifying .asf.yaml → restricted check returns False
  • prek run mypy-airflow-core passes
  • ruff format / ruff check clean
  • Falls back to repo.is_dirty() when .dockerignore is missing
    or has no ! entries (preserves prior behavior in unusual contexts)

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.7)

Generated-by: Claude Code (Opus 4.7) following the guidelines

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.
potiuk added a commit to potiuk/airflow that referenced this pull request May 28, 2026
@potiuk
potiuk requested review from jscheffl and vatsrahul1001 May 28, 2026 22:08
Comment thread airflow-core/newsfragments/67663.misc.rst Outdated
@potiuk
potiuk force-pushed the fix-dirty-marker-via-dockerignore branch from a17beec to 7d201f7 Compare June 3, 2026 23:04
@potiuk

potiuk commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

@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 AGENTS.md (the file all agents read via the CLAUDE.md symlink) — never create a newsfragment unless the change is certainly user-facing, and when in doubt omit it.


Drafted-by: Claude Code (Opus 4.8); reviewed by @potiuk before posting

@jscheffl

jscheffl commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@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 AGENTS.md (the file all agents read via the CLAUDE.md symlink) — never create a newsfragment unless the change is certainly user-facing, and when in doubt omit it.

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.

@potiuk
potiuk merged commit f32991b into apache:main Jun 4, 2026
126 of 127 checks passed
@potiuk
potiuk deleted the fix-dirty-marker-via-dockerignore branch June 4, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants