Skip to content

Commit

Permalink
Fix issue with collecting OCIRepositories during diff (#772)
Browse files Browse the repository at this point in the history
Adding additional repository examples, but they don't reproduce the
issue.
  • Loading branch information
allenporter authored Aug 7, 2024
1 parent 18bb03c commit a7a655c
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
6 changes: 5 additions & 1 deletion flux_local/tool/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ def create_diff_path(
yield git_repo.PathSelector(path_orig, sources=kwargs.get("sources"))
return

with git_repo.create_worktree(selector.repo, existing_branch=kwargs.get("branch_orig")) as worktree:
with git_repo.create_worktree(
selector.repo, existing_branch=kwargs.get("branch_orig")
) as worktree:
yield git_repo.PathSelector(pathlib.Path(worktree) / selector.relative_path)


Expand Down Expand Up @@ -366,6 +368,7 @@ async def run( # type: ignore[no-untyped-def]
helm_visitor = HelmVisitor()
query.kustomization.visitor = content.visitor()
query.helm_repo.visitor = helm_visitor.repo_visitor()
query.oci_repo.visitor = helm_visitor.repo_visitor()
query.helm_release.visitor = helm_visitor.release_visitor()
options = selector.build_helm_options(**kwargs)
await git_repo.build_manifest(
Expand All @@ -378,6 +381,7 @@ async def run( # type: ignore[no-untyped-def]
query.path = path_selector
query.kustomization.visitor = orig_content.visitor()
query.helm_repo.visitor = orig_helm_visitor.repo_visitor()
query.oci_repo.visitor = orig_helm_visitor.repo_visitor()
query.helm_release.visitor = orig_helm_visitor.release_visitor()
await git_repo.build_manifest(
selector=query, options=selector.options(**kwargs)
Expand Down
19 changes: 19 additions & 0 deletions tests/testdata/cluster7/flux/apps/cloudflare/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: cloudflared
namespace: flux-system
spec:
interval: 60m
chartRef:
kind: OCIRepository
name: app-template
namespace: flux-system
install:
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
retries: 3
14 changes: 14 additions & 0 deletions tests/testdata/cluster7/flux/charts/app-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: OCIRepository
metadata:
name: app-template
namespace: flux-system
spec:
interval: 12h
layerSelector:
mediaType: application/vnd.cncf.helm.chart.content.v1.tar+gzip
operation: copy
url: oci://ghcr.io/bjw-s/helm/app-template
ref:
tag: "3.3.2"
5 changes: 3 additions & 2 deletions tests/tool/__snapshots__/test_get_hr.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@
# ---
# name: test_get_hr[cluster7]
'''
NAMESPACE NAME REVISION CHART SOURCE
database postgresql 12.7.1 database-postgresql bitnami-charts
NAMESPACE NAME REVISION CHART SOURCE
flux-system cloudflared None flux-system-app-template app-template
database postgresql 12.7.1 database-postgresql bitnami-charts

'''
# ---
Expand Down

0 comments on commit a7a655c

Please sign in to comment.