bases:
 - ../envs/environments.yaml.gotmpl

commonLabels:
  tier: system

releases:
- name: manifests
  namespace: kube-system
  chart: manifests
  missingFileHandler: Info
  values:
  - ../values/env.yaml
  - ../values/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml
  - ../values/system/env.yaml
  - ../values/system/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml.gotmpl
  hooks:
  - events: [ prepare, cleanup ]
    showlogs: true
    command: ../bin/helmify
    args:
    - '{{`{{ if eq .Event.Name "prepare" }}build{{ else }}clean{{ end }}`}}'
    - '{{`{{ .Release.Chart }}`}}'
    - '{{`{{ .Environment.Name }}`}}'
    - ../values/system/manifests
    - manifests
- name: {{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}-manifests
  namespace: kube-system
  chart: {{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}-manifests
  missingFileHandler: Info
  values:
  - ../values/env.yaml
  - ../values/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml
  - ../values/system/env.yaml
  - ../values/system/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml.gotmpl
  hooks:
  - events: [ prepare, cleanup ]
    showlogs: true
    command: ../bin/helmify
    args:
    - '{{`{{ if eq .Event.Name "prepare" }}build{{ else }}clean{{ end }}`}}'
    - '{{`{{ .Release.Chart }}`}}'
    - '{{`{{ .Environment.Name }}`}}'
    - ../values/system/{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}
    - {{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}-manifests

