Skip to content

Commit e75cd6d

Browse files
fix: Fixes ArgoCD applications that have multiple sources (keephq#3926)
1 parent 67e1fc6 commit e75cd6d

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

keep/providers/argocd_provider/argocd_provider.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def pull_topology(self):
210210
source_provider_id=self.provider_id,
211211
service=metadata["uid"],
212212
display_name=metadata["name"],
213-
repository=spec["source"].get("repoURL"),
213+
repository=self.__get_repository_urls(spec),
214214
)
215215
applications = {}
216216
if applicationSets:
@@ -235,3 +235,18 @@ def pull_topology(self):
235235
] = "unknown"
236236

237237
return list(service_topology.values()), {}
238+
239+
def __get_repository_urls(self, spec: dict) -> str:
240+
"""
241+
Extract repository URLs from application spec, handling both single and multiple sources.
242+
Returns a comma-separated string of repository URLs.
243+
"""
244+
repos = []
245+
if "sources" in spec:
246+
# Handle multiple sources
247+
repos.extend(source.get("repoURL") for source in spec["sources"] if source.get("repoURL"))
248+
elif "source" in spec and spec["source"].get("repoURL"):
249+
# Handle single source
250+
repos.append(spec["source"]["repoURL"])
251+
252+
return ", ".join(repos) if repos else None

0 commit comments

Comments
 (0)