Skip to content

Commit

Permalink
shortStage (#90)
Browse files Browse the repository at this point in the history
* adds shortStage helper
  • Loading branch information
whereismyjetpack authored Nov 4, 2024
1 parent 38f7d9d commit ee837fc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/application-core/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 4.2.5
version: 4.2.6


maintainers:
Expand Down
27 changes: 26 additions & 1 deletion charts/application-core/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,37 @@ Expand the name of the chart.
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Build the short stage name based off of the namespace
*/}}
{{- define "application-core.shortStage" }}
{{- if contains "-production" .Release.Namespace }}
{{- printf "%s" "prd" }}
{{- else if contains "-performance" .Release.Namespace }}
{{- printf "%s" "perf" }}
{{- else if contains "-integration" .Release.Namespace }}
{{- printf "%s" "int" }}
{{- else if contains "-sandbox" .Release.Namespace }}
{{- printf "%s" "sbx" }}
{{- else if contains "-staging" .Release.Namespace }}
{{- printf "%s" "stg" }}
{{- else if contains "-demo" .Release.Namespace }}
{{- printf "%s" "demo" }}
{{- else if contains "-qa" .Release.Namespace }}
{{- printf "%s" "qa" }}
{{- else if contains "-development" .Release.Namespace }}
{{- printf "%s" "dev" }}
{{- else }}
{{- printf "%s" .Release.Namespace }}
{{- end }}
{{- end }}

{{/*
Build the env that gets injected into the deployments
*/}}
{{- define "application-core.env" -}}
- name: APP_NAME
value: {{ .Values.appName | default (printf "%s-%s" .Release.Namespace .Release.Name) }}
value: {{ .Values.appName | default (printf "%s-%s" .Release.Name (include "application-core.shortStage" . )) }}
{{- if .Values.env }}
{{ .Values.env | toYaml }}
{{- end }}
Expand Down

0 comments on commit ee837fc

Please sign in to comment.