From 302667e607d5b7730b1dd28d5aca2cd584de53a8 Mon Sep 17 00:00:00 2001 From: German Lashevich Date: Fri, 27 Dec 2024 16:13:44 +0100 Subject: [PATCH] fix: skip ArgoCD Application plugin if not set (#365) --- .../dev/_apps/argocd-tests/app-data.ytt.yaml | 6 +++++ .../envs/dev/env-data.ytt.yaml | 2 ++ .../argocd/mykso-dev/app-argocd-tests.yaml | 23 +++++++++++++++++++ .../argocd-tests/rendering-base.yaml | 6 +++++ .../argocd-tests/rendering-proto.yaml | 6 +++++ .../argocd/mykso-dev/app-httpbingo.yaml | 1 - .../argocd/mykso-prod/app-httpbingo.yaml | 1 - .../templates/argocd/application.ytt.yaml | 1 + 8 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 examples/integration-tests/envs/dev/_apps/argocd-tests/app-data.ytt.yaml create mode 100644 examples/integration-tests/rendered/argocd/mykso-dev/app-argocd-tests.yaml create mode 100644 examples/integration-tests/rendered/envs/mykso-dev/argocd-tests/rendering-base.yaml create mode 100644 examples/integration-tests/rendered/envs/mykso-dev/argocd-tests/rendering-proto.yaml diff --git a/examples/integration-tests/envs/dev/_apps/argocd-tests/app-data.ytt.yaml b/examples/integration-tests/envs/dev/_apps/argocd-tests/app-data.ytt.yaml new file mode 100644 index 00000000..a6b69b0e --- /dev/null +++ b/examples/integration-tests/envs/dev/_apps/argocd-tests/app-data.ytt.yaml @@ -0,0 +1,6 @@ +#@data/values +--- +argocd: + app: + source: + plugin: null diff --git a/examples/integration-tests/envs/dev/env-data.ytt.yaml b/examples/integration-tests/envs/dev/env-data.ytt.yaml index 74807c2d..3234a9da 100644 --- a/examples/integration-tests/envs/dev/env-data.ytt.yaml +++ b/examples/integration-tests/envs/dev/env-data.ytt.yaml @@ -5,6 +5,8 @@ environment: #! applications: # already defined one level above #! - proto: httpbingo # already defined one level above applications: + - proto: ytt-render-test + name: argocd-tests - proto: helm-render-test name: helm-installation - proto: per-chart-override diff --git a/examples/integration-tests/rendered/argocd/mykso-dev/app-argocd-tests.yaml b/examples/integration-tests/rendered/argocd/mykso-dev/app-argocd-tests.yaml new file mode 100644 index 00000000..95d43a44 --- /dev/null +++ b/examples/integration-tests/rendered/argocd/mykso-dev/app-argocd-tests.yaml @@ -0,0 +1,23 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: app-mykso-dev-argocd-tests + namespace: system-argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: env-mykso-dev + destination: + name: mykso-dev + namespace: argocd-tests + source: + path: examples/integration-tests/rendered/envs/mykso-dev/argocd-tests + repoURL: git@github.com:mykso/myks.git + targetRevision: main + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true + - ServerSideApply=true diff --git a/examples/integration-tests/rendered/envs/mykso-dev/argocd-tests/rendering-base.yaml b/examples/integration-tests/rendered/envs/mykso-dev/argocd-tests/rendering-base.yaml new file mode 100644 index 00000000..2be09b29 --- /dev/null +++ b/examples/integration-tests/rendered/envs/mykso-dev/argocd-tests/rendering-base.yaml @@ -0,0 +1,6 @@ +kind: rendering +metadata: + name: base +outputYaml: + fromPrototype: true + fromPrototypeAppData: true diff --git a/examples/integration-tests/rendered/envs/mykso-dev/argocd-tests/rendering-proto.yaml b/examples/integration-tests/rendered/envs/mykso-dev/argocd-tests/rendering-proto.yaml new file mode 100644 index 00000000..2fac5357 --- /dev/null +++ b/examples/integration-tests/rendered/envs/mykso-dev/argocd-tests/rendering-proto.yaml @@ -0,0 +1,6 @@ +kind: rendering +metadata: + name: proto +outputYaml: + fromPrototypeOverride: true + fromPrototypeOverrideFromAppData: true diff --git a/examples/simple/rendered/argocd/mykso-dev/app-httpbingo.yaml b/examples/simple/rendered/argocd/mykso-dev/app-httpbingo.yaml index d8de6dd0..ce09cab6 100644 --- a/examples/simple/rendered/argocd/mykso-dev/app-httpbingo.yaml +++ b/examples/simple/rendered/argocd/mykso-dev/app-httpbingo.yaml @@ -12,7 +12,6 @@ spec: namespace: httpbingo source: path: examples/simple/rendered/envs/mykso-dev/httpbingo - plugin: null repoURL: git@github.com:mykso/myks.git targetRevision: main syncPolicy: diff --git a/examples/simple/rendered/argocd/mykso-prod/app-httpbingo.yaml b/examples/simple/rendered/argocd/mykso-prod/app-httpbingo.yaml index c479b1d3..86662d38 100644 --- a/examples/simple/rendered/argocd/mykso-prod/app-httpbingo.yaml +++ b/examples/simple/rendered/argocd/mykso-prod/app-httpbingo.yaml @@ -12,7 +12,6 @@ spec: namespace: httpbingo source: path: examples/simple/rendered/envs/mykso-prod/httpbingo - plugin: null repoURL: git@github.com:mykso/myks.git targetRevision: main syncPolicy: diff --git a/internal/myks/templates/argocd/application.ytt.yaml b/internal/myks/templates/argocd/application.ytt.yaml index 940ef473..d3e188d6 100644 --- a/internal/myks/templates/argocd/application.ytt.yaml +++ b/internal/myks/templates/argocd/application.ytt.yaml @@ -25,6 +25,7 @@ spec: namespace: #@ a.app.destination.namespace or a.app.name source: path: #@ a.app.source.path + #@ if/end a.app.source.plugin: plugin: #@ a.app.source.plugin repoURL: #@ a.app.source.repoURL targetRevision: #@ a.app.source.targetRevision