From f97e897fbcfff6f3448a99bd4ad43739ec59bc08 Mon Sep 17 00:00:00 2001 From: Mark Schuit Date: Thu, 4 Apr 2024 15:41:24 +0800 Subject: [PATCH] [FIX] argocd_deployer - Fixed templates and application set deployment --- .../data/application_set_template.xml | 19 ++++++++++--------- argocd_deployer/models/application_set.py | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/argocd_deployer/data/application_set_template.xml b/argocd_deployer/data/application_set_template.xml index 49b50a5..575f5ba 100644 --- a/argocd_deployer/data/application_set_template.xml +++ b/argocd_deployer/data/application_set_template.xml @@ -2,30 +2,31 @@ Master application set template - Do not change apiVersion: argoproj.io/v1alpha1 +apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: - name: curq-application-sets + name: curq-master-application-set namespace: argocd spec: goTemplate: true generators: - - git: - repoURL: {{.config.repository_url}} - revision: {{.config.branch}} - files: - - path: {{.config.deployment_directory}} + - git: + repoURL: {{.config.repository_url}} + revision: {{.config.branch}} + files: + - path: {{.config.deployment_directory}}/**/application_set.yaml template: metadata: - name: curq-application-sets + name: "application-set-{{ "{{ " }}.path.basename{{ " }}" }}" spec: project: "default" source: repoURL: {{.config.repository_url}} targetRevision: {{.config.branch}} - path: {{.config.deployment_directory}}/{{ "{{ " }}.path.basename{{ " }}" }} + path: "{{ "{{ " }}.path.filename{{ " }}" }}" destination: name: in-cluster - namespace: argocd + namespace: "application-set-{{ "{{ " }}.path.basename{{ " }}" }}" syncPolicy: syncOptions: - CreateNamespace=true diff --git a/argocd_deployer/models/application_set.py b/argocd_deployer/models/application_set.py index 37a27f3..390d88f 100644 --- a/argocd_deployer/models/application_set.py +++ b/argocd_deployer/models/application_set.py @@ -239,7 +239,7 @@ def _get_repository(self): return Repo.clone_from(self.repository_url, directory) def _get_branch(self): - return self.branch + return self.env.ref("argocd_deployer.application_set_master").branch def _format_commit_message(self, message): return message % self.name