Skip to content

Conversation

@FourFifthsCode
Copy link
Contributor

@FourFifthsCode FourFifthsCode commented Dec 4, 2025

When using argocd.argoproj.io/manifest-generate-paths annotation with source hydrator enabled apps, make sure to base relative paths off of drySource path and not the sync source.

This fix allows hydration to properly trigger refreshes on paths specified by manifest-generate-paths annotation.

Partial fix for #25094

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Title of the PR
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@FourFifthsCode FourFifthsCode requested a review from a team as a code owner December 4, 2025 15:21
@bunnyshell
Copy link

bunnyshell bot commented Dec 4, 2025

❗ Preview Environment deployment failed on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

Comment on lines 111 to 112
// For sourceHydrator apps, resolve paths relative to the DRY source
// since webhook events contain files changed in the dry source repository
Copy link
Member

Choose a reason for hiding this comment

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

You also want to resolve the path relative to the syncSource, otherwise the application will not sync.

Copy link
Member

Choose a reason for hiding this comment

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

@agaudreault I think that's addressed here: #25295 Maybe we should combine the PRs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

combining sounds good to me

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think we should have the complete fix in 1 PR so it is easier to understand.

This PR alone would make it worse I think, because it is more important to sync fast the desired state than hydrate fast IMO.

Copy link
Member

Choose a reason for hiding this comment

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

@FourFifthsCode rebase this PR on Puneet's PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have rebased on @pbhatnagar-oss's PR and added paths for both sync and dry sources

@crenshaw-dev
Copy link
Member

I'll override DCO if it becomes a huge pain to fix. :-)

@FourFifthsCode
Copy link
Contributor Author

I'll override DCO if it becomes a huge pain to fix. :-)

I rebased on upstream and just cherry picked @pbhatnagar-oss's commits

Copy link
Member

@agaudreault agaudreault left a comment

Choose a reason for hiding this comment

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

I think after GetAppRefreshPaths is changed to receive the source in parameters, the implementation of the webhook handle event is much simpler.

if the app has an hydrator source configured, check the DrySource for change.
then, check the default source for change.

continue
}
}
} else if sourceRevisionHasChanged(syncSource, revision, touchedHead) && sourceUsesURL(syncSource, webURL, repoRegexp) { // handle webhook for syncSource
Copy link
Member

Choose a reason for hiding this comment

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

Should call storePreviouslyCachedManifests if no changes in the revision.

for _, source := range app.Spec.GetSources() {
paths = append(paths, filepath.Clean(filepath.Join(source.Path, item)))
// For sourceHydrator apps, resolve paths relative to DRY source
if app.Spec.SourceHydrator != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Should receive the current source in parameter since it influence the refresh path.

  • if source hydrator configured, if syncing sources, use sync source path
  • if source hydrator configured, if hydrating sources, use annotation path and Dry source (source in params) base
  • if source hydrator not configured, use annotation path and default source base (source in params)

} else if sourceRevisionHasChanged(syncSource, revision, touchedHead) && sourceUsesURL(syncSource, webURL, repoRegexp) { // handle webhook for syncSource
// syncSource webhook events only trigger sync, not hydration. Unlike drySource events,
// skip the manifest_generate_path file check since hydration is not required here.
namespacedAppInterface := a.appClientset.ArgoprojV1alpha1().Applications(app.Namespace)
Copy link
Member

Choose a reason for hiding this comment

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

This should also check if AppFilesHaveChanged.

} else {
for _, source := range app.Spec.GetSources() {
paths = append(paths, filepath.Clean(filepath.Join(source.Path, item)))
// For sourceHydrator apps, resolve paths relative to DRY source
Copy link
Member

Choose a reason for hiding this comment

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

This method is also called in the GetRepoObjs function and should return the right value depending if we are current acting on the dry or sync source.

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.

4 participants