From e905131d46b79d2d3bf97ad95b6678b551b394bc Mon Sep 17 00:00:00 2001 From: martinbozinovski Date: Mon, 4 Nov 2024 16:32:40 +0100 Subject: [PATCH] add check for global map --- src/app/templates/_helpers.tpl | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/app/templates/_helpers.tpl b/src/app/templates/_helpers.tpl index 2fff4d27..e2fca27d 100644 --- a/src/app/templates/_helpers.tpl +++ b/src/app/templates/_helpers.tpl @@ -1,11 +1,21 @@ {{- define "arkcase.app.image.artifacts" -}} - {{- $imageName := "artifacts" -}} - {{- $portal := (include "arkcase.portal" $.ctx | fromYaml) -}} - {{- if $portal -}} - {{- $imageName = (printf "%s-%s" $imageName $portal.containerSuffix) -}} + {{- $ctx := .ctx -}} + {{- if not (include "arkcase.isRootContext" $ctx) -}} + {{- fail "The given 'ctx' parameter must be the root context (. or $)" -}} + {{- end -}} + + {{- $global := $ctx.Values.global -}} + {{- if or (not $global) (not (kindIs "map" $global)) -}} + {{- $global = dict -}} + {{- else -}} + {{- $imageName := "artifacts" -}} + {{- $portal := (include "arkcase.portal" $.ctx | fromYaml) -}} + {{- if $portal -}} + {{- $imageName = (printf "%s-%s" $imageName $portal.containerSuffix) -}} + {{- end -}} + {{- $param := (merge (dict "name" $imageName) $) -}} + {{- include "arkcase.image" $param }} {{- end -}} - {{- $param := (merge (dict "name" $imageName) $) -}} - {{- include "arkcase.image" $param }} {{- end -}} {{- define "arkcase.artifacts.external" -}}