-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Description
Summary
The Source Hydrator writes a .gitattributes file to the root of the hydrated branch, to hide some generated files in PRs. The content of this file is hardcoded here.
I want to use a different .gitattributes file in my hydration branch, as the current glob patterns do not match my app paths. The current glob patterns assume that all apps are stored in directories directly under the root of the repo.
Motivation
I am currently evaluating gitops-promoter in combination with Source hydrator. The generated files clutter up my promotion PRs severely.
I want to hide these generated files in my PRs, without changing my app directory structure. Source hydrator can handle more deeply nested app directories fine, only the .gitattributes file is not configured correctly. Manually overwriting this file is also not possible, as Source hydrator will overwrite it again with the hardcoded contents.
Proposal
I think there are two ways to solve this issue: Let the cluster admin take care of the .gitattributes content, or dynamically calculate the right glob patterns in Source hydrator.
Approach 1: Let the cluster admin define the content of '.gitattributes'
A cluster admin should be able to overwrite the contents of the .gitattributes file. Either Source Hydrator should just reuse any existing .gitattributes file from the dry branch, if it exists. Or Source hydrator should come with the option to configure what contents this file should have on the hydration branch, e.g. via a property in the ConfigMap argocd-cm.
Approach 2: Calculate the right glob patterns in Source hydrator
If Source hydrator wants to keep the ownership of the .gitattributes file on the hydration branch (= does not allow customizing or overwriting it), it should try to calculate better glob patterns. If hydration occurs in a path that is not matched by the current glob patterns in .gitattributes, Source hydrator should append a matching glob pattern to the file for all generated files.