Skip to content

Stop git-sync v4 from silently overriding chart's ref value - #73415

Closed
mallesh-bot wants to merge 1 commit into
apache:mainfrom
mallesh-bot:fix-42918-git-sync-v4-ref-override
Closed

mallesh-bot wants to merge 1 commit into
apache:mainfrom
mallesh-bot:fix-42918-git-sync-v4-ref-override

Conversation

@mallesh-bot

Copy link
Copy Markdown

Summary

dags.gitSync.ref is documented as the v4 way to pin the git-sync sidecar to a branch, tag, or hash. In git-sync v4 the deprecated GIT_SYNC_BRANCH and GIT_SYNC_REV env vars take precedence over GITSYNC_REF (v3→v4 migration guide), but the chart's git_sync_container helper always emitted all three, so setting ref: v1.2.3 had no effect and the sidecar kept following the branch at rev.

This PR makes the emission conditional:

  • dags.gitSync.ref set → emit only GITSYNC_REF; drop the deprecated GIT_SYNC_BRANCH / GIT_SYNC_REV (so v4 honors ref).
  • dags.gitSync.ref unset → emit only the deprecated pair (so v3 images and v4-with-fallback keep working).

The default of dags.gitSync.ref is changed from v2-2-stable to ~, and the JSON schema is updated to allow null. Because the fallback branch continues to emit the deprecated vars, the default render is byte-equivalent for existing users — only users who explicitly set ref see behaviour change, and that behaviour now matches what the option documents.

Test plan

  • Rendered templates/scheduler/scheduler-deployment.yaml via helm template and confirmed:
    • default (ref: ~): only GIT_SYNC_REV and GIT_SYNC_BRANCH are emitted (no GITSYNC_REF).
    • ref: v1.2.3: only GITSYNC_REF is emitted (no GIT_SYNC_REV/GIT_SYNC_BRANCH).
  • helm lint chart passes with both value sets.
  • Two new unit tests in chart/tests/helm_tests/other/test_git_sync_scheduler.py:
    • test_ref_takes_precedence_over_deprecated_branch_and_rev
    • test_deprecated_branch_and_rev_are_emitted_when_ref_is_unset
  • Updated existing tests in test_git_sync_scheduler.py and test_pod_template_file.py that hardcoded the old three-var emission when ref was set.
  • CI: full breeze testing helm-tests — Windows pytest tempfile locking (NamedTemporaryFile + helm --values) prevents me running the full suite locally; verified via direct helm template invocations instead.

closes: #42918


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.7). I reviewed and understand every change; the design (conditional emission, defaulting ref to null to preserve the default render) is mine, and I validated the fix by inspecting the rendered templates and helm-lint output. Generated per the guidelines.

🤖 Generated with Claude Code

In git-sync v4 the deprecated GIT_SYNC_BRANCH and GIT_SYNC_REV env vars take
precedence over GITSYNC_REF, so the chart's git-sync container ignored
dags.gitSync.ref (e.g. pinning to a tag like v1.2.3) and kept tracking the
branch at rev.

Emit GITSYNC_REF only when dags.gitSync.ref is set, and only emit the
deprecated GIT_SYNC_BRANCH / GIT_SYNC_REV when ref is unset (v3 mode and the
default). Default ref to null so the shipped default render is unchanged for
existing v3 and v4 users -- only users who explicitly set ref see behaviour
change, and that behaviour now matches what the option documents.

closes: apache#42918
@boring-cyborg

boring-cyborg Bot commented Sep 20, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg Bot added the area:helm-chart Airflow Helm Chart label Sep 20, 2026
@Miretpl

Miretpl commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Hi! Thanks for the PR. Due to the removal of git-sync in Helm Chart 2.0, I will close this PR. Please see my comment on the issue: #42918 (comment). Feel free to review and test the guide proposed in #73082 for migration from git-sync to GitDagBundle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:helm-chart Airflow Helm Chart

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Helm chart: Git-sync v4 incorrect mix of branch, ref, rev

2 participants