fluxcd / source-controller

The GitOps Toolkit source management component
https://fluxcd.io
Apache License 2.0
240 stars 188 forks source link

Git repository `includes` dependencies don't actually trigger an update #1660

Open solidDoWant opened 2 hours ago

solidDoWant commented 2 hours ago

Per the docs, "A change in the included repository will trigger an update of the including repository.". I'm attempting to include one repo in another, basically:

---
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
  name: dependency-repo
spec: ...
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
  name: dependent-repo
spec:
  ...
  interval: 87600h  # Arbitrary long time
  include:
    - repository:
        name: dependency-repo
      fromPath: ...
      toPath: ...

The dependency-repo reconciles properly, but dependent-repo never gets triggered.

I read through the gitrepository controller and test code, and it seems that when the dependent-repo reconciliation is triggered exclusively by either a generation change, or a reconciliation request. When this happens, if the dependency-repo has changed, the change will be included in the dependent-repo artifact even if the dependent-repo source hasn't been updated. However, when the dependency-repo is updated, nothing changes the dependent-repo generation, or annotates the dependent-repo with a reconciliation request annotation. As such, the dependency-repo update doesn't actually trigger a dependent-repo update.

Am I missing something here, or is this either a controller bug, or a documentation issue?

matheuscscp commented 1 hour ago

Duplicate of #522