Skip to content

Track ReplaceTokens values as processResources inputs - #40133

Merged
shunping merged 1 commit into
apache:masterfrom
shunping:fix-gradle-token-not-tracked
Sep 16, 2026
Merged

shunping merged 1 commit into
apache:masterfrom
shunping:fix-gradle-token-not-tracked

Conversation

@shunping

@shunping shunping commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Gradle treats the tokens: map passed to the ReplaceTokens content filter as a filter argument, not a task input, so it affects neither the up-to-date check nor the build cache key. The filtered sources contain only unsubstituted placeholders and are byte identical regardless of what the tokens expand to, so nothing invalidates processResources when a token value changes.

In a shared checkout where build branch switches, the task stays UP-TO-DATE and the previous branch's substituted resource is left behind. Particularly, switching master -> a former release branch left dataflow.properties holding master's container version, so pipelines ran against a wrong version of beam-master SDK harness. The same staleness also poisons the build cache, since both branches compute the same key for different correct outputs, so clean is not a reliable workaround.

This can be fixed by declaring the token map as an input property.

Reference: https://docs.gradle.org/current/userguide/incremental_build.html#sec:task_inputs_outputs

Gradle treats the `tokens:` map passed to the ReplaceTokens content
filter as a filter argument, not a task input, so it affects neither
the up-to-date check nor the build cache key. The filtered sources
contain only unsubstituted placeholders and are byte identical
regardless of what the tokens expand to, so nothing invalidates
processResources when a token value changes.

In a shared checkout where build/ survives branch switches, the task
stays UP-TO-DATE and the previous branch's substituted resource is
left behind. Switching master -> a former release branch left
dataflow.properties holding master's container version, so pipelines
ran against a wrong version of beam-master SDK harness. The same
staleness also poisons the build cache, since both branches compute
the same key for different correct outputs, so `clean` is not a
reliable workaround.

This can be fixed by declaring the token map as an input property.
@shunping

Copy link
Copy Markdown
Collaborator Author

r: @derrickaw

@shunping
shunping marked this pull request as ready for review September 15, 2026 16:10
@github-actions

Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@shunping
shunping requested a review from derrickaw September 15, 2026 20:09
@stankiewicz
stankiewicz self-requested a review September 16, 2026 13:29
@shunping
shunping merged commit 720fa2f into apache:master Sep 16, 2026
23 checks passed
@shunping
shunping deleted the fix-gradle-token-not-tracked branch September 16, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants